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


PHP module::deactivate方法代码示例

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


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

示例1: save

 public function save()
 {
     access::verify_csrf();
     $changes->activate = array();
     $changes->deactivate = array();
     $activated_names = array();
     $deactivated_names = array();
     foreach (module::available() as $module_name => $info) {
         if ($info->locked) {
             continue;
         }
         $desired = $this->input->post($module_name) == 1;
         if ($info->active && !$desired && module::is_active($module_name)) {
             $changes->deactivate[] = $module_name;
             $deactivated_names[] = $info->name;
             module::deactivate($module_name);
         } else {
             if (!$info->active && $desired && !module::is_active($module_name)) {
                 $changes->activate[] = $module_name;
                 $activated_names[] = $info->name;
                 module::install($module_name);
                 module::activate($module_name);
             }
         }
     }
     module::event("module_change", $changes);
     // @todo this type of collation is questionable from a i18n perspective
     if ($activated_names) {
         message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
     }
     if ($deactivated_names) {
         message::success(t("Deactivated: %names", array("names" => join(", ", $deactivated_names))));
     }
     url::redirect("admin/modules");
 }
开发者ID:xafr,项目名称:gallery3,代码行数:35,代码来源:admin_modules.php

示例2: uninstall

 static function uninstall()
 {
     // deactivate
     module::deactivate("image_optimizer");
     // delete vars from database
     module::clear_all_vars("image_optimizer");
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:7,代码来源:image_optimizer_installer.php

示例3: change

 public function change()
 {
     access::verify_csrf();
     $active_provider = module::get_var("gallery", "identity_provider", "user");
     $providers = identity::providers();
     $new_provider = Input::instance()->post("provider");
     if ($new_provider != $active_provider) {
         module::deactivate($active_provider);
         // Switch authentication
         identity::reset();
         module::set_var("gallery", "identity_provider", $new_provider);
         module::install($new_provider);
         module::activate($new_provider);
         module::event("identity_provider_changed", $active_provider, $new_provider);
         module::uninstall($active_provider);
         message::success(t("Changed to %description", array("description" => $providers->{$new_provider})));
         try {
             Session::instance()->destroy();
         } catch (Exception $e) {
             // We don't care if there was a problem destroying the session.
         }
         url::redirect(item::root()->abs_url());
     }
     message::info(t("The selected provider \"%description\" is already active.", array("description" => $providers->{$new_provider})));
     url::redirect("admin/identity");
 }
开发者ID:viosca,项目名称:gallery3,代码行数:26,代码来源:admin_identity.php

示例4: _do_save

 private function _do_save()
 {
     $changes = new stdClass();
     $changes->activate = array();
     $changes->deactivate = array();
     $activated_names = array();
     $deactivated_names = array();
     foreach (module::available() as $module_name => $info) {
         if ($info->locked) {
             continue;
         }
         try {
             $desired = Input::instance()->post($module_name) == 1;
             if ($info->active && !$desired && module::is_active($module_name)) {
                 module::deactivate($module_name);
                 $changes->deactivate[] = $module_name;
                 $deactivated_names[] = t($info->name);
             } else {
                 if (!$info->active && $desired && !module::is_active($module_name)) {
                     if (module::is_installed($module_name)) {
                         module::upgrade($module_name);
                     } else {
                         module::install($module_name);
                     }
                     module::activate($module_name);
                     $changes->activate[] = $module_name;
                     $activated_names[] = t($info->name);
                 }
             }
         } catch (Exception $e) {
             message::warning(t("An error occurred while installing the <b>%module_name</b> module", array("module_name" => $info->name)));
             Kohana_Log::add("error", (string) $e);
         }
     }
     module::event("module_change", $changes);
     // If modules need upgrading, this will get recreated
     site_status::clear("upgrade_now");
     // @todo this type of collation is questionable from an i18n perspective
     if ($activated_names) {
         message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
     }
     if ($deactivated_names) {
         message::success(t("Deactivated: %names", array("names" => join(", ", $deactivated_names))));
     }
 }
开发者ID:Joe7,项目名称:gallery3,代码行数:45,代码来源:admin_modules.php

示例5: _do_save

 private function _do_save()
 {
     $changes->activate = array();
     $changes->deactivate = array();
     $activated_names = array();
     $deactivated_names = array();
     foreach (module::available() as $module_name => $info) {
         if ($info->locked) {
             continue;
         }
         try {
             $desired = Input::instance()->post($module_name) == 1;
             if ($info->active && !$desired && module::is_active($module_name)) {
                 module::deactivate($module_name);
                 $changes->deactivate[] = $module_name;
                 $deactivated_names[] = t($info->name);
             } else {
                 if (!$info->active && $desired && !module::is_active($module_name)) {
                     if (module::is_installed($module_name)) {
                         module::upgrade($module_name);
                     } else {
                         module::install($module_name);
                     }
                     module::activate($module_name);
                     $changes->activate[] = $module_name;
                     $activated_names[] = t($info->name);
                 }
             }
         } catch (Exception $e) {
             Kohana_Log::add("error", (string) $e);
         }
     }
     module::event("module_change", $changes);
     // @todo this type of collation is questionable from an i18n perspective
     if ($activated_names) {
         message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
     }
     if ($deactivated_names) {
         message::success(t("Deactivated: %names", array("names" => join(", ", $deactivated_names))));
     }
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:41,代码来源:admin_modules.php

示例6: deactivate_missing_modules

 /**
  * Deactivate modules that are unavailable or missing, yet still active.
  * This happens when a user deletes a module without deactivating it.
  */
 static function deactivate_missing_modules()
 {
     foreach (self::$modules as $module_name => $module) {
         if (module::is_active($module_name) && !module::info($module_name)) {
             module::deactivate($module_name);
         }
     }
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:12,代码来源:module.php


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