public function generateData()
 {
     $listeners = PhutilEventEngine::getInstance()->getAllListeners();
     foreach ($listeners as $key => $listener) {
         $listeners[$key] = array('id' => $listener->getListenerID(), 'class' => get_class($listener));
     }
     $events = DarkConsoleEventPluginAPI::getEvents();
     foreach ($events as $key => $event) {
         $events[$key] = array('type' => $event->getType(), 'stopped' => $event->isStopped());
     }
     return array('listeners' => $listeners, 'events' => $events);
 }
Example #2
0
 protected function willRun()
 {
     parent::willRun();
     // This stores unbounded amounts of log data; make it discard instead so
     // that daemons do not require unbounded amounts of memory.
     DarkConsoleErrorLogPluginAPI::enableDiscardMode();
     // Also accumulates potentially unlimited amounts of data.
     DarkConsoleEventPluginAPI::enableDiscardMode();
     $phabricator = phutil_get_library_root('phabricator');
     $root = dirname($phabricator);
     require_once $root . '/scripts/__init_script__.php';
 }
 public static function initializeScriptEnvironment()
 {
     self::initializeCommonEnvironment();
     // NOTE: This is dangerous in general, but we know we're in a script context
     // and are not vulnerable to CSRF.
     AphrontWriteGuard::allowDangerousUnguardedWrites(true);
     // There are several places where we log information (about errors, events,
     // service calls, etc.) for analysis via DarkConsole or similar. These are
     // useful for web requests, but grow unboundedly in long-running scripts and
     // daemons. Discard data as it arrives in these cases.
     PhutilServiceProfiler::getInstance()->enableDiscardMode();
     DarkConsoleErrorLogPluginAPI::enableDiscardMode();
     DarkConsoleEventPluginAPI::enableDiscardMode();
 }
 public static function enableDiscardMode()
 {
     self::$discardMode = true;
 }