Beispiel #1
0
 public static function getInstance($name, $reload = false)
 {
     $name = strtolower($name);
     LegacyLogger::log("DEBUG", "Registry", "Requesting instance for '{$name}'");
     $instance = Registry::$repo[$name];
     if ($instance == null) {
         LegacyLogger::log("WARN", "Registry", "Could not find instance for '{$name}'");
     }
     if ($instance !== null && (USE_RUNKIT_CLASS_LOADING === true || $reload === true)) {
         Registry::importChanges($instance);
         Registry::injectDependencies($instance);
     }
     return $instance;
 }
 /**
  * @HandlesCommand("reloadinstance")
  * @Matches("/^reloadinstance all$/i")
  */
 public function reloadinstanceCommand($message, $channel, $sender, $sendto, $args)
 {
     $instances = Registry::getAllInstances();
     $count = count($instances);
     $blob = '';
     foreach ($instances as $name => $instance) {
         $blob .= $name . ' (' . get_class($instance) . ")\n";
         Registry::importChanges($instance);
         Registry::injectDependencies($instance);
     }
     $msg = $this->text->make_blob("All instances have been reloaded ({$count})", $blob);
     $sendto->reply($msg);
 }