Jump to:

22999 Posts in 11854 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » Scheduled tasks and ManifestBuilder

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

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

Page: 1
Go to End
Author Topic: 949 Views
  • B73
    Avatar
    Community Member
    1 Post

    Scheduled tasks and ManifestBuilder Link to this post

    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

    949 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.