23377 Posts in 18296 Topics by 2867 members
|Go to End|
3 November 2011 at 1:26am
I have a daily scheduled task successfully running on the site I am working on, which is great. However, I need to implement another scheduled task at a different frequency, so I created a task subclassing the QuarterHourlyTask and set the cron to run every 15 minutes. I implemented it exactly the same way as the daily task except for the different parent.
However, if I execute on the command line:
/path/to/php /path/to/webroot/sapphire/cli-script.php QuarterHourlyTask
is echoed implying that my subclass was not found. I've rebuilt the manifest.
Looking at CliController, it takes the class specified, finds all the subclasses and loops through them, echoing out the classname as it goes. Works fine for DailyTask. If, via a browser, I create a test function to list out the subclasses of QuarterHourlyTask, my task is listed, however when running from the command line, it isn't found.
Works fine on my local environment.
Anyone had this sort of thing and sorted it? It is probably something simple, but at the minute I just can see it.
3 November 2011 at 9:21pm Last edited: 3 November 2011 9:22pm
Just a further observation.
I have added some new functionality to the site that is all functioning well when viewed via the admin interface and the front end. However, in my daily task that was executed this morning (this is the task that works), a fatal error was thrown that one of the new classes that I have added (and is working), was not found.
I do recall that when I previously added a report, although working nicely in the admin, the next daily task run complained that it didn't exist, (or rather that it wasn't a child of SS_Report). I assume the project _config.php was being parsed and that is where the report was being registered with the ReportAdmin. My new class, that is the focus of the current error, is also referenced in the project _config.php where the DataObjectManager SortableDataObject is used.
This leads me to believe there is some difference in the manifest information that the CliController uses and the standard website, that seems to even out over some time, as the previously mentioned Report error just disappeared.
Can anyone shed any light?
4 November 2011 at 6:27pm
Tried passing a flush=1 to the script via cli? There are seperate manifest files for cli and_www,
/path/to/php /path/to/webroot/sapphire/cli-script.php QuarterHourlyTask "?flush=1"
4 November 2011 at 9:16pm
I'd just this second found that out and tried flush=all and bingo, then logged in here to add my findings, but you got there first!
At first I hadn't noticed in the silverstripe-cache directory the two files "manifest-main" and "manifest-cli-script", which obviously would explain what I'd been seeing. Then a quick revisit to the commandline docs and seeing that $_GET params can be passed in as you describe, I thought I'd give flush a go. Sorted.
Just for completeness:
/path/to/php /path/to/webroot/sapphire/cli-script.php QuarterHourlyTask flush=all
The only question remains is how the manifest was previously built and the report error that I had noticed seemed to disappear by itself, as I didn't carry out a flush then, yet the DailyTask had been running for a while. That answer is only required out of interest now I know that I need to carry out a manifest rebuild for cli as well as www when I add new stuff that impacts on _config.php
|Go to Top|