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.

All other Modules

Discuss all other Modules here.

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

Problem with MobileSiteControllerExtension.php and cron


Reply

5 Posts   590 Views

Avatar
_Vince

21 June 2012 at 5:21pm Community Member, 161 Posts

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?

Avatar
Willr

21 June 2012 at 10:18pm Forum Moderator, 5511 Posts

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

Avatar
_Vince

22 June 2012 at 12:33am Community Member, 161 Posts

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! :)

Avatar
Willr

22 June 2012 at 2:50pm Forum Moderator, 5511 Posts

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.

Avatar
_Vince

23 June 2012 at 12:14am Community Member, 161 Posts

Wow, thanks heaps! :D