本文整理汇总了PHP中ModuleLoader::upgradeModule方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleLoader::upgradeModule方法的具体用法?PHP ModuleLoader::upgradeModule怎么用?PHP ModuleLoader::upgradeModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleLoader
的用法示例。
在下文中一共展示了ModuleLoader::upgradeModule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: giveActionAccess
include_once MODULE_PATH . "/system/lib/ModuleLoader.php";
$moduleName = $argv[1];
$version = isset($argv[2]) ? $argv[2] : 'latest';
if ($moduleName != "all" && $moduleName != "") {
$moduleArr = array($moduleName);
} else {
$moduleArr = glob(MODULE_PATH . "/*");
for ($i = 0; $i < count($moduleArr); $i++) {
$moduleArr[$i] = basename($moduleArr[$i]);
}
}
foreach ($moduleArr as $moduleName) {
$loader = new ModuleLoader($moduleName);
echo "Start upgrading {$moduleName} module ..." . PHP_EOL;
echo "--------------------------------------------------------" . PHP_EOL;
$loader->upgradeModule();
echo $loader->errors . "" . PHP_EOL;
// load the module again
echo PHP_EOL . "Reload module ..." . PHP_EOL;
$loader->loadModule($installSql);
echo $loader->errors . "" . PHP_EOL;
// give predefined users access to actions
echo "Give admin to access all actions of module '{$moduleName}'" . PHP_EOL;
//giveActionAccess("module='$moduleName'", 1); // admin to access all actions
echo "--------------------------------------------------------" . PHP_EOL;
echo "End loading {$moduleName} module" . PHP_EOL;
}
// give predefined users access to actions
function giveActionAccess($where, $role_id)
{
$db = BizSystem::dbConnection();
示例2: installPackage
public function installPackage($cpkFilePath)
{
$package = $this->_installPackage;
$uri = $this->_repoUri;
$this->setInstallInfo($package, array("state" => "Install", "log" => "Installing ..."));
//trigger remote log action
$operator = Openbiz::$app->getProfile()->getProfileName(Openbiz::$app->getUserProfile("Id"), 'short');
$app_id = $package['app_id'];
$release_id = $package['Id'];
$this->recordInstallLog($uri, $app_id, $release_id, SITE_URL, $operator);
$tmpFolder = OPENBIZ_APP_FILE_PATH . DIRECTORY_SEPARATOR . "tmpfiles" . DIRECTORY_SEPARATOR;
$toFolder = $tmpFolder . time();
try {
$this->_unpack($cpkFilePath, $toFolder);
} catch (Exception $e) {
throw new Exception("ERROR in unpack {$cpkFilePath}. " . $e->getMessage());
}
$this->pkg_log("Unpack. {$cpkFilePath} is unpacked to {$toFolder}\n");
// copy files to target folder from the tmp folder
$this->_filecopy($toFolder);
if (strtolower($package['type']) == 'module' || strtolower($package['type']) == 'application') {
// invoke module upgrade command
foreach ($this->_installModules as $moduleName) {
$this->pkg_log("invoke module upgrade command\n");
$loader = new ModuleLoader($moduleName);
$loader->debug = 0;
$this->pkg_log("Start upgrading {$moduleName} module ..." . PHP_EOL);
$this->pkg_log("--------------------------------------------------------" . PHP_EOL);
$result = $loader->upgradeModule(true);
$this->pkg_log($loader->errors . "" . PHP_EOL);
$this->pkg_log($loader->logs . "" . PHP_EOL);
if ($result == false) {
throw new Exception("Error in install package. " . $loader->errors);
}
// load the module again
$this->pkg_log("Reload module ..." . PHP_EOL);
$loader->loadModule($installSql);
$this->pkg_log($loader->errors . "" . PHP_EOL);
}
}
$time = date('Y-m-d H:i:s');
//reload current profile
Openbiz::getService(ACL_SERVICE)->clearACLCache();
$this->setInstallInfo($package, array("time" => $time, "version" => $package['version'], "state" => "OK", "log" => "Completed"));
}