public function loadPluginsRegistry($pluginFolder, $confFolder)
 {
     $this->pluginFolder = $pluginFolder;
     $this->confFolder = $confFolder;
     $handler = opendir($pluginFolder);
     $pluginsPool = array();
     if ($handler) {
         while (($item = readdir($handler)) !== false) {
             if ($item == "." || $item == ".." || !is_dir($pluginFolder . "/" . $item) || strstr($item, ".") === false) {
                 continue;
             }
             $plugin = new AJXP_Plugin($item, $pluginFolder . "/" . $item);
             $plugin->loadManifest();
             if ($plugin->manifestLoaded()) {
                 $pluginsPool[$plugin->getId()] = $plugin;
                 if (method_exists($plugin, "detectStreamWrapper")) {
                     if ($plugin->detectStreamWrapper(false) !== false) {
                         $this->streamWrapperPlugins[] = $plugin->getId();
                     }
                 }
             }
         }
         closedir($handler);
     }
     if (count($pluginsPool)) {
         $this->checkDependencies($pluginsPool);
         foreach ($pluginsPool as $plugin) {
             $this->recursiveLoadPlugin($plugin, $pluginsPool);
         }
     }
 }
 public function loadPluginsRegistry($pluginFolder, $confFolder)
 {
     $this->pluginFolder = $pluginFolder;
     $this->confFolder = $confFolder;
     $handler = opendir($pluginFolder);
     $beforeSort = array();
     if ($handler) {
         while (($item = readdir($handler)) !== false) {
             if ($item == "." || $item == ".." || !is_dir($pluginFolder . "/" . $item) || strstr($item, ".") === false) {
                 continue;
             }
             $plugin = new AJXP_Plugin($item, $pluginFolder . "/" . $item);
             $plugin->loadManifest();
             if ($plugin->manifestLoaded()) {
                 $beforeSort[$plugin->getId()] = $plugin;
             }
         }
         closedir($handler);
     }
     if (count($beforeSort)) {
         $this->checkDependencies($beforeSort);
         $this->usort($beforeSort);
         foreach ($beforeSort as $plugin) {
             $plugType = $plugin->getType();
             if (!isset($this->registry[$plugType])) {
                 $this->registry[$plugType] = array();
             }
             $plugin = $this->instanciatePluginClass($plugin);
             if (is_file($this->confFolder . "/conf." . $plugin->getId() . ".inc")) {
                 $plugin->loadConfig($this->confFolder . "/conf." . $plugin->getId() . ".inc", "inc");
             }
             $this->registry[$plugType][$plugin->getName()] = $plugin;
         }
     }
 }
 /**
  * Loads the full registry, from the cache or not
  * @param String $pluginFolder
  * @param AbstractConfDriver $confStorage
  * @param bool $rewriteCache Force a cache rewriting
  */
 public function loadPluginsRegistry($pluginFolder, $confStorage, $rewriteCache = false)
 {
     if (!$rewriteCache) {
         if ($this->loadPluginsRegistryFromCache()) {
             return;
         }
     }
     if (is_string($pluginFolder)) {
         $pluginFolder = array($pluginFolder);
     }
     $this->confStorage = $confStorage;
     $pluginsPool = array();
     foreach ($pluginFolder as $sourceFolder) {
         $handler = @opendir($sourceFolder);
         if ($handler) {
             while (($item = readdir($handler)) !== false) {
                 if ($item == "." || $item == ".." || !@is_dir($sourceFolder . "/" . $item) || strstr($item, ".") === false) {
                     continue;
                 }
                 $plugin = new AJXP_Plugin($item, $sourceFolder . "/" . $item);
                 $plugin->loadManifest();
                 if ($plugin->manifestLoaded()) {
                     $pluginsPool[$plugin->getId()] = $plugin;
                     if (method_exists($plugin, "detectStreamWrapper") && $plugin->detectStreamWrapper(false) !== false) {
                         $this->streamWrapperPlugins[] = $plugin->getId();
                     }
                 }
             }
             closedir($handler);
         }
     }
     if (count($pluginsPool)) {
         $this->checkDependencies($pluginsPool);
         foreach ($pluginsPool as $plugin) {
             $this->recursiveLoadPlugin($plugin, $pluginsPool);
         }
     }
     if (!defined("AJXP_SKIP_CACHE") || AJXP_SKIP_CACHE === false) {
         AJXP_Utils::saveSerialFile(AJXP_PLUGINS_REQUIRES_FILE, $this->required_files, false, false);
         AJXP_Utils::saveSerialFile(AJXP_PLUGINS_CACHE_FILE, $this->registry, false, false);
         if (is_file(AJXP_PLUGINS_QUERIES_CACHE)) {
             @unlink(AJXP_PLUGINS_QUERIES_CACHE);
         }
         $this->savePluginsRegistryToCache();
     }
 }
 /**
  * Loads the full registry, from the cache or not
  * @param String $pluginFolder
  * @param AbstractConfDriver $confStorage
  * @param bool $rewriteCache Force a cache rewriting
  */
 public function loadPluginsRegistry($pluginFolder, $confStorage, $rewriteCache = false)
 {
     if (!$rewriteCache && (!defined("AJXP_SKIP_CACHE") || AJXP_SKIP_CACHE === false)) {
         $reqs = AJXP_Utils::loadSerialFile(AJXP_PLUGINS_REQUIRES_FILE);
         if (count($reqs)) {
             foreach ($reqs as $filename) {
                 if (!is_file($filename)) {
                     // CACHE IS OUT OF SYNC WITH REQUIRES
                     $this->loadPluginsRegistry($pluginFolder, $confStorage, true);
                     return;
                 }
                 require_once $filename;
             }
             $res = AJXP_Utils::loadSerialFile(AJXP_PLUGINS_CACHE_FILE);
             $this->registry = $res;
             // Refresh streamWrapperPlugins
             foreach ($this->registry as $pType => $plugs) {
                 foreach ($plugs as $plugin) {
                     if (method_exists($plugin, "detectStreamWrapper") && $plugin->detectStreamWrapper(false) !== false) {
                         $this->streamWrapperPlugins[] = $plugin->getId();
                     }
                 }
             }
             return;
         }
     }
     if (is_string($pluginFolder)) {
         $pluginFolder = array($pluginFolder);
     }
     $this->confStorage = $confStorage;
     $pluginsPool = array();
     foreach ($pluginFolder as $sourceFolder) {
         $handler = @opendir($sourceFolder);
         if ($handler) {
             while (($item = readdir($handler)) !== false) {
                 if ($item == "." || $item == ".." || !@is_dir($sourceFolder . "/" . $item) || strstr($item, ".") === false) {
                     continue;
                 }
                 $plugin = new AJXP_Plugin($item, $sourceFolder . "/" . $item);
                 $plugin->loadManifest();
                 if ($plugin->manifestLoaded()) {
                     $pluginsPool[$plugin->getId()] = $plugin;
                     if (method_exists($plugin, "detectStreamWrapper") && $plugin->detectStreamWrapper(false) !== false) {
                         $this->streamWrapperPlugins[] = $plugin->getId();
                     }
                 }
             }
             closedir($handler);
         }
     }
     if (count($pluginsPool)) {
         $this->checkDependencies($pluginsPool);
         foreach ($pluginsPool as $plugin) {
             $this->recursiveLoadPlugin($plugin, $pluginsPool);
         }
     }
     if (!defined("AJXP_SKIP_CACHE") || AJXP_SKIP_CACHE === false) {
         AJXP_Utils::saveSerialFile(AJXP_PLUGINS_REQUIRES_FILE, $this->required_files, false, false);
         AJXP_Utils::saveSerialFile(AJXP_PLUGINS_CACHE_FILE, $this->registry, false, false);
     }
 }