public function execute(CommandContext $context)
 {
     $pulse = \pulse\PulseFactory::getByName('AutoAssign', 'hms');
     if (!empty($pulse)) {
         $began = strftime('on %d %h %Y at %I:%M %P', $pulse->getStartTime());
         $message = "<h2>The autoassigner is already running.</h2><p>It started at {$began} and was scheduled by {$user}.</p>";
     } else {
         PHPWS_Core::initModClass('hms', 'command/SavePulseOptionCommand.php');
         SavePulseOptionCommand::addAutoAssignSchedule();
         $message = '<h2>The autoassigner is now running.</h2><p>You will receive an email when it is finished.</p>';
     }
     $context->setContent($message . '<a href="index.php?module=hms&action=ShowAdminMaintenanceMenu">Return to Main Menu</a>');
 }
Example #2
0
 /**
  * Returns null if not found.
  * @return \PulseSchedule
  */
 private function NightlyCacheScheduleSet()
 {
     $result = \pulse\PulseFactory::getByName('NightlyCache', 'hms');
     return $result;
 }
 public function addNightlyCacheSchedule()
 {
     $pulse = \pulse\PulseFactory::getByName('NightlyCache', 'hms');
     if (!empty($pulse)) {
         throw new \Exception('Night Cache schedule is already present.');
     }
     $ps = pulse\PulseFactory::build();
     $ps->setName('NightlyCache');
     $ps->setModule('hms');
     $ps->setClassName('NightlyCache');
     $ps->setClassMethod('execute');
     $ps->setExecuteAfter(mktime(24, 0, 0));
     $ps->setInterim('1440');
     $ps->setRequiredFile('mod/hms/class/NightlyCache.php');
     pulse\PulseFactory::save($ps);
 }