public function doDialplanHook(&$ext, $engine, $priority) { // We're not actually doing any dialplan modifications. This // is just a handy place to discover modules that have requested hooks // into the status page. if (!class_exists('DashboardHooks')) { include 'classes/DashboardHooks.class.php'; } $allhooks = DashboardHooks::genHooks($this->getConfig('visualorder')); $this->setConfig('allhooks', $allhooks); // Also, while we're here, we should check that our cronjob is // still there. $file = \FreePBX::Config()->get('AMPWEBROOT') . "/admin/modules/dashboard/" . $this->sched; $cmd = "[ -x {$file} ] && {$file}"; // Ensure we instantiate cron with the correct user $c = \FreePBX::Cron(\FreePBX::Config()->get('AMPASTERISKWEBUSER')); $c->addLine("* * * * * {$cmd}"); }
public function doDialplanHook(&$ext, $engine, $priority) { // We're not actually doing any dialplan modifications. This // is just a handy place to discover modules that have requested hooks // into the status page. if (!class_exists('DashboardHooks')) { include 'classes/DashboardHooks.class.php'; } $allhooks = DashboardHooks::genHooks($this->getConfig('visualorder')); $this->setConfig('allhooks', $allhooks); // Also, while we're here, we should check that our cronjob is // still there. $file = \FreePBX::Config()->get('AMPWEBROOT') . "/admin/modules/dashboard/" . $this->sched; $cmd = "[ -x {$file} ] && {$file}"; // Some HA machines had TWO schedulers running. Whoops. Manually // remove ALL of them. (To be removed in 13) $all = \FreePBX::Cron()->getAll(); foreach ($all as $line) { if (strpos($line, "dashboard/scheduler.php") !== false) { \FreePBX::Cron()->remove($line); } } $this->Cron->addLine("* * * * * {$cmd}"); }
<?php // Remove our cronjob $file = \FreePBX::Config()->get('AMPWEBROOT') . "/admin/modules/dashboard/scheduler.php"; $c = \FreePBX::Cron(\FreePBX::Config()->get('AMPASTERISKWEBUSER')); $c->removeAll($file);