Пример #1
0
 /**
  * checks permissions of all required filesystem resources.
  *
  * @return array An array of error messages
  */
 public static function checkFilesystem()
 {
     // -------------------------- SCHREIBRECHTE
     $writables = [rex_path::media(), rex_path::assets(), rex_path::cache(), rex_path::data(), rex_path::src()];
     $func = function ($dir) use(&$func) {
         if (!rex_dir::isWritable($dir)) {
             return ['setup_304' => [$dir]];
         }
         $res = [];
         foreach (rex_finder::factory($dir) as $path => $file) {
             if ($file->isDir()) {
                 $res = array_merge_recursive($res, $func($path));
             } elseif (!$file->isWritable()) {
                 $res['setup_305'][] = $path;
             }
         }
         return $res;
     };
     $res = [];
     foreach ($writables as $dir) {
         if (@is_dir($dir)) {
             $res = array_merge_recursive($res, $func($dir));
         } else {
             $res['setup_306'][] = $dir;
         }
     }
     return $res;
 }
Пример #2
0
    // echo nl2br(htmlspecialchars($cont));
    if (rex_file::putConfig($configFile, $config) !== false) {
        $info = rex_i18n::msg('setup_error1', '<a href="' . rex_url::backendController() . '">', '</a>');
        header('Location:' . rex_url::backendController());
        exit;
    } else {
        $error[] = rex_i18n::msg('setup_error2');
    }
} elseif ($func == 'generate') {
    // generate all articles,cats,templates,caches
    $success = rex_delete_cache();
} elseif ($func == 'updateassets') {
    rex_dir::copy(rex_path::core('assets'), rex_path::assets());
    $success = 'Updated assets';
} elseif ($func == 'updateinfos') {
    $configFile = rex_path::data('config.yml');
    $config = array_merge(rex_file::getConfig(rex_path::core('default.config.yml')), rex_file::getConfig($configFile));
    $settings = rex_post('settings', 'array', []);
    foreach (['server', 'servername', 'error_email', 'lang'] as $key) {
        if (!isset($settings[$key]) || !$settings[$key]) {
            $error[] = rex_i18n::msg($key . '_required');
            continue;
        }
        $config[$key] = $settings[$key];
        try {
            rex::setProperty($key, $settings[$key]);
        } catch (InvalidArgumentException $e) {
            $error[] = rex_i18n::msg($key . '_invalid');
        }
    }
    $config['debug'] = isset($settings['debug']) && $settings['debug'];
Пример #3
0
<?php

if (rex_string::versionCompare(rex::getVersion(), '5.0.0-beta1', '<=')) {
    rex_extension::register('RESPONSE_SHUTDOWN', function () {
        rex_file::delete(rex_path::assets('jquery.min.js'));
        rex_file::delete(rex_path::assets('jquery.min.map'));
        rex_file::delete(rex_path::assets('jquery-pjax.min.js'));
        rex_file::delete(rex_path::assets('jquery-ui.custom.min.js'));
        rex_file::delete(rex_path::assets('jquery-ui.custom.txt'));
        rex_file::delete(rex_path::assets('redaxo-logo.svg'));
        rex_file::delete(rex_path::assets('sha1.js'));
        rex_file::delete(rex_path::assets('standard.js'));
    });
    rex_dir::copy(__DIR__ . '/assets', rex_path::assets('core'));
    rex_dir::create(rex_path::data('core'));
    rename(rex_path::data('config.yml'), rex_path::data('core/config.yml'));
}
Пример #4
0
 public function testCheckConnectionInvalidDatabase()
 {
     $configFile = rex_path::data('config.yml');
     $config = rex_file::getConfig($configFile);
     $this->assertTrue(true !== rex_sql::checkDbConnection($config['db'][1]['host'], $config['db'][1]['login'], $config['db'][1]['password'], 'fu-database'));
 }