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?