當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。