/** * Kills all selected ScheduledTasks. * * @param array|null $not_killed * // a reference to an array that will be filled with any process_ids that * // could not be killed for any reason. * * @return void */ public function stop($not_killed = null) { if (!is_null($not_killed)) { \Altumo\Validation\Arrays::assertArray($not_killed, '$not_killed expects null or array'); } // get all frequent cron tasks running as this user and from the plugin's path $task_processes = $this->getSelectedProcesses(); foreach ($task_processes as $task_process) { // skip if process doesn't have a process_id if (!array_key_exists('process_id', $task_process) || !strlen($task_process['process_id'])) { continue; } $result = \Altumo\Utils\SystemProcess::killProcess($task_process['process_id']); if (!is_null($not_killed)) { $not_killed[] = $result; } } $this->clearSelectedProcesses(); }
/** * Sorts an array of rows by scalar row values, maintain indexes * * @param array $rows * * @throws \Exception if uasort fails * * @return array */ public static function sortArrayRowsAlphabetically($rows) { \Altumo\Validation\Arrays::assertArray($rows); $result_ok = uasort($rows, '\\Altumo\\Arrays\\Arrays::compareArrayRowsAlphabetically'); if (!$result_ok) { throw new \Exception('Error sorting rows alphabetically'); } return $rows; }