本文整理汇总了PHP中rex_addon::loadProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_addon::loadProperties方法的具体用法?PHP rex_addon::loadProperties怎么用?PHP rex_addon::loadProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_addon
的用法示例。
在下文中一共展示了rex_addon::loadProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doAction
public function doAction()
{
$path = rex_path::addon($this->addonkey);
$temppath = rex_path::addon('.new.' . $this->addonkey);
if (($msg = $this->extractArchiveTo($temppath)) !== true) {
return $msg;
}
// ---- check package.yml
$packageFile = $temppath . rex_package::FILE_PACKAGE;
if (!file_exists($packageFile)) {
return rex_i18n::msg('package_missing_yml_file');
}
try {
$config = rex_file::getConfig($packageFile);
} catch (rex_yaml_parse_exception $e) {
return rex_i18n::msg('package_invalid_yml_file') . ' ' . $e->getMessage();
}
if ($this->addon->isAvailable() && ($msg = $this->checkRequirements($config)) !== true) {
return $msg;
}
// ---- include update.php
if ($this->addon->isInstalled() && file_exists($temppath . rex_package::FILE_UPDATE)) {
try {
$this->addon->includeFile('../.new.' . $this->addonkey . '/' . rex_package::FILE_UPDATE);
} catch (rex_functional_exception $e) {
return $e->getMessage();
} catch (rex_sql_exception $e) {
return 'SQL error: ' . $e->getMessage();
}
if (($msg = $this->addon->getProperty('updatemsg', '')) != '') {
return $msg;
}
if (!$this->addon->getProperty('update', true)) {
return rex_i18n::msg('package_no_reason');
}
}
// ---- backup
$assets = $this->addon->getAssetsPath();
$installConfig = rex_file::getCache(rex_addon::get('install')->getDataPath('config.json'));
if (isset($installConfig['backups']) && $installConfig['backups']) {
$archivePath = rex_path::addonData('install', $this->addonkey . '/');
rex_dir::create($archivePath);
$archive = $archivePath . strtolower(preg_replace('/[^a-z0-9-_.]/i', '_', $this->addon->getVersion('0'))) . '.zip';
rex_install_archive::copyDirToArchive($path, $archive);
if (is_dir($assets)) {
rex_install_archive::copyDirToArchive($assets, $archive, 'assets');
}
}
// ---- copy plugins to new addon dir
foreach ($this->addon->getRegisteredPlugins() as $plugin) {
$pluginPath = $temppath . '/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());
}
}
// ---- update main addon dir
rex_dir::delete($path);
rename($temppath, $path);
// ---- update assets
$origAssets = $this->addon->getPath('assets');
if ($this->addon->isInstalled() && is_dir($origAssets)) {
rex_dir::copy($origAssets, $assets);
}
// ---- update package order
if ($this->addon->isAvailable()) {
$this->addon->loadProperties();
foreach ($this->addon->getAvailablePlugins() as $plugin) {
$plugin->loadProperties();
}
rex_package_manager::generatePackageOrder();
}
$this->addon->setProperty('version', $this->file['version']);
rex_install_packages::updatedPackage($this->addonkey, $this->fileId);
}