当前位置: 首页>>代码示例>>PHP>>正文


PHP ModuleLoader::upgradeModule方法代码示例

本文整理汇总了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();
开发者ID:Why-Not-Sky,项目名称:cubi-ng,代码行数:31,代码来源:upgrade_module.php

示例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"));
 }
开发者ID:openbizx,项目名称:openbizx-cubix,代码行数:45,代码来源:InstallerService.php


注:本文中的ModuleLoader::upgradeModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。