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


PHP WP_Automatic_Updater::is_vcs_checkout方法代码示例

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


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

示例1: is_version_controlled

 /**
  * Finds out if a site is using a version control system.
  * @return bool
  **/
 public static function is_version_controlled()
 {
     if (!class_exists('WP_Automatic_Updater')) {
         require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
     }
     $updater = new WP_Automatic_Updater();
     return (bool) strval($updater->is_vcs_checkout($context = ABSPATH));
 }
开发者ID:iamtakashi,项目名称:jetpack,代码行数:12,代码来源:class.jetpack-sync-functions.php

示例2: is_version_controlled

 /**
  * Finds out if a site is using a version control system.
  * @return string ( '1' | '0' )
  **/
 public static function is_version_controlled()
 {
     if (!class_exists('WP_Automatic_Updater')) {
         require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
     }
     $updater = new WP_Automatic_Updater();
     $is_version_controlled = strval($updater->is_vcs_checkout($context = ABSPATH));
     // transients should not be empty
     if (empty($is_version_controlled)) {
         $is_version_controlled = '0';
     }
     return $is_version_controlled;
 }
开发者ID:elliott-stocks,项目名称:jetpack,代码行数:17,代码来源:class.jetpack-sync-functions.php

示例3: async_upgrade

 /**
  * Asynchronously upgrades language packs after other upgrades have been made.
  *
  * Hooked to the {@see 'upgrader_process_complete'} action by default.
  *
  * @since 3.7.0
  * @access public
  * @static
  *
  * @param false|WP_Upgrader $upgrader Optional. WP_Upgrader instance or false. If `$upgrader` is
  *                                    a Language_Pack_Upgrader instance, the method will bail to
  *                                    avoid recursion. Otherwise unused. Default false.
  */
 public static function async_upgrade($upgrader = false)
 {
     // Avoid recursion.
     if ($upgrader && $upgrader instanceof Language_Pack_Upgrader) {
         return;
     }
     // Nothing to do?
     $language_updates = wp_get_translation_updates();
     if (!$language_updates) {
         return;
     }
     /*
      * Avoid messing with VCS installs, at least for now.
      * Noted: this is not the ideal way to accomplish this.
      */
     $check_vcs = new WP_Automatic_Updater();
     if ($check_vcs->is_vcs_checkout(WP_CONTENT_DIR)) {
         return;
     }
     foreach ($language_updates as $key => $language_update) {
         $update = !empty($language_update->autoupdate);
         /**
          * Filters whether to asynchronously update translation for core, a plugin, or a theme.
          *
          * @since 4.0.0
          *
          * @param bool   $update          Whether to update.
          * @param object $language_update The update offer.
          */
         $update = apply_filters('async_update_translation', $update, $language_update);
         if (!$update) {
             unset($language_updates[$key]);
         }
     }
     if (empty($language_updates)) {
         return;
     }
     // Re-use the automatic upgrader skin if the parent upgrader is using it.
     if ($upgrader && $upgrader->skin instanceof Automatic_Upgrader_Skin) {
         $skin = $upgrader->skin;
     } else {
         $skin = new Language_Pack_Upgrader_Skin(array('skip_header_footer' => true));
     }
     $lp_upgrader = new Language_Pack_Upgrader($skin);
     $lp_upgrader->bulk_upgrade($language_updates);
 }
开发者ID:BoldGrid,项目名称:WordPress,代码行数:59,代码来源:class-language-pack-upgrader.php

