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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Is there a specific test for live mode?


Go to End


6 Posts   3942 Views

Avatar
ianpiper

Community Member, 32 Posts

19 January 2010 at 5:24am

I have had an email from a colleague warning about a scam involving scallywags using SilverStripe sites that are in dev mode. From reading the documentation I think that my site is in live mode (the Director::set_environment_type("dev") directive is not set and it is not running on localhost). But is there a way that I can be sure? I do see some slightly alarming options when I look at the /dev/folder on my site, without authenticating as admin.

Reassurance craved!

Ian.
--

Avatar
Willr

Forum Moderator, 5523 Posts

19 January 2010 at 9:23am

You can tell if your site is in live mode by logging out entirely then trying to do any of the developer tasks. Eg go to yoursite.com/dev/build. If it is in live mode you should be prompted for a password before you are allowed to rebuild the database. If you aren't asked for a password to do that you are either a) still logged in :) or b) not in live mode.

Or if you want to be a bit more certain you could add something like this in your _config file to just test it out (remove it afterwards)

die(Director::get_environment_type());

Which should give you a blank screen with either 'live', 'test', 'dev' or nothing.

Avatar
timcole

Community Member, 32 Posts

29 April 2010 at 1:30pm

Hi - I have a site which is launching TODAY and I have just tried putting it in "Live" mode using: Director::set_environment_type("live"); in my _config.php.

But, I can still access /dev/build without being logged in! I tried putting your code in Willr and the pages came out saying "live". Any idea why it's still letting anyone at dev/build without needing a password?

Avatar
DsX

Community Member, 178 Posts

17 October 2010 at 6:29am

I have a site, where I need to switch css resources depending on my dev mode.
How can I test my mode from within a template?

Avatar
Willr

Forum Moderator, 5523 Posts

17 October 2010 at 10:05am

DsX - that function is not available in the templates but you can put something like this in page.php which will allow you to use <% if InDevMode %> (or you could look for live rather than dev)

function InDevMode() {
return (Director::isDev());
}

Avatar
DsX

Community Member, 178 Posts

17 October 2010 at 11:33am

Thanks Willr,

thats just about the exact same as I added ;)
Might be a worthwhile one to add as a standard.