private function loadCommands() { $commands = KScheduleHelperManager::loadCommands(); if (!$commands || !is_array($commands) || !count($commands)) { return; } // KalturaLog::info(count($commands) . " commands found"); $command_results = array(); foreach ($commands as $command) { if ($command instanceof KalturaBatchQueuesStatus) { $this->handleQueueStatus($command->workerId, $command->size); } elseif ($command instanceof KalturaControlPanelCommand) { $command_results[] = $this->handleCommand($command); } else { KalturaLog::err("command of type " . get_class($command) . " could not be handled"); $command_results[] = KalturaControlPanelCommandStatus::FAILED; } } $cnt = count($command_results); if ($cnt) { KalturaLog::info("Sending {$cnt} command results to the server"); KScheduleHelperManager::saveCommandsResults($command_results); } }