Example #1
0
 public static function QueryState(TaskEnvironment $env)
 {
     $result = $env->database()->query('
         SELECT
             switch_sourcepath AS filename,
             COUNT(switch_id) AS switch_count
         FROM
             chromium_switches
         WHERE
             removed = "0000-00-00 00:00:00"
         GROUP BY
             switch_sourcepath');
     $switches = 0;
     $files = 0;
     while ($result !== false && ($row = $result->fetch_assoc())) {
         $switches += $row['switch_count'];
         $files++;
     }
     $last_update = 0;
     $result = $env->database()->query('
         SELECT
             UNIX_TIMESTAMP(GREATEST(added, updated, removed)) AS last_update
         FROM
             chromium_switches
         ORDER BY
             GREATEST(added, updated, removed) DESC
         LIMIT
             1');
     if ($result !== false) {
         $last_update = $result->fetch_object()->last_update;
     }
     return array('name' => 'Chromium command-line flag tracker', 'description' => 'Tracks and indexes the command line flags available to Chromium and Google Chrome.', 'state' => ServiceState::Good, 'subtasks' => array(array('name' => 'Indexed command-line switches', 'date' => $last_update, 'value' => '<a href="http://peter.sh/experiments/chromium-command-line-switches/">' . $switches . ' switches, ' . $files . ' files</a>')));
 }
Example #2
0
 public static function QueryState(TaskEnvironment $env)
 {
     $result = $env->database()->query('
         SELECT
             tracking_projects.project_name,
             tracking_projects.repository_view,
             tracking_projects.repository_max_silence,
             tracking_revisions.revision_sha,
             UNIX_TIMESTAMP(tracking_revisions.revision_date) AS revision_date,
             tracking_revisions.message
         FROM
             tracking_projects
         LEFT JOIN
             tracking_revisions ON tracking_revisions.project_id = tracking_projects.project_id AND
                                   tracking_revisions.revision_sha = 
                                   (
                                       SELECT
                                           revision_sha
                                       FROM
                                           tracking_revisions
                                       WHERE
                                           project_id = tracking_projects.project_id
                                       ORDER BY
                                           revision_date DESC
                                       LIMIT
                                           1
                                   )
         WHERE
             tracking_projects.repository_ignore = 0
         ORDER BY
             tracking_projects.project_name ASC');
     $subtasks = array();
     $state = ServiceState::Good;
     $warnings = 0;
     while ($result !== false && ($row = $result->fetch_assoc())) {
         $url = $row['repository_view'] . $row['revision_sha'];
         $title = htmlspecialchars(trim(strstr($row['message'], PHP_EOL, true)));
         $text = substr($row['revision_sha'], 0, 7);
         if ((time() - $row['revision_date']) / 3600 > $row['repository_max_silence']) {
             $state = ServiceState::Warning;
             $warnings++;
         }
         $subtasks[] = array('name' => $row['project_name'], 'date' => $row['revision_date'], 'value' => '<a href="' . $url . '" title="' . $title . '">' . $text . '</a>');
     }
     if (!count($subtasks) || $warnings >= 3) {
         $state = ServiceState::Error;
     }
     return array('name' => 'Repository tracker', 'description' => 'Tracks all commits to the Blink, Chromium, Skia and v8 repositories and stores them in a MySQL database.', 'state' => $state, 'subtasks' => $subtasks);
 }
Example #3
0
 public static function GetInstance()
 {
     if (self::$s_taskEnvironment === null) {
         self::$s_taskEnvironment = new TaskEnvironment();
     }
     return self::$s_taskEnvironment;
 }
Example #4
0
 public static function QueryState(TaskEnvironment $env)
 {
     $subtasks = array();
     $state = ServiceState::Warning;
     $result = $env->database()->query('
         SELECT
             css_properties.property_engine_name,
             GREATEST(MAX(css_properties.added), MAX(css_properties.removed)) AS last_updated,
             (
                 SELECT
                     COUNT(*)
                 FROM
                     css_properties inner_tbl
                 WHERE
                     inner_tbl.removed = "0000-00-00 00:00:00" AND
                     inner_tbl.property_engine_name = css_properties.property_engine_name
             ) AS property_count
         FROM
             css_properties
         GROUP BY
             css_properties.property_engine_name
         ORDER BY
             css_properties.property_engine_name ASC');
     $last_updated = 0;
     while ($result !== false && ($row = $result->fetch_assoc())) {
         $link = 'http://peter.sh/experiments/vendor-prefixed-css-properties-' . strtolower($row['property_engine_name']) . '/';
         $date = strtotime($row['last_updated']);
         if ($last_updated < $date) {
             $last_updated = $date;
         }
         $subtasks[] = array('name' => $row['property_engine_name'], 'date' => $date, 'value' => '<a href="' . $link . '">' . $row['property_count'] . ' properties</a>');
     }
     if ($last_updated > time() - 3 * 30.25 * 24 * 60 * 60) {
         $state = ServiceState::Good;
     }
     return array('name' => 'CSS Property Tracker', 'description' => 'Tracks the list of CSS properties supported by Blink, Gecko and WebKit. Trident has to be updated manually.', 'state' => $state, 'subtasks' => $subtasks);
 }
Example #5
0
 private function runTask($task)
 {
     Info('Running task "' . implode('::', $task['callback']) . '" (id: ' . $task['unique_id'] . ').');
     $taskStart = microtime(true);
     $instance = new $task['callback'][0](TaskEnvironment::GetInstance(), $task);
     call_user_func(array($instance, $task['callback'][1]));
     Info('Ran task "' . implode('::', $task['callback']) . ' in ' . sprintf('%.2f', (microtime(true) - $taskStart) * 1000) . 'ms.');
     ServiceState::UpdateTaskLastExecutionTime($task);
 }