Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Problem with MobileSiteControllerExtension.php and cron

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 565 Views
  • _Vince
    Avatar
    Community Member
    158 Posts

    Problem with MobileSiteControllerExtension.php and cron Link to this post

    I'm trying to run a cron job (to update quantities sold on the ecommerce modules) and, while the script runs well manually on my development server, when I run things live, the log file gets this and the quantities are not updated.

    Line 60 in /home/mysite/domains/mysite.co.nz/public_html/mobile/code/MobileSiteControllerExtension.php

    Source
    ======
    51:    }
    52:
    53:    /**
    54:     * Return whether the user is on the mobile version of the website
    55:     * @return boolean
    56:     */
    57:    public function onMobileDomain() {
    58:       $config = SiteConfig::current_site_config();
    59:       $parts = parse_url($config->MobileDomain);
    * 60:       if(isset($parts['host']) && $parts['host'] == $_SERVER['HTTP_HOST']) {
    61:          return true;
    62:       } else {
    63:          return false;
    64:       }
    65:    }
    66:

    Trace
    =====
    <ul>MobileSiteControllerExtension->onMobileDomain()
    line 31 of MobileSiteControllerExtension.php

    MobileSiteControllerExtension->onBeforeInit(,,,,,,)
    line 963 of Object.php

    Object->extend(onBeforeInit)
    line 132 of Controller.php

    Controller->handleRequest(SS_HTTPRequest)
    line 199 of ContentController.php

    ContentController->handleRequest(SS_HTTPRequest)
    line 67 of ModelAsController.php

    ModelAsController->handleRequest(SS_HTTPRequest)
    line 282 of Director.php

    Director::handleRequest(SS_HTTPRequest,Session)
    line 125 of Director.php

    Director::direct(/home/mysite/domains/mysite.co.nz/public_html/mysite/tasks/RecalcSoldQuantitiesJob.php)
    line 77 of cli-script.php

    </ul>

    Do I need to create an ss_environment.php file?

    I'm really not sure what to do next.

    Can anybody help?

  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: Problem with MobileSiteControllerExtension.php and cron Link to this post

    Did you cut anything off that page (like the top part) that says Notice: or User_error. It's likely HTTP_HOST does not exist in CLI mode.

    Do I need to create an ss_environment.php file?

    For sake to work via command line you'll need a _ss_environment.php anyway (or to put the following in your _config.php file) http://doc.silverstripe.org/framework/en/topics/commandline#configuration

  • _Vince
    Avatar
    Community Member
    158 Posts

    Re: Problem with MobileSiteControllerExtension.php and cron Link to this post

    Hi, Will.

    I didn't cut anything off, I just sent the output to a log file.

    I'm looking at the documentation but confused by where the ss_environment file is supposed to be created.

    Given the path,
    /home/mysite/domains/mysite.co.nz/public_html/mysite/

    and that there's no /var,

    where would the ss_environment file go?

    Thanks for the help!

  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: Problem with MobileSiteControllerExtension.php and cron Link to this post

    The _ss_environment.php file can go in your sites root folder (i.e /home/mysite/domains/mysite.co.nz/public_html) or a parent folder.

  • _Vince
    Avatar
    Community Member
    158 Posts

    Re: Problem with MobileSiteControllerExtension.php and cron Link to this post

    Wow, thanks heaps!

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