Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

db/build?flush=1


Reply


5 Posts   1445 Views

Avatar
Rube_25

Community Member, 36 Posts

16 September 2008 at 9:03am

   
Hello

I would like to know that this happens:

each time I db/build?flush=1

I automatically creates a new Home

Home-2
Home-3

and each time I have to delete them

   
I hope your help
thanks
rube

Avatar
François

25 Posts

17 October 2008 at 9:18am

Same "problem" for me.

I do NOT want a page named "home". How can we get rid of this "requirement" ?

Thanks.

Avatar
François

25 Posts

17 October 2008 at 10:07am

Edited: 17/10/2008 10:07am

I think found the solution.

The home page gets re-created (when doing db/build?flush=1) by the method SiteTree->requireDefaultRecords() (starting at line 707 in sapphire/core/model/SiteTree.php)

Is there any risk to remove this auto-creation of the home page?

More precisely, is a page named "home" mandatory in the CMS ?

Thanks for any advice.

Avatar
simon_w

Forum Moderator, 474 Posts

17 October 2008 at 10:14am

The page with the URLSegment home is used as the home page for every domain where another one isn't specified.

Getting multiple home pages (home-2, home-3 etc) suggests that you have a class called Home, which is causing SilverStripe to change the URLSegment.

While the URLSegment is home, nothing else about the page has to be home. You could have a completely different title and navigation label, so long as the URLSegment is still home.

Avatar
François

25 Posts

18 October 2008 at 8:18am

Thanks for your answer simon_w. But my problem is a bit different.

The site I develop must be in french, everything. This is a requirement of my client. So, the home page must be called 'accueil' instead of 'home'. That is why I was very annoyed to see a 'home' re-createad each time a did a db rebuild.

Finally, the solution is very simple:

1) delete the code which is responsible for the creation of the 'home' page. This is the code in SiteTree->requireDefaultRecords() which I mentionned in my previous post.

2) set up my "new" home page by putting my domain name in the "Domains" field of the "Behavior" properties of the page.

That's it!

In my opinion I think that's not a very good idea to include such "magic" (the automatic creation of some content) in a product. A better place would be in an external script clearly documented. But, anyway, I found a solution and that's the most important. I still love SilverStripe!