本文整理汇总了PHP中rex_addon::isAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_addon::isAvailable方法的具体用法?PHP rex_addon::isAvailable怎么用?PHP rex_addon::isAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_addon
的用法示例。
在下文中一共展示了rex_addon::isAvailable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
if ($this->addon->isAvailable() && ($msg = $this->checkRequirements()) !== 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();
if (rex_addon::get('install')->getConfig('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);
}
$this->addon->setProperty('version', $this->file['version']);
rex_install_packages::updatedPackage($this->addonkey, $this->fileId);
}
示例2: isAvailable
/**
* @override
* @see redaxo/include/classes/rex_addon#isAvailable($addon)
*/
static function isAvailable($addon, $plugin = null)
{
return parent::isAvailable(array($addon, $plugin));
}
示例3: isAvailable
/**
* @override
* @see redaxo/include/classes/rex_addon#isAvailable($addon)
*/
function isAvailable($addon, $plugin, $default = null)
{
return parent::isAvailable(array($addon, $plugin), $default);
}