Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
FreePBX::Job()->getAll();

If you use this to add Jobs with the correct module rawname as the first parameter during uninstallation of the module the jobs will be uninstalled, additionally enabling and/or disabling a module will enable or disable it's associated jobs

Table of Contents

Console Commands

...

Code Block
[root@Andrew14 pagingpro]# fwconsole job --run 19
Skipping userman::syncall because schedule does not match
[root@Andrew14 pagingpro]# fwconsole job --run 19 --force
Running userman::syncall...Directory 'Imported freepbx directory' does not support syncing
Directory 'sdfdsf' does not support syncing
Done

Function Calls

getAll()

Get All Jobs

Code Block
public function getAll() {}

getAllEnabled()

Get all enabled jobs

Code Block
/**
 * Get all enabled jobs
 *
 * @return array
 */
public function getAllEnabled() {}

addCommand()

Add/Update Job CLI Command

Code Block
/**
 * Add Job Command
 *
 * Add a job that will launch a command
 *
 * @param string $modulename The module rawname (used for uninstalling)
 * @param string $jobname The job name
 * @param string $command The CLI command to run
 * @param string $schedule The Cron Expression when to run
 * @param integer $max_runtime The max run time in seconds
 * @param boolean $enabled Whether this job is enabled or not
 * @return void
 */
public function addCommand($modulename, $jobname, $command, $schedule, $max_runtime = 30, $enabled = true) {}

addClass()

Add/Update a Job Class

Code Block
/**
 * Add Job Class
 *
 * @param string $modulename The module rawname (used for uninstalling)
 * @param string $jobname The job name
 * @param string $class The class to run. Must implement https://github.com/FreePBX/framework/blob/feature/newcrons/amp_conf/htdocs/admin/libraries/BMO/Job/Job.php
 * @param string $schedule The Cron Expression when to run
 * @param integer $max_runtime The max run time in seconds
 * @param boolean $enabled Whether this job is enabled or not
 * @return void
 */
public function addClass($modulename, $jobname, $class, $schedule, $max_runtime = 30, $enabled = true) {}

remove()

Remove a job by modulename and jobname

Code Block
/**
 * Remove a job by modulename and jobname
 *
 * @param string $modulename The module rawname (used for uninstalling)
 * @param string $jobname The job name
 * @return void
 */
public function remove($modulename, $jobname) {}

removeAllByModule()

Remove all jobs by module rawname

Code Block
/**
 * Remove all jobs by module name
 *
 * @param string $modulename The module rawname (used for uninstalling)
 * @return void
 */
public function removeAllByModule($modulename) {}

setEnabled()

Toggle Enabled on a job

Code Block
/**
 * Toggle Enabled on a job
 *
 * @param string $modulename The module rawname (used for uninstalling)
 * @param string $jobname The job name
 * @param boolean $enabled Whether this job is enabled or not
 * @return void
 */
public function setEnabled($modulename, $jobname, $enabled = true) {}

setEnabledByModule()

Set Enabled by Module Rawname

Code Block
/**
 * Set Enabled by Module Rawname
 *
 * @param string $modulename
 * @param boolean $enabled
 * @return void
 */
public function setEnabledByModule($modulename, $enabled = true) {}

updateSchedule()

Update the schedule of a job that already exists

Code Block
/**
 * Update schedule of a job
 *
 * @param string $modulename The module rawname (used for uninstalling)
 * @param string $jobname The job name
 * @param string $schedule The Cron Expression when to run
 * @return void
 */
public function updateSchedule($modulename, $jobname, $schedule) {}