示例4: array

 static function get_possible_failures()
 {
     $result = array();
     // Lets check some reasons why it might not be working as expected
     include_once ABSPATH . '/wp-admin/includes/admin.php';
     include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
     $upgrader = new WP_Automatic_Updater();
     if ($upgrader->is_disabled()) {
         $result[] = 'autoupdates-disabled';
     }
     if (!is_main_site()) {
         $result[] = 'is-not-main-site';
     }
     if (!is_main_network()) {
         $result[] = 'is-not-main-network';
     }
     if ($upgrader->is_vcs_checkout(ABSPATH)) {
         $result[] = 'site-on-vcs';
     }
     if ($upgrader->is_vcs_checkout(WP_PLUGIN_DIR)) {
         $result[] = 'plugin-directory-on-vcs';
     }
     if ($upgrader->is_vcs_checkout(WP_CONTENT_DIR)) {
         $result[] = 'content-directory-on-vcs';
     }
     $lock = get_option('auto_updater.lock');
     if ($lock > time() - HOUR_IN_SECONDS) {
         $result[] = 'lock-is-set';
     }
     $skin = new Automatic_Upgrader_Skin();
     include_once ABSPATH . 'wp-admin/includes/file.php';
     include_once ABSPATH . 'wp-admin/includes/template.php';
     if (!$skin->request_filesystem_credentials(false, ABSPATH, false)) {
         $result[] = 'no-system-write-access';
     }
     if (!$skin->request_filesystem_credentials(false, WP_PLUGIN_DIR, false)) {
         $result[] = 'no-plugin-directory-write-access';
     }
     if (!$skin->request_filesystem_credentials(false, WP_CONTENT_DIR, false)) {
         $result[] = 'no-wp-content-directory-write-access';
     }
     return $result;
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:43,代码来源:class.jetpack-autoupdate.php

示例5: array

 function plugin_upgrade()
 {
     if (empty($this->options)) {
         // Don't automatically enable core updates in installs coming from a repo
         if (!class_exists('WP_Automatic_Updater')) {
             include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
         }
         $wpau = new WP_Automatic_Updater();
         $core_updates_enabled = !$wpau->is_vcs_checkout(ABSPATH);
         $this->options = array('update' => array('core' => array('minor' => $core_updates_enabled, 'major' => false), 'plugins' => false, 'themes' => false), 'svn' => array('core' => false, 'plugins' => array(), 'themes' => array()), 'svn-success-email' => true, 'debug' => 'debug', 'next-development-update' => time(), 'override-email' => '', 'disable-email' => false, 'upgrade-after-3.7' => true);
     }
     // 'debug' option added in version 0.3
     if (!array_key_exists('debug', $this->options)) {
         $this->options['debug'] = false;
     }
     // SVN updates added in version 0.5
     if (!array_key_exists('svn', $this->options)) {
         $this->options['svn'] = false;
     }
     // Development version updates added in version 0.6
     if (!array_key_exists('next-development-update', $this->options)) {
         $this->options['next-development-update'] = time();
     }
     // Override contact email added in version 0.7
     if (!array_key_exists('override-email', $this->options)) {
         $this->options['override-email'] = '';
     }
     // Ability to disable email added in version 0.7
     if (!array_key_exists('disable-email', $this->options)) {
         $this->options['disable-email'] = false;
     }
     // Ability to only send SVN update emails on failure added in 0.8
     if (!array_key_exists('svn-success-email', $this->options)) {
         $this->options['svn-success-email'] = true;
     }
     // SVN support for themes and plugins added in 0.8
     if (!is_array($this->options['svn'])) {
         $this->options['svn'] = array('core' => $this->options['svn'], 'plugins' => array(), 'themes' => array());
     }
     if (!array_key_exists('upgrade-after-3.7', $this->options)) {
         $this->options['upgrade-after-3.7'] = true;
         // Core is handling upgrades now, so we should unschedule our old events
         foreach ($this->options['update'] as $type => $update) {
             $timestamp = wp_next_scheduled("auto_updater_{$type}_event");
             if ($timestamp) {
                 wp_unschedule_event($timestamp, "auto_updater_{$type}_event");
             }
         }
     }
     // Support for different types of core upgrades added in 1.0
     if (!is_array($this->options['update']['core'])) {
         $this->options['update']['core'] = array('major' => $this->options['update']['core'], 'minor' => $this->options['update']['core']);
     }
     // debug option changed to send debug email under varying conditions in 1.0
     if (is_bool($this->options['debug'])) {
         if ($this->options['debug']) {
             $this->options['debug'] = 'always';
         } else {
             $this->options['debug'] = 'debug';
         }
     }
 }
开发者ID:omodev,项目名称:hooks,代码行数:62,代码来源:automatic-updater.php

示例6: strval

 /**
  * Finds out if a site is using a version control system.
  * We'll store that information as a transient with a 24 expiration.
  * We only need to check once per day.
  *
  * @return string ( '1' | '0' )
  */
 function is_version_controlled()
 {
     $is_version_controlled = get_transient('jetpack_site_is_vcs');
     if (false === $is_version_controlled) {
         include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
         $updater = new WP_Automatic_Updater();
         $is_version_controlled = strval($updater->is_vcs_checkout($context = ABSPATH));
         // transients should not be empty
         if (empty($is_version_controlled)) {
             $is_version_controlled = '0';
         }
         set_transient('jetpack_site_is_vcs', $is_version_controlled, DAY_IN_SECONDS);
     }
     return $is_version_controlled;
 }
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:22,代码来源:class.jetpack-autoupdate.php


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