Exemple #1
0
 /**
  * Synchronizes the packages with the file system.
  */
 public static function synchronizeWithFileSystem()
 {
     $config = rex::getConfig('package-config');
     $addons = self::readPackageFolder(rex_path::src('addons'));
     $registeredAddons = array_keys(rex_addon::getRegisteredAddons());
     foreach (array_diff($registeredAddons, $addons) as $addonName) {
         $manager = rex_addon_manager::factory(rex_addon::get($addonName));
         $manager->_delete(true);
         unset($config[$addonName]);
     }
     foreach ($addons as $addonName) {
         if (!rex_addon::exists($addonName)) {
             $config[$addonName]['install'] = false;
             $config[$addonName]['status'] = false;
             $registeredPlugins = [];
         } else {
             $addon = rex_addon::get($addonName);
             $config[$addonName]['install'] = $addon->isInstalled();
             $config[$addonName]['status'] = $addon->isAvailable();
             $registeredPlugins = array_keys($addon->getRegisteredPlugins());
         }
         $plugins = self::readPackageFolder(rex_path::addon($addonName, 'plugins'));
         foreach (array_diff($registeredPlugins, $plugins) as $pluginName) {
             $manager = rex_plugin_manager::factory(rex_plugin::get($addonName, $pluginName));
             $manager->_delete(true);
             unset($config[$addonName]['plugins'][$pluginName]);
         }
         foreach ($plugins as $pluginName) {
             $plugin = rex_plugin::get($addonName, $pluginName);
             $config[$addonName]['plugins'][$pluginName]['install'] = $plugin->isInstalled();
             $config[$addonName]['plugins'][$pluginName]['status'] = $plugin->getProperty('status');
         }
         if (isset($config[$addonName]['plugins']) && is_array($config[$addonName]['plugins'])) {
             ksort($config[$addonName]['plugins']);
         }
     }
     ksort($config);
     rex::setConfig('package-config', $config);
     rex_addon::initialize();
 }
Exemple #2
0
<?php

/**
 * Packages loading.
 *
 * @package redaxo5
 */
rex_addon::initialize(!rex::isSetup());
if (rex::isSetup() || rex::isSafeMode()) {
    $packageOrder = array_keys(rex_package::getSetupPackages());
} else {
    $packageOrder = rex::getConfig('package-order', []);
}
// in the first run, we register all folders for class- and fragment-loading,
// so it is transparent in which order the addons are included afterwards.
foreach ($packageOrder as $packageId) {
    $package = rex_package::get($packageId);
    $folder = $package->getPath();
    // add addon path for i18n
    if (is_readable($folder . 'lang')) {
        rex_i18n::addDirectory($folder . 'lang');
    }
    // add package path for fragment loading
    if (is_readable($folder . 'fragments')) {
        rex_fragment::addDirectory($folder . 'fragments' . DIRECTORY_SEPARATOR);
    }
    // add addon path for class-loading
    if (is_readable($folder . 'lib')) {
        rex_autoload::addDirectory($folder . 'lib');
    }
    if (is_readable($folder . 'vendor')) {