/** * See if the daemon's getting overloaded and pause if so */ function wait() { $cutoff = 500; $waittime = 10; while (true) { try { $status = MWSearchUpdater::getStatus(); } catch (MWException $e) { echo $e->getMessage() . "\n"; sleep($waittime); continue; } // Updater IS running; 90418 items queued. if (!preg_match('/([0-9]+) items queued/', $status, $matches)) { // ?! confused break; } $count = intval($matches[1]); if ($count < $cutoff) { break; } printf("%s: %s\n", wfTimestamp(TS_DB), $status); sleep($waittime); } }