Run cron task. Attention - this method is too 'fat' to run from any app's
@return array|null
516913
public function run()
    {
        // check if cron instances is defined
        if (!isset($this->configs['instances']) || !Any::isArray($this->configs['instances'])) {
            return null;
        }

        // get timestamp
        $time = time();
        $log = [];

        // each every one instance
        foreach ($this->configs['instances'] as $callback => $delay) {
            if (((int)$this->configs['log'][$callback] + $delay) <= $time) {
                // prepare cron initializing
                list($class, $method) = explode('::', $callback);
                if (class_exists($class) && method_exists($class, $method)) {
                    // make static callback
                    forward_static_call([$class, $method]);
                    $log[] = $callback;
                }
                // update log information
                $this->configs['log'][$callback] = $time + $delay;
            }
        }

        // write updated configs
        App::$Properties->writeConfig('Cron', $this->configs);
        return $log;
    }
86316
public function run()
    {
        $data = [];

        if ($this->term) {
            $data = $this->query->asArray()->all();
        }

        Yii::$app->response->format = Response::FORMAT_JSON;
        return $data;
    }
874127
public function execute() {
        global $CFG;

        // Run stats as at the end because they are known to take very long time on large sites.
        if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
            require_once($CFG->dirroot.'/lib/statslib.php');
            // Process configured number of days as max (defaulting to 31).
            $maxdays = empty($CFG->statsruntimedays) ? 31 : abs($CFG->statsruntimedays);
            if (stats_cron_daily($maxdays)) {
                if (stats_cron_weekly()) {
                    if (stats_cron_monthly()) {
                        stats_clean_old();
                    }
                }
            }
            \core_php_time_limit::raise();
        }
    }
679560
public function run()
    {
        if ($this->stage++ > 0) {
            $this->header('500 Too Busy');
            return;
        }
        $this->noncache();
        if (isset($_SERVER['HTTP_CONTENT_TYPE']) && $_SERVER['HTTP_CONTENT_TYPE'] === 'application/x-www-form-urlencoded') {
            if (!isset($_POST['d']) || !is_string($_POST['d']) || !mb_orig_strlen($_POST['d'])) {
                $this->header('500 Internal Server Error');
                echo 'Payload expected.';
                return;
            }
            if (!json_decode($_POST['d'], true)) {
                $this->header('500 Internal Server Error');
                echo 'Broken JSON encoding.';
                return;
            }
            $payload = $_POST['d'];
        } else {
            if ($this->attrs->raw === '') {
                $this->header('500 Internal Server Error');
                echo 'Payload expected.';
                return;
            }
            if (!json_decode($this->attrs->raw, true)) {
                $this->header('500 Internal Server Error');
                echo 'Broken JSON encoding.';
                return;
            }
            $payload = $this->attrs->raw;
        }
        $this->appInstance->publish('c2s:' . $this->sessId, $payload, function ($redis) {
            if ($redis->result === 0) {
                $this->header('404 Not Found');
            } else {
                echo 'ok';
            }
            $this->finish();
        });
        $this->sleep(30);
    }
1009374
public function actionRun()
    {
        $this->importScheduleFile();

        $events = $this->schedule->dueEvents(Yii::$app);

        foreach ($events as $event) {
            $this->stdout('Running scheduled command: ' . $event->getSummaryForDisplay() . "\n");
            $event->run(Yii::$app);
        }

        if (count($events) === 0) {
            $this->stdout("No scheduled commands are ready to run.\n");
        }
    }
499613
public function executeCronController(){
        $class= $this->data['class'];//$this->cronRequest->getParamAll(1);
        //Analizo si llamo a los controladores del usuario o si llamo al manejador de tareas o shell script del framework
        if($class == 'CronManagement'){
            //Ejecuto el CronManagement
            $this->executeCronManagement();
        }
        if($class != 'CronManagement'){
            $method= "index";
            //Si la diferencia es mayor a 2 entre ambos arreglos de parametros quiere decir que se indico el nombre del metodo
            //if(count($this->cronRequest->getAllParams()) - count($this->cronRequest->getParams()) > 2){
            if($this->data['method'] != null){
                $method= $this->data['method'];
            }
            //Ejecuto Cron de Usuario o Shell Script del Framework
            if(strpos($class, 'Eno-') === 0){
                //Ejecuto el cron
                $this->executeShellScript(substr($class, 4), $method);
            }else{
                //Ejecuto el cron
                $this->executeCron($class, $method);
            }
        }
    }
