Exemplo n.º 1
0
}
// disable gzip if not available
if ($conf['compression'] == 'bz2' && !function_exists('bzopen')) {
    $conf['compression'] = 'gz';
}
if ($conf['compression'] == 'gz' && !function_exists('gzopen')) {
    $conf['compression'] = 0;
}
// fix dateformat for upgraders
if (strpos($conf['dformat'], '%') === false) {
    $conf['dformat'] = '%Y/%m/%d %H:%M';
}
// precalculate file creation modes
init_creationmodes();
// make real paths and check them
init_paths();
init_files();
// setup plugin controller class (can be overwritten in preload.php)
$plugin_types = array('admin', 'syntax', 'action', 'renderer', 'helper');
global $plugin_controller_class, $plugin_controller;
if (empty($plugin_controller_class)) {
    $plugin_controller_class = 'Doku_Plugin_Controller';
}
// load libraries
require_once DOKU_INC . 'inc/load.php';
// initialize plugin controller
$plugin_controller = new $plugin_controller_class();
// initialize the event handler
global $EVENT_HANDLER;
$EVENT_HANDLER = new Doku_Event_Handler();
// setup authentication system
Exemplo n.º 2
0
 /**
  * Reset the DokuWiki environment before each test run. Makes sure loaded config,
  * language and plugins are correct.
  *
  * @throws Exception if plugin actions fail
  * @return void
  */
 public function setUp()
 {
     // reload config
     global $conf, $config_cascade;
     $conf = array();
     foreach (array('default', 'local', 'protected') as $config_group) {
         if (empty($config_cascade['main'][$config_group])) {
             continue;
         }
         foreach ($config_cascade['main'][$config_group] as $config_file) {
             if (@file_exists($config_file)) {
                 include $config_file;
             }
         }
     }
     // reload license config
     global $license;
     $license = array();
     // load the license file(s)
     foreach (array('default', 'local') as $config_group) {
         if (empty($config_cascade['license'][$config_group])) {
             continue;
         }
         foreach ($config_cascade['license'][$config_group] as $config_file) {
             if (@file_exists($config_file)) {
                 include $config_file;
             }
         }
     }
     // make real paths and check them
     init_paths();
     init_files();
     // reset loaded plugins
     global $plugin_controller_class, $plugin_controller;
     /** @var Doku_Plugin_Controller $plugin_controller */
     $plugin_controller = new $plugin_controller_class();
     // disable all non-default plugins
     global $default_plugins;
     foreach ($plugin_controller->getList() as $plugin) {
         if (!in_array($plugin, $default_plugins)) {
             if (!$plugin_controller->disable($plugin)) {
                 throw new Exception('Could not disable plugin "' . $plugin . '"!');
             }
         }
     }
     // disable and enable configured plugins
     foreach ($this->pluginsDisabled as $plugin) {
         if (!$plugin_controller->disable($plugin)) {
             throw new Exception('Could not disable plugin "' . $plugin . '"!');
         }
     }
     foreach ($this->pluginsEnabled as $plugin) {
         /*  enable() returns false but works...
             if (!$plugin_controller->enable($plugin)) {
                 throw new Exception('Could not enable plugin "'.$plugin.'"!');
             }
             */
         $plugin_controller->enable($plugin);
     }
     // reset event handler
     global $EVENT_HANDLER;
     $EVENT_HANDLER = new Doku_Event_Handler();
     // reload language
     $local = $conf['lang'];
     trigger_event('INIT_LANG_LOAD', $local, 'init_lang', true);
 }