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


PHP Core_Upgrader::should_upgrade_to_version方法代码示例

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


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

示例1: should_auto_update

 /**
  * Tests to see if we should upgrade a specific item, does not test to see if we CAN update the item.
  */
 static function should_auto_update($type, $item, $context)
 {
     if (self::upgrader_disabled()) {
         return false;
     }
     if (self::is_vcs_checkout($context)) {
         return false;
     }
     // Next up, do we actually have it enabled for this type of update?
     switch ($type) {
         case 'language':
             $upgrade = true;
             break;
         case 'core':
             $upgrade = Core_Upgrader::should_upgrade_to_version($item->current);
             break;
         default:
         case 'plugin':
         case 'theme':
             $upgrade = false;
             break;
     }
     // And does the user / plugins want it?
     // Plugins may filter on 'auto_upgrade_plugin', and check the 2nd param, $item, to only enable it for certain Plugins/Themes
     if (!apply_filters('auto_upgrade_' . $type, $upgrade, $item)) {
         return false;
     }
     // If it's a core update, are we actually compatible with it's requirements?
     if ('core' == $type) {
         global $wpdb;
         $php_compat = version_compare(phpversion(), $item->php_version, '>=');
         if (file_exists(WP_CONTENT_DIR . '/db.php') && empty($wpdb->is_mysql)) {
             $mysql_compat = true;
         } else {
             $mysql_compat = version_compare($wpdb->db_version(), $item->mysql_version, '>=');
         }
         if (!$php_compat || !$mysql_compat) {
             return false;
         }
     }
     return true;
 }
开发者ID:openify,项目名称:wordpress-composer,代码行数:45,代码来源:class-wp-upgrader.php


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