3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2296 Views |
-
Problems rebuilding database

22 May 2009 at 8:55am
So I'm really new to SilverStripe and I'm sure my question is probably (hopefully) an easy one. I trying to work my way through the tutorials and unfortunately, I can't make my way past the first one. My problem is when I copy/paste the code for the HomePage.php file and save it into the "mysite/code/" directory it seems to break the site. I perform the database rebuild command "http://localhost:8888/dev/build?flush=1" (I'm using MAMP Pro on a Mac running OS X.5) and it seems to freeze up halfway through the creating database run. I'm not sure if there is a specific change I need to make to MAMP for SilverStripe to work properly. Below is the information displayed on the screen when performing the rebuild.
Building DatabaseCreating database tables
PageComment
SiteTree
Field SiteTree.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
Field SiteTree_Live.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
Field SiteTree_versions.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
Email_BounceRecord
QueuedEmail
File
Group
LoginAttempt
Member
MemberPassword
Permission
Widget
WidgetArea
EditableCheckboxOption
EditableDropdownOption
EditableFormField
EditableRadioOption
SubmittedForm
SubmittedFormField
Page
GhostPage
ArticleHolder
ArticlePage -
Re: Problems rebuilding database

22 May 2009 at 8:59am
Sorry, I forgot to mention that once I've attempted the rebuild, the site no longer works at all. I get a blank screen. I turned on the error reporting for PHP and it reports an T_sytax error on line 6. here is the code from the HomePage.php file.
<?php
/**
* Defines the HomePage page type
*/
class HomePage extends Page {
static $db = array(
);
static $has_one = array(
);
}
class HomePage_Controller extends Page_Controller {
   function init() {
   parent::init();
}
?> -
Re: Problems rebuilding database

22 May 2009 at 1:29pm
T_sytax error on line 6
And it was line 6 of HomePage.php? not Page.php?
-
Re: Problems rebuilding database

22 May 2009 at 2:02pm
Below is the output from the rebuild attempt: (below that is the actual HomePage.php code)
Environment Builder (formerly db/build)
http://localhost:8888/dev→ build
Building DatabaseCreating database tables
PageComment
SiteTree
Field SiteTree.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
Field SiteTree_Live.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
Field SiteTree_versions.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
Email_BounceRecord
QueuedEmail
File
Group
LoginAttempt
Member
MemberPassword
Permission
Widget
WidgetArea
EditableCheckboxOption
EditableDropdownOption
EditableFormField
EditableRadioOption
SubmittedForm
SubmittedFormField
Page
GhostPage
ArticleHolder
ArticlePageParse error: syntax error, unexpected T_CLASS in /Applications/MAMP/htdocs/silverstripe/SilverStripe-v2.3.1/mysite/code/HomePage.php on line 6
Here is the HomePage.php file:
<?php
/**
* Defines the HomePage page type
*/
Â
class HomePage extends Page {
static $db = array(
);
static $has_one = array(
);
Â
}
Â
class HomePage_Controller extends Page_Controller {
}
?> -
Re: Problems rebuilding database

23 May 2009 at 6:06am
Hi There,
I just ran into this same error... at the same spot in the tutorial.
If you copy-and-pasted from the web tutorial, you probably picked up some extra hidden characters that php doesn't like. If you can, view the code in a text editor and display "invisibles". You'll see some extra characters, probably for carriage returns.
Go ahead and delete those.
If you aren't able to view the hidden characters, simply delete all blank lines in the code. That should also solve the problem.
I hope this helps.
-
Re: Problems rebuilding database

23 May 2009 at 6:15am
Thanks WildCat,
That's exactly what was going on. I deleted everything and re-wrote the code by hand and it worked instantly. Serves me right, for copying and pasting code! Sometimes the easy way isn't always the best. Thanks for the help!
| 2296 Views | ||
|
Page:
1
|
Go to Top |



