Hello,
I have a problem that's driving me crazy!
In a custom module, I have a schedule created that runs every 15 minutes to process the initial setup of configuration after installing the module.
What is supposed to happen is that upon completion, the schedule should be set to "Inactive".
I have a schedule setup to run a URL:
http://mysugar.com/setup_wizard.php
In setup_wizard.php, I have the following code at the end of the script to de-activate the schedule:
The second scheduler status / save was just for testing purposes and to get the status after I attempt to change it.PHP Code:
logsetup("Inactivating Wizard scheduler...");
//once done, inactivate the scheduler
$sch = new Scheduler();
$sch->retrieve_by_string_fields(array('name' => 'Process Wizard'));
logsetup("Scheduler ID: ".$sch->id." Status: ".$sch->status);
if(!empty($sch->id)){
logsetup("Tyring to change status to Inactive");
$sch->status = "Inactive";
$sch->catch_up = "0";
$sch->save();
}
$sch = new Scheduler();
$sch->retrieve_by_string_fields(array('name' => 'Process UAE Wizard'));
$sch->status = "Inactive";
$sch->save();
logsetup("STATUS NOW: ".$sch->status);
logsetup("============== Setup completed at ". date("Y-m-d H:i:s")."=================");
When this runs via cron, the log that I'm creating says:
Inactivating Wizard scheduler...
Scheduler ID: 6c5510e8-a082-1720-2232-4d7506992c98 Status: In Progress
Tyring to change status to Inactive
STATUS NOW: Inactive
============== Setup completed at 2011-03-07 16:45:07=================
However, when I go to the scheduler, it's still listed as "Active".
If I run the URL of the wizard directly, ( i.e. http://mysugar.com/setup_wizard.php ) rather than via the scheduler / cron, it deactivates as expected.
What am I missing here? Is it not possible to change the status of the schedule while it's running?
Thanks in advance.


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks