10446 Posts in 2223 Topics by 1719 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 390 Views |
-
Problem with MobileSiteControllerExtension.php and cron

21 June 2012 at 5:21pm
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.phpMobileSiteControllerExtension->onBeforeInit(,,,,,,)
line 963 of Object.phpObject->extend(onBeforeInit)
line 132 of Controller.phpController->handleRequest(SS_HTTPRequest)
line 199 of ContentController.phpContentController->handleRequest(SS_HTTPRequest)
line 67 of ModelAsController.phpModelAsController->handleRequest(SS_HTTPRequest)
line 282 of Director.phpDirector::handleRequest(SS_HTTPRequest,Session)
line 125 of Director.phpDirector::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?
-
Re: Problem with MobileSiteControllerExtension.php and cron

21 June 2012 at 10:18pm
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
-
Re: Problem with MobileSiteControllerExtension.php and cron

22 June 2012 at 12:33am
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!
-
Re: Problem with MobileSiteControllerExtension.php and cron

22 June 2012 at 2:50pm
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.
-
Re: Problem with MobileSiteControllerExtension.php and cron

23 June 2012 at 12:14am
Wow, thanks heaps!
| 390 Views | ||
|
Page:
1
|
Go to Top |


