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


PHP ModuleInstaller::uninstall方法代码示例

本文整理汇总了PHP中ModuleInstaller::uninstall方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleInstaller::uninstall方法的具体用法?PHP ModuleInstaller::uninstall怎么用?PHP ModuleInstaller::uninstall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModuleInstaller的用法示例。


在下文中一共展示了ModuleInstaller::uninstall方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: performUninstall

 function performUninstall($name)
 {
     $uh = new UpgradeHistory();
     $uh->name = $name;
     $uh->id_name = $name;
     $found = $uh->checkForExisting($uh);
     if ($found != null) {
         global $sugar_config;
         global $mod_strings;
         global $current_language;
         $base_upgrade_dir = sugar_cached("/upgrades");
         $base_tmp_upgrade_dir = "{$base_upgrade_dir}/temp";
         if (!isset($GLOBALS['mi_remove_tables'])) {
             $GLOBALS['mi_remove_tables'] = true;
         }
         $unzip_dir = mk_temp_dir($base_tmp_upgrade_dir);
         unzip($found->filename, $unzip_dir);
         $mi = new ModuleInstaller();
         $mi->silent = true;
         $mi->uninstall("{$unzip_dir}");
         $found->delete();
         unlink(remove_file_extension($found->filename) . '-manifest.php');
         unlink($found->filename);
     }
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:25,代码来源:PackageManager.php

示例2: switch

 switch ($mode) {
     case "Install":
         //here we can determine if this is an upgrade or a new version
         if (!empty($previous_version)) {
             $mi->install("{$unzip_dir}", true, $previous_version);
         } else {
             $mi->install("{$unzip_dir}");
         }
         break;
     case "Uninstall":
         if ($remove_tables == 'false') {
             $GLOBALS['mi_remove_tables'] = false;
         } else {
             $GLOBALS['mi_remove_tables'] = true;
         }
         $mi->uninstall("{$unzip_dir}");
         break;
     case "Disable":
         if (!$overwrite_files) {
             $GLOBALS['mi_overwrite_files'] = false;
         } else {
             $GLOBALS['mi_overwrite_files'] = true;
         }
         $mi->disable("{$unzip_dir}");
         break;
     case "Enable":
         if (!$overwrite_files) {
             $GLOBALS['mi_overwrite_files'] = false;
         } else {
             $GLOBALS['mi_overwrite_files'] = true;
         }
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:UpgradeWizard_commit.php

示例3: Item

 /**
  * 系统模块管理功能,用于从商店自动部署模块、移除模块
  */
 public function Item()
 {
     $this->rest(["model" => "System/ModuleItem", "post" => function ($res) {
         $zip = "{$res["request"]["module"]}.zip";
         $path = APP_PATH . $res["request"]["module"];
         if (!APP_DEBUG) {
             /*从服务器下载模块压缩包*/
             \Org\Util\Downloader::transfer(C("ENTERTILE") . C("ENTERTILE_STORE_PATH") . $zip, TEMP_PATH . $zip);
             /*创建模块目录*/
             \Org\Util\Directory::create($path);
             /*解压ZIP文件*/
             \Org\Util\Zip::extract(TEMP_PATH . $zip, $path);
         }
         /*加载模块配置类并初始化*/
         include "{$path}/install.php";
         $moduleInstaller = new \ModuleInstaller();
         $config = $moduleInstaller->config;
         /*准备配置数据(格式化处理)*/
         $rules = [];
         for ($i = 0, $l = count($config["menus"]); $i < $l; $i++) {
             $menu = $config["menus"][$i];
             $menu["rules"] = [];
             for ($j = 0, $m = count($menu["permits"]); $j < $m; $j++) {
                 $permit = $menu["permits"][$j];
                 for ($k = 0, $n = count($permit["methods"]); $k < $n; $k++) {
                     $rule = strtolower("{$permit["methods"][$k]}{$permit["path"]}");
                     $rules[] = $menu["rules"][] = $rule;
                 }
             }
             $config["menus"][$i] = $menu;
         }
         /*增加模块信息*/
         $config["id"] = D("System/ModuleItem")->add(["name" => $config["name"], "title" => $config["title"], "abstract" => $config["abstract"]]);
         /*增加相关权限规则(如果已存在,则不添加)*/
         //读取当前规则信息
         $modelPermits = D("System/AuthenticationPermit")->select();
         //移除已经存在的权限规则
         $rules = join($rules, ";");
         for ($i = 0, $l = count($modelPermits); $i < $l; $i++) {
             $rules = str_replace($modelPermits[$i]["name"], "", $rules);
         }
         $rules = preg_replace("/^;|;\$/", "", preg_replace("/;{2,}/", ";", $rules));
         //解析新增RULE并保存到数据库
         if ($rules !== "") {
             $rules = '[{"name":"' . str_replace(";", '"},{"name":"', $rules) . '"}]';
         }
         D("System/AuthenticationPermit")->addAll(json_decode($rules, true));
         /*将规则信息与菜单相关联*/
         //读取最新规则信息
         $rules = [];
         $modelPermits = D("System/AuthenticationPermit")->select();
         for ($i = 0, $l = count($modelPermits); $i < $l; $i++) {
             $rules[$modelPermits[$i]["name"]] = $modelPermits[$i]["id"];
         }
         //关联菜单权限
         for ($i = 0, $l = count($config["menus"]); $i < $l; $i++) {
             $tPermits = [];
             $menu = $config["menus"][$i];
             //添加菜单页面可访问权限
             $menu["rules"][] = ["path" => $menu["page"], "methods" => ["GET"]];
             for ($j = 0, $m = count($menu["rules"]); $j < $m; $j++) {
                 $tPermits[] = $rules[$menu["rules"][$j]];
             }
             //创建菜单记录
             unset($config["menus"][$i]["permits"]);
             unset($config["menus"][$i]["rules"]);
             $config["menus"][$i]["title"] = $menu["menu"];
             $config["menus"][$i]["module_id"] = $config["id"];
             $config["menus"][$i]["rule_ids"] = join($tPermits, ",");
         }
         D("SystemModuleMenu")->addAll($config["menus"]);
         /*运行自定义安装脚本*/
         $moduleInstaller->install();
         /*返回输出*/
         $res["response"] = $config;
         return $res;
     }, "delete" => function ($res) {
         $path = APP_PATH . $res["request"]["module"];
         //执行自定义卸载脚本
         include "{$path}/install.php";
         $moduleInstaller = new \ModuleInstaller();
         $moduleInstaller->uninstall();
         /*移除模块相关文件及记录*/
         $mod = new \Think\Model();
         //移除对应菜单项
         $mod->execute("delete from think_system_module_menu where module_id in(select id from think_system_module_item where name='%s')", [$res["request"]["module"]]);
         //移除模块主体
         $mod->execute("delete from think_system_module_item where name='%s'", [$res["request"]["module"]]);
         if (!APP_DEBUG) {
             //移除代码
             \Org\Util\Directory::unlink($path);
         }
         /*返回输出*/
         return $res;
     }]);
 }
开发者ID:sayi21cn,项目名称:Atomu,代码行数:99,代码来源:ModuleController.class.php

示例4: performUninstall

 function performUninstall($name)
 {
     $uh = new UpgradeHistory();
     $uh->name = $name;
     $uh->id_name = $name;
     $found = $uh->checkForExisting($uh);
     if ($found != null) {
         global $sugar_config;
         global $mod_strings;
         global $current_language;
         $base_upgrade_dir = $this->upload_dir . '/upgrades';
         $base_tmp_upgrade_dir = "{$base_upgrade_dir}/temp";
         if (is_file($found->filename)) {
             if (!isset($GLOBALS['mi_remove_tables'])) {
                 $GLOBALS['mi_remove_tables'] = true;
             }
             $unzip_dir = mk_temp_dir($base_tmp_upgrade_dir);
             unzip($found->filename, $unzip_dir);
             $mi = new ModuleInstaller();
             $mi->silent = true;
             $mi->uninstall("{$unzip_dir}");
             $found->delete();
             unlink(remove_file_extension($found->filename) . '-manifest.php');
             unlink($found->filename);
         } else {
             //file(s_ have been deleted or are not found in the directory, allow database delete to happen but no need to change filesystem
             $found->delete();
         }
     }
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:30,代码来源:PackageManager.php


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