Jump to:

4938 Posts in 16764 Topics by 1490 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » Is there a specific test for live mode?

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

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

Page: 1
Go to End
Author Topic: 2172 Views
  • ianpiper
    Avatar
    Community Member
    32 Posts

    Is there a specific test for live mode? Link to this post

    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.
    --

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Is there a specific test for live mode? Link to this post

    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.

  • timcole
    Avatar
    Community Member
    32 Posts

    Re: Is there a specific test for live mode? Link to this post

    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?

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: Is there a specific test for live mode? Link to this post

    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?

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Is there a specific test for live mode? Link to this post

    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());
    }

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: Is there a specific test for live mode? Link to this post

    Thanks Willr,

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

    2172 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.