本文整理汇总了PHP中rex_path::coreAssets方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_path::coreAssets方法的具体用法?PHP rex_path::coreAssets怎么用?PHP rex_path::coreAssets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_path
的用法示例。
在下文中一共展示了rex_path::coreAssets方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* very basic setup steps, so everything is in place for our browser-based setup wizard.
*
* @param string $skinAddon
* @param string $skinPlugin
*/
public static function init($skinAddon = 'be_style', $skinPlugin = 'redaxo')
{
// initial purge all generated files
rex_delete_cache();
// delete backend session
rex_backend_login::deleteSession();
// copy alle media files of the current rex-version into redaxo_media
rex_dir::copy(rex_path::core('assets'), rex_path::coreAssets());
// copy skins files/assets
$skinAddon = rex_addon::get($skinAddon);
$skinPlugin = $skinAddon->getPlugin($skinPlugin);
rex_dir::copy($skinAddon->getPath('assets'), $skinAddon->getAssetsPath());
rex_dir::copy($skinPlugin->getPath('assets'), $skinPlugin->getAssetsPath());
if (is_file($skinAddon->getPath('install.php'))) {
$skinAddon->includeFile('install.php');
}
if (is_file($skinPlugin->getPath('install.php'))) {
$skinPlugin->includeFile('install.php');
}
}
示例2: header
$configFile = rex_path::coreData('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::coreAssets());
$success = 'Updated assets';
} elseif ($func == 'updateinfos') {
$configFile = rex_path::coreData('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: execute
//.........这里部分代码省略.........
$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
$installConfig = rex_file::getCache($installAddon->getDataPath('config.json'));
if (isset($installConfig['backups']) && $installConfig['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());
}
}
}
// move temp dirs to permanent destination
rex_dir::delete(rex_path::core());
rename($temppath . 'core', rex_path::core());
if (is_dir(rex_path::core('assets'))) {
rex_dir::copy(rex_path::core('assets'), rex_path::coreAssets());
}
foreach ($coreAddons as $addonkey) {
if (isset($updateAddons[$addonkey])) {
rex_dir::delete(rex_path::addon($addonkey));
}
rename($temppath . 'addons/' . $addonkey, rex_path::addon($addonkey));
if (is_dir(rex_path::addon($addonkey, 'assets'))) {
rex_dir::copy(rex_path::addon($addonkey, 'assets'), rex_path::addonAssets($addonkey));
}
}
} catch (rex_functional_exception $e) {
$message = $e->getMessage();
} catch (rex_sql_exception $e) {
$message = 'SQL error: ' . $e->getMessage();
}
rex_file::delete($archivefile);
rex_dir::delete($temppath);
if ($message) {
$message = $installAddon->i18n('warning_core_not_updated') . '<br />' . $message;
$success = false;
} else {
$message = $installAddon->i18n('info_core_updated');
$success = true;
rex_delete_cache();
rex_install_webservice::deleteCache('core');
}
$result = new rex_api_result($success, $message);
if ($success) {
$result->setRequiresReboot(true);
}
return $result;
}