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


PHP MS_Factory::clear方法代码示例

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


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

示例1: update

 /**
  * Upgrade database.
  *
  * @since  1.0.0
  * @param  bool $force Also execute update logic when version did not change.
  */
 public static function update($force = false)
 {
     static $Done = false;
     if ($Done && !$force) {
         return;
     }
     // Migration handler has its own valid_user check.
     self::check_migration_handler();
     // Updates are only triggered from Admin-Side by an Admin user.
     if (!self::valid_user()) {
         return;
     }
     // Check for correct network-wide protection setup.
     self::check_settings();
     $settings = MS_Factory::load('MS_Model_Settings');
     $old_version = $settings->version;
     // Old: The version in DB.
     $new_version = MS_Plugin::instance()->version;
     // New: Version in file.
     $is_new_setup = empty($old_version);
     // Compare current src version to DB version:
     // We only do UP-grades but no DOWN-grades!
     if ($old_version) {
         $version_changed = version_compare($old_version, $new_version, 'lt');
     } else {
         $version_changed = true;
     }
     if ($force || $version_changed) {
         $Done = true;
         $msg = array();
         /*
          * ----- General update logic, executed on every update ------------
          */
         do_action('ms_model_upgrade_before_update', $settings, $old_version, $new_version, $force);
         // Prepare the Update message.
         if (!$version_changed) {
             $msg[] = sprintf(__('<strong>Membership 2</strong> is set up for version %1$s!', 'membership2'), $new_version);
         } else {
             $msg[] = sprintf(__('<strong>Membership 2</strong> was updated to version %1$s!', 'membership2'), $new_version);
         }
         // Every time the plugin is updated we clear the cache.
         MS_Factory::clear();
         // Create missing Membership pages.
         $new_pages = MS_Model_Pages::create_missing_pages();
         if (!empty($new_pages)) {
             $msg[] = sprintf(__('New Membership pages created: "%1$s".', 'membership2'), implode('", "', $new_pages));
         }
         // Remove an old version of Protected Content
         // TODO: REMOVE THIS BLOCK/FUNCTION END OF 2015
         if ($version_changed) {
             self::remove_old_copy();
         }
         // Note: We do not create menu items on upgrade! Users might have
         // intentionally removed the items from the menu...
         /*
          * ----- Version-Specific update logic -----------------------------
          */
         // Upgrade from a 1.0.0.x version to 1.0.1.0 or higher
         if (version_compare($old_version, '1.0.1.0', 'lt')) {
             self::_upgrade_1_0_1_0();
         }
         // Upgrade from 1.0.1.0 version to 1.0.1.1 or higher
         if (version_compare($old_version, '1.0.1.1', 'lt')) {
             self::_upgrade_1_0_1_1();
         }
         // Upgrade from 1.0.1.x version to 1.0.2.0 or higher
         if (version_compare($old_version, '1.0.2.0', 'lt')) {
             self::_upgrade_1_0_2_0();
         }
         // Upgrade from 1.0.2.x version to 1.0.2.4 or higher
         if (version_compare($old_version, '1.0.2.4', 'lt')) {
             self::_upgrade_1_0_2_4();
         }
         /*
          * ----- General update logic, executed on every update ------------
          */
         $settings->version = $new_version;
         $settings->save();
         // Display a message after the page is reloaded.
         if (!$is_new_setup) {
             lib3()->ui->admin_message(implode('<br>', $msg), '', '', 'ms-update');
         }
         do_action('ms_model_upgrade_after_update', $settings, $old_version, $new_version, $force);
         $addons = MS_Factory::load('MS_Model_Addon');
         $addons->flush_list();
         // This will reload the current page.
         MS_Plugin::flush_rewrite_rules();
     }
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:95,代码来源:class-ms-model-upgrade.php

示例2: enable_addon

 /**
  * Function is triggered every time an add-on is enabled.
  *
  * We flush the Factory Cache when the WPML Add-on is enabled so all strings
  * are properly registered for translation.
  *
  * @since  1.0.1.0
  * @param  string $addon The Add-on ID
  */
 public function enable_addon($addon)
 {
     if (self::ID == $addon) {
         MS_Factory::clear();
     }
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:15,代码来源:class-ms-addon-wpml.php


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