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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Scheduled tasks and ManifestBuilder


Go to End


1288 Views

Avatar
B73

Community Member, 1 Post

21 March 2010 at 5:49pm

Hi Guys,

I have written a scheduled task (lets call it BlahTask) that extends DailyTask. Whilst developing I have been testing in the browser by instantiating BlahTask from a Page (MyTestPage). All works well.

Now to the problem: If I run BlahTask from the command line (on my local Windows machine) using:

php.exe -f "path-to-site-webroot\sapphire\cli-script.php" -- BlahTask

The task runs but fails when BlahTask attempts to instantiate another class (MyOtherClass). MyOtherClass is in the same directory as BlahTask. This is strange because if I run BlahTask from MyTestPage in the browser BlahTask can instantiate MyOtherClass.

I figured that the problem must be somehow related to the Manifest. So I run www.mysite.com/?flush=all (as I believe this is what flushes the mainifest). I then run www.mysite.com/?debugmanifest and on inspection of the output I can see references to MyOtherClass. So I figure that the manifest knows about MyOtherClass.

I now run BlahTask again from the command line, but the problem persists (BlahTask still can't instantiate MyOtherClass).

The only way I can seem to get BlahTask to recognise MyOtherClass (when run from the command line) is by hardcoding a call to ManifestBuilder::create_manifest_file() in BlahTask. I only need to call ManifestBuilder::create_manifest_file() once. After which MyOtherClass is permanently available (i.e. I can remove the call to ManifestBuilder::create_manifest_file() for subsequent calls).

Can anyone explain why www.mysite.com/?flush=all is not making this class available but a call to ManifestBuilder::create_manifest_file() does?

Cheers