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.

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



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 (as I believe this is what flushes the mainifest). I then run 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 is not making this class available but a call to ManifestBuilder::create_manifest_file() does?