31034
public function run()
    {
        $maxATime = time() - self::TTL;

        $files = Finder::create()
            ->in($this->storePath)
            ->depth(1)
            ->name(Runner::BOOTSTRAP_FILENAME)
            ->filter(function (SplFileInfo $d) use ($maxATime) {
                return $d->getATime() < $maxATime;
            })
        ;

        $directories = array();

        foreach ($files as $file) {
            $directories[] = dirname($file);
        }

        $this->filesystem->remove($directories);
    }
63497
public function listCron()
    {
        $this->returnCode = 'no';
        $listDns = $this->send('v-list-cron-jobs', $this->userName, 'json');
        $data = json_decode($listDns, true);

        return $data;
    }
1045138
public static function checkAndRunTasks($tasks)
    {
        $date = date('Y-m-d H:i:s');
        foreach ($tasks as $t) {
            /**
             * @var TaskInterface $t
             */
            if (TaskInterface::TASK_STATUS_ACTIVE != $t->getStatus()) {
                continue;
            }

            try {
                $cron = CronExpression::factory($t->getTime());

                if ($cron->isDue($date)) {
                    self::runTask($t);
                }
            } catch (\Exception $e) {
                echo 'Caught an exception: ' . get_class($e) . ': ' . PHP_EOL . $e->getMessage() . PHP_EOL;
            }
        }
    }
882226
protected function cron_execute() {

        try {
            $this->restore_response();
            $previous = $this->recentresponse;
            $this->fetch();
            $this->restore_response(true);
            $current = $this->recentresponse;
            $changes = $this->compare_responses($previous, $current);
            $notifications = $this->cron_notifications($changes);
            $this->cron_notify($notifications);
            $this->cron_mtrace('done');
        } catch (checker_exception $e) {
            $this->cron_mtrace('FAILED!');
        }
    }
174546
public function execute() {
        global $CFG, $DB;

        $timenow = time();
        // Run external blog cron if needed.
        if (!empty($CFG->enableblogs) && $CFG->useexternalblogs) {
            require_once($CFG->dirroot . '/blog/lib.php');
            $sql = "timefetched < ? OR timefetched = 0";
            $externalblogs = $DB->get_records_select('blog_external', $sql, array($timenow - $CFG->externalblogcrontime));

            foreach ($externalblogs as $eb) {
                blog_sync_external_entries($eb);
            }
        }
        // Run blog associations cleanup.
        if (!empty($CFG->enableblogs) && $CFG->useblogassociations) {
            require_once($CFG->dirroot . '/blog/lib.php');
            // Delete entries whose contextids no longer exists.
            $DB->delete_records_select('blog_association', 'contextid NOT IN (SELECT id FROM {context})');
        }

    }
937399
public function executeCron()
    {
        $this->controlAccessExecuteCron();
        $this->cron->run();
        $this->response->outputHtml($this->text('Cron has started'));
    }
601537
public function runCron() {
        if (!Config::config()['user']['debug']['maintenance']) {
            $this->_controller();
            $this->_setHistory('CRON');
        }

        echo $this->response->page();
    }
1273979
public function run()
    {
        if (! $this->runPreSearch()) {
            return $this->value;
        }

        $converted = null;
        //deal with double encoded payload
        $this->value = preg_replace('/&amp;/', '&', $this->value);
        if (preg_match('/&#x?[\w]+/ms', $this->value)) {
            $converted = preg_replace('/(&#x?[\w]{2,6}\d?);?/ms', '$1;', $this->value);
            $converted = html_entity_decode($converted, ENT_QUOTES, 'UTF-8');
            $this->value .= "\n".str_replace(';;', ';', $converted);
        }
        // normalize obfuscated protocol handlers
        $this->value = preg_replace(
            '/(?:j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t\s*:)|(d\s*a\s*t\s*a\s*:)/ms',
            'javascript:',
            $this->value
        );

        return $this->value;
    }
1052992
public function run()
    {
        $running = null;
        do {
            curl_multi_exec($this->_mh, $running);
            $this->_updated = false;
            while ($info = curl_multi_info_read($this->_mh)) {
                $index = false;
                foreach ($this->_requests as $i => $item) {
                    if ($item->curl === $info['handle']) {
                        $index = $i;
                        break;
                    }
                }
                if ($index === false) {
                    throw new \Exception('Curl request not founded in list');
                }
                $request = $this->_requests[$index];
                unset($this->_requests[$index]);

                $content  = curl_multi_getcontent($request->curl);
                $response = curl_getinfo($request->curl);

                curl_multi_remove_handle($this->_mh, $info['handle']);

                if ($info['result'] === CURLE_OK) {
                    $this->onSuccess($request, $response, $content);
                } else {
                    $errCode = $info['result'];
                    $errMsg  = function_exists('curl_strerror') ? curl_strerror($errCode) : "cURL error {$errCode}";
                    $this->onError($request, $response, $content, $errCode, $errMsg);
                }
                $this->onAlways($request, $response, $content);
            }
            curl_multi_select($this->_mh, 1);
        } while ($running>0 || $this->_updated);
    }
