本文整理汇总了PHP中rex_path::assets方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_path::assets方法的具体用法?PHP rex_path::assets怎么用?PHP rex_path::assets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_path
的用法示例。
在下文中一共展示了rex_path::assets方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkFilesystem
/**
* 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: header
$configFile = rex_path::data('config.yml');
$config = rex_file::getConfig($configFile);
$config['setup'] = true;
// 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');
示例3: function
<?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: execute
public function execute()
{
if (!rex::getUser()->isAdmin()) {
throw new rex_api_exception('You do not have the permission!');
}
$installAddon = rex_addon::get('install');
$versions = self::getVersions();
$versionId = rex_request('version_id', 'int');
if (!isset($versions[$versionId])) {
return null;
}
$version = $versions[$versionId];
if (!rex_string::versionCompare($version['version'], rex::getVersion(), '>')) {
throw new rex_api_exception(sprintf('Existing version of Core (%s) is newer than %s', rex::getVersion(), $version['version']));
}
try {
$archivefile = rex_install_webservice::getArchive($version['path']);
} catch (rex_functional_exception $e) {
throw new rex_api_exception($e->getMessage());
}
$message = '';
$temppath = rex_path::cache('.new.core/');
try {
if ($version['checksum'] != md5_file($archivefile)) {
throw new rex_functional_exception($installAddon->i18n('warning_zip_wrong_checksum'));
}
if (!rex_install_archive::extract($archivefile, $temppath)) {
throw new rex_functional_exception($installAddon->i18n('warning_core_zip_not_extracted'));
}
if (!is_dir($temppath . 'core')) {
throw new rex_functional_exception($installAddon->i18n('warning_zip_wrong_format'));
}
$coreAddons = [];
/** @var rex_addon[] $updateAddons */
$updateAddons = [];
if (is_dir($temppath . 'addons')) {
foreach (rex_finder::factory($temppath . 'addons')->dirsOnly() as $dir) {
$addonkey = $dir->getBasename();
$addonPath = $dir->getRealPath() . '/';
if (!file_exists($addonPath . rex_package::FILE_PACKAGE)) {
continue;
}
$config = rex_file::getConfig($addonPath . rex_package::FILE_PACKAGE);
if (!isset($config['version']) || rex_addon::exists($addonkey) && rex_string::versionCompare($config['version'], rex_addon::get($addonkey)->getVersion(), '<')) {
continue;
}
$coreAddons[$addonkey] = $addonkey;
if (rex_addon::exists($addonkey)) {
$updateAddons[$addonkey] = rex_addon::get($addonkey);
$updateAddonsConfig[$addonkey] = $config;
}
}
}
//$config = rex_file::getConfig($temppath . 'core/default.config.yml');
//foreach ($config['system_addons'] as $addonkey) {
// if (is_dir($temppath . 'addons/' . $addonkey) && rex_addon::exists($addonkey)) {
// $updateAddons[$addonkey] = rex_addon::get($addonkey);
// }
//}
$this->checkRequirements($temppath, $version['version'], $updateAddonsConfig);
if (file_exists($temppath . 'core/update.php')) {
include $temppath . 'core/update.php';
}
foreach ($updateAddons as $addonkey => $addon) {
if ($addon->isInstalled() && file_exists($file = $temppath . 'addons/' . $addonkey . '/' . rex_package::FILE_UPDATE)) {
try {
$addon->includeFile($file);
if ($msg = $addon->getProperty('updatemsg', '')) {
throw new rex_functional_exception($msg);
}
if (!$addon->getProperty('update', true)) {
throw new rex_functional_exception(rex_i18n::msg('package_no_reason'));
}
} catch (rex_functional_exception $e) {
throw new rex_functional_exception($addonkey . ': ' . $e->getMessage(), $e);
} catch (rex_sql_exception $e) {
throw new rex_functional_exception($addonkey . ': SQL error: ' . $e->getMessage(), $e);
}
}
}
// create backup
if ($installAddon->getConfig('backups')) {
rex_dir::create($installAddon->getDataPath());
$archive = $installAddon->getDataPath(strtolower(preg_replace('/[^a-z0-9-_.]/i', '_', rex::getVersion())) . '.zip');
rex_install_archive::copyDirToArchive(rex_path::core(), $archive);
foreach ($updateAddons as $addonkey => $addon) {
rex_install_archive::copyDirToArchive($addon->getPath(), $archive, 'addons/' . $addonkey);
}
}
// copy plugins to new addon dirs
foreach ($updateAddons as $addonkey => $addon) {
foreach ($addon->getRegisteredPlugins() as $plugin) {
$pluginPath = $temppath . 'addons/' . $addonkey . '/plugins/' . $plugin->getName();
if (!is_dir($pluginPath)) {
rex_dir::copy($plugin->getPath(), $pluginPath);
} elseif ($plugin->isInstalled() && is_dir($pluginPath . '/assets')) {
rex_dir::copy($pluginPath . '/assets', $plugin->getAssetsPath());
}
}
}
//.........这里部分代码省略.........