예제 #1
0
파일: rex_test.php 프로젝트: staabm/redaxo
 public function testRexConfig()
 {
     $key = 'aTestKey';
     // initial test on empty config
     $this->assertFalse(rex::hasConfig($key), 'the key does not exists at first');
     $this->assertNull(rex::getConfig($key), 'getting non existing key returns null');
     $this->assertEquals(rex::getConfig($key, 'defVal'), 'defVal', 'getting non existing key returns a given default');
     $this->assertFalse(rex::removeConfig($key), 'remove non existing key returns false');
     // test after setting a value
     $this->assertFalse(rex::setConfig($key, 'aVal'), 'setting non-existant value returns false');
     $this->assertEquals(rex::getConfig($key, 'defVal'), 'aVal', 'getting existing key returns its value');
     $this->assertTrue(rex::hasConfig($key), 'setted value exists');
     // test after re-setting a value
     $this->assertTrue(rex::setConfig($key, 'aOtherVal'), 're-setting a value returns true');
     $this->assertEquals(rex::getConfig($key, 'defaOtherVal'), 'aOtherVal', 'getting existing key returns its value');
     // test after cleanup
     $this->assertTrue(rex::removeConfig($key), 'remove a existing key returns true');
     $this->assertFalse(rex::hasConfig($key), 'the key does not exists after removal');
     $this->assertNull(rex::getConfig($key), 'getting non existing key returns null');
     $this->assertEquals(rex::getConfig($key, 'defVal'), 'defVal', 'getting non existing key returns a given default');
 }
예제 #2
0
파일: import.php 프로젝트: DECAF/redaxo
 public static function updateFromPrevious()
 {
     // ----- vorhandenen seite updaten
     $err_msg = '';
     if ($err_msg == '') {
         $version = rex::getVersion();
         rex::setProperty('version', rex::getConfig('version'));
         try {
             include rex_path::core('update.php');
         } catch (rex_functional_exception $e) {
             $err_msg .= $e->getMessage();
         } catch (rex_sql_exception $e) {
             $err_msg .= 'SQL error: ' . $e->getMessage();
         }
         rex::setProperty('version', $version);
     }
     if ($err_msg == '') {
         $err_msg .= self::installAddons();
     }
     return $err_msg;
 }
예제 #3
0
파일: addon.php 프로젝트: staabm/redaxo
 /**
  * Initializes all packages.
  */
 public static function initialize($dbExists = true)
 {
     if ($dbExists) {
         $config = rex::getConfig('package-config', []);
     } else {
         $config = [];
         foreach (rex::getProperty('setup_addons') as $addon) {
             $config[$addon]['install'] = false;
         }
     }
     $addons = self::$addons;
     self::$addons = [];
     foreach ($config as $addonName => $addonConfig) {
         $addon = isset($addons[$addonName]) ? $addons[$addonName] : new self($addonName);
         $addon->setProperty('install', isset($addonConfig['install']) ? $addonConfig['install'] : false);
         $addon->setProperty('status', isset($addonConfig['status']) ? $addonConfig['status'] : false);
         self::$addons[$addonName] = $addon;
         if (!$dbExists && is_array($plugins = $addon->getProperty('system_plugins'))) {
             foreach ($plugins as $plugin) {
                 $config[$addonName]['plugins'][$plugin]['install'] = false;
             }
         }
         if (isset($config[$addonName]['plugins']) && is_array($config[$addonName]['plugins'])) {
             $plugins = $addon->plugins;
             $addon->plugins = [];
             foreach ($config[$addonName]['plugins'] as $pluginName => $pluginConfig) {
                 $plugin = isset($plugins[$pluginName]) ? $plugins[$pluginName] : new rex_plugin($pluginName, $addon);
                 $plugin->setProperty('install', isset($pluginConfig['install']) ? $pluginConfig['install'] : false);
                 $plugin->setProperty('status', isset($pluginConfig['status']) ? $pluginConfig['status'] : false);
                 $addon->plugins[$pluginName] = $plugin;
             }
         }
     }
 }
예제 #4
0
파일: manager.php 프로젝트: DECAF/redaxo
 /**
  * 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();
 }
예제 #5
0
파일: packages.php 프로젝트: staabm/redaxo
<?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')) {