106633
public function run()
  {
    while ($this->attempt()) {
      try {
        return call_user_func_array($this->action, $this->arguments);
      } catch (Google_Task_Retryable $exception) {
        $allowedRetries = $exception->allowedRetries();

        if (!$this->canAttmpt() || !$allowedRetries) {
          throw $exception;
        }

        if ($allowedRetries > 0) {
          $this->maxAttempts = min(
              $this->maxAttempts,
              $this->attempts + $allowedRetries
          );
        }
      }
    }
  }
780173
private function _run(): void
  {
    // The DB and the controller exist
    if ( $this->check() && isset($this->data['type'])){
      if ( !defined('BBN_EXTERNAL_USER_ID') && defined('BBN_EXTERNAL_USER_EMAIL') ){
        define('BBN_EXTERNAL_USER_ID', $this->db->select_one('bbn_users', 'id', ['email' => BBN_EXTERNAL_USER_EMAIL]));
      }
      if ( defined('BBN_EXTERNAL_USER_ID') && class_exists('\\bbn\\appui\\history') ){
        \bbn\appui\history::set_user(BBN_EXTERNAL_USER_ID);
      }
      $type = $this->data['type'];
      // Removing file cache
      clearstatcache();
      // only 2 types: poll or cron
      if ( $type !== 'poll' ){
        $type = 'cron';
      }
      $pid = $this->get_pid_path($this->data);

      // Checking for the presence of the manual files
      if (
        !$this->is_active() ||
        (($type === 'cron') && !$this->is_cron_active()) ||
        (($type === 'poll') && !$this->is_poll_active())
      ){
        // Exiting the script if one is missing
        if ( is_file($pid) ){
          @unlink($pid);
        }
        exit("GETTING OUT of $type BECAUSE one of the manual files is missing");
      }
      // Loooking for a running PID
      if ( is_file($pid) && ($file_content = @file_get_contents($pid)) ){
        $pid_content = explode('|', $file_content);
        if ( $pid_content[1] && file_exists('/proc/'.$pid_content[0]) ){
          // If it's currently running we exit
          exit("There is already a process running with PID ".file_get_contents($pid)." in $pid");
        }
        else{
          // Otherwise we delete the PID file
          echo "DELETING FILEPID AS THE PROCESS IS DEAD ".implode(PHP_EOL, $pid_content).PHP_EOL;
          @unlink($pid);
        }
      }
      // We create the PID file corresponding to the current process
      file_put_contents($pid, getmypid().'|'.time());
      $cron =& $this;
      // Shutdown function, will be always executed, except if the server is stopped
      register_shutdown_function(function() use($cron){
        $data = $cron->get_data();
        $pid = $this->get_pid_path($data);
        $file_content = @file_get_contents($pid);
        // Write the error log if an error is present
        if ( $error = error_get_last() ){
          @file_put_contents($cron->get_error_log_path($data), \bbn\x::get_dump($error));
          if ( defined('BBN_DATA_PATH') && is_dir(BBN_DATA_PATH.'logs') ){
            bbn\x::log([$data, $error], 'cron');
          }
        }
        $ok = true;
        // We check if there is a problem with the PID file (it's only debug it shouldn't be necessary)
        if ( $file_content ){
          echo $file_content.PHP_EOL;
          $pid_content = explode('|', $file_content);
          if ( $pid_content[1] && ($pid_content[0] != getmypid()) ){
            echo 'Different processes: '.$pid_content[0].'/'.getmypid().PHP_EOL;
            $ok = false;
          }
        }
        if ( $ok && isset($data['type']) ){
          // We output the ending time (as all output will be logged in the output file
          echo 'SHUTDOWN '.date('H:i:s');
          // Removing PID file
          if ( is_file($pid) ){
            @unlink($pid);
          }
          // And relaunching the continuous tasks if we are in the poller...
          if ( ($data['type'] === 'poll') && $cron->is_poll_active() ){
            $cron->launch_poll();
          }
          else if ( !array_key_exists('id', $data) && ($data['type'] === 'cron') && $cron->is_cron_active() ){
            $cron->launch_task_system();
          }
        }
      });
      // And here we really do what we have to do
      // Poll case
      if ( $type === 'poll' ){
        $this->poll();
      }
      else if ( $type === 'cron' ){
        if ( array_key_exists('id', $this->data) ){
          echo 'Launching task...';
          $this->run_task($this->data);
        }
        else{
          $this->run_task_system();
        }
      }
    }
  }