• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_main_network函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中is_main_network函数的典型用法代码示例。如果您正苦于以下问题:PHP is_main_network函数的具体用法?PHP is_main_network怎么用?PHP is_main_network使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: wp_schedule_update_global_counts

 function wp_schedule_update_global_counts()
 {
     if (!is_main_network() || !is_main_site()) {
         return;
     }
     if (!wp_next_scheduled('update_global_counts') && !wp_installing()) {
         wp_schedule_event(time(), 'twicedaily', 'update_global_counts');
     }
 }
开发者ID:felixarntz,项目名称:global-admin,代码行数:9,代码来源:ms-functions.php


示例2: path

 /**
  * Gets the cache folder for Bladerunner.
  */
 public static function path()
 {
     $result = wp_upload_dir()['basedir'];
     if (is_multisite() && !(is_main_network() && is_main_site() && defined('MULTISITE'))) {
         $result = realpath($result . '/../..');
     }
     $result .= '/.cache';
     $result = realpath($result);
     return apply_filters('bladerunner/cache/path', $result);
 }
开发者ID:frozzare,项目名称:bladerunner,代码行数:13,代码来源:Cache.php


示例3: bootstrap

/**
 * Attach SSO functions into WordPress.
 */
function bootstrap()
{
    // We never need this for the main network
    if (is_main_network()) {
        return;
    }
    add_filter('mercator.sso.main_domain_network', __NAMESPACE__ . '\\get_main_network');
    add_filter('mercator.sso.is_main_domain', __NAMESPACE__ . '\\correct_for_subdomain_networks', 10, 3);
    add_filter('mercator.sso.main_site_for_actions', __NAMESPACE__ . '\\set_main_site_for_actions');
    add_action('muplugins_loaded', __NAMESPACE__ . '\\initialize_cookie_domain', 11);
}
开发者ID:rpkoller,项目名称:Mercator,代码行数:14,代码来源:sso-multinetwork.php


示例4: delete_transients

 public static function delete_transients()
 {
     global $_wp_using_ext_object_cache;
     if ($_wp_using_ext_object_cache) {
         return 0;
     }
     global $wpdb;
     $records = 0;
     // Delete transients from options table
     $records .= self::delete_transients_single_site();
     // Delete transients from multisite, if configured as such
     if (is_multisite() && is_main_network()) {
         $records .= self::delete_transients_multisite();
     }
     return $records;
 }
开发者ID:jarednova,项目名称:timber,代码行数:16,代码来源:Cleaner.php


示例5: delete_file

 function delete_file($file_name)
 {
     $url_parts = parse_url($file_name);
     if (false !== stripos($url_parts['path'], constant('LOCAL_UPLOADS'))) {
         $file_uri = substr($url_parts['path'], stripos($url_parts['path'], constant('LOCAL_UPLOADS')) + strlen(constant('LOCAL_UPLOADS')));
     } else {
         $file_uri = '/' . $url_parts['path'];
     }
     $headers = array('X-Client-Site-ID: ' . constant('FILES_CLIENT_SITE_ID'), 'X-Access-Token: ' . constant('FILES_ACCESS_TOKEN'));
     $service_url = $this->get_files_service_hostname() . '/' . $this->get_upload_path();
     if (is_multisite() && !(is_main_network() && is_main_site())) {
         $service_url .= '/sites/' . get_current_blog_id();
     }
     $ch = curl_init($service_url . $file_uri);
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, false);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_exec($ch);
     $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     curl_close($ch);
     if (200 != $http_code) {
         error_log(sprintf(__('Error deleting the file from the remote servers: Code %d'), $http_code));
         return;
     }
     // We successfully deleted the file, purge the file from the caches
     $invalidation_url = get_site_url() . '/' . $this->get_upload_path();
     if (is_multisite() && !(is_main_network() && is_main_site())) {
         $invalidation_url .= '/sites/' . get_current_blog_id();
     }
     $invalidation_url .= $file_uri;
     $this->purge_file_cache($invalidation_url, 'PURGE');
 }
开发者ID:humanmade,项目名称:vip-mu-plugins-public,代码行数:35,代码来源:a8c-files.php


示例6: wp_should_upgrade_global_tables

/**
 * Determine if global tables should be upgraded.
 *
 * This function performs a series of checks to ensure the environment allows
 * for the safe upgrading of global WordPress database tables. It is necessary
 * because global tables will commonly grow to millions of rows on large
 * installations, and the ability to control their upgrade routines can be
 * critical to the operation of large networks.
 *
 * In a future iteration, this function may use `wp_is_large_network()` to more-
 * intelligently prevent global table upgrades. Until then, we make sure
 * WordPress is on the main site of the main network, to avoid running queries
 * more than once in multi-site or multi-network environments.
 *
 * @since 4.3.0
 *
 * @return bool Whether to run the upgrade routines on global tables.
 */
function wp_should_upgrade_global_tables()
{
    // Return false early if explicitly not upgrading
    if (defined('DO_NOT_UPGRADE_GLOBAL_TABLES')) {
        return false;
    }
    // Assume global tables should be upgraded
    $should_upgrade = true;
    // Set to false if not on main network (does not matter if not multi-network)
    if (!is_main_network()) {
        $should_upgrade = false;
    }
    // Set to false if not on main site of current network (does not matter if not multi-site)
    if (!is_main_site()) {
        $should_upgrade = false;
    }
    /**
     * Filter if upgrade routines should be run on global tables.
     *
     * @param bool $should_upgrade Whether to run the upgrade routines on global tables.
     */
    return apply_filters('wp_should_upgrade_global_tables', $should_upgrade);
}
开发者ID:ryan2407,项目名称:Vision,代码行数:41,代码来源:upgrade.php


示例7: get_dynamic_prefix

 /**
  * Get the prefix path for the files. Ignores WP media library
  * year month subdirectory setting and just uses S3 setting
  *
  * @param string $time
  *
  * @return string
  */
 function get_dynamic_prefix($time = null)
 {
     $prefix = '';
     $subdir = '';
     // If multisite (and if not the main site in a post-MU network)
     if (is_multisite() && !(is_main_network() && is_main_site() && defined('MULTISITE'))) {
         if (!get_site_option('ms_files_rewriting')) {
             /*
              * If ms-files rewriting is disabled (networks created post-3.5), it is fairly
              * straightforward: Append sites/%d if we're not on the main site (for post-MU
              * networks). (The extra directory prevents a four-digit ID from conflicting with
              * a year-based directory for the main site. But if a MU-era network has disabled
              * ms-files rewriting manually, they don't need the extra directory, as they never
              * had wp-content/uploads for the main site.)
              */
             if (defined('MULTISITE')) {
                 $prefix = '/sites/' . get_current_blog_id();
             } else {
                 $prefix = '/' . get_current_blog_id();
             }
         } elseif (defined('UPLOADS') && !ms_is_switched()) {
             /*
              * Handle the old-form ms-files.php rewriting if the network still has that enabled.
              * When ms-files rewriting is enabled, then we only listen to UPLOADS when:
              * 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
              *    there, and
              * 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
              *    the original blog ID.
              *
              * Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
              * (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
              * as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
              * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
              */
             if (defined('BLOGUPLOADDIR')) {
                 $prefix = untrailingslashit(BLOGUPLOADDIR);
             } else {
                 $prefix = ABSPATH . UPLOADS;
             }
         }
     }
     if ($this->get_setting('use-yearmonth-folders')) {
         $subdir = $this->get_year_month_directory_name($time);
         $prefix .= $subdir;
     }
     // support legacy MS installs (<3.5 since upgraded) for subsites
     if (is_multisite() && !(is_main_network() && is_main_site()) && false === strpos($prefix, 'sites/')) {
         $details = get_blog_details(get_current_blog_id());
         $legacy_ms_prefix = 'sites/' . $details->blog_id . '/';
         $legacy_ms_prefix = apply_filters('as3cf_legacy_ms_subsite_prefix', $legacy_ms_prefix, $details);
         $prefix = '/' . trailingslashit(ltrim($legacy_ms_prefix, '/')) . ltrim($subdir, '/');
     }
     return $prefix;
 }
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:62,代码来源:amazon-s3-and-cloudfront.php


示例8: sp_get_upload_info

function sp_get_upload_info()
{
    $siteurl = get_option('siteurl');
    $upload_path = trim(get_option('upload_path'));
    if (empty($upload_path) || 'wp-content/uploads' == $upload_path) {
        $dir = WP_CONTENT_DIR . '/uploads';
    } elseif (0 !== strpos($upload_path, ABSPATH)) {
        # $dir is absolute, $upload_path is (maybe) relative to ABSPATH
        $dir = path_join(ABSPATH, $upload_path);
    } else {
        $dir = $upload_path;
    }
    if (!($url = get_option('upload_url_path'))) {
        if (empty($upload_path) || 'wp-content/uploads' == $upload_path || $upload_path == $dir) {
            $url = WP_CONTENT_URL . '/uploads';
        } else {
            $url = trailingslashit($siteurl) . $upload_path;
        }
    }
    /*
     * Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
     * We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
     */
    if (defined('UPLOADS') && !(is_multisite() && get_site_option('ms_files_rewriting'))) {
        $dir = ABSPATH . UPLOADS;
        $url = trailingslashit($siteurl) . UPLOADS;
    }
    # If multisite (and if not the main site in a post-MU network)
    if (is_multisite() && !(is_main_network() && is_main_site() && defined('MULTISITE'))) {
        if (!get_site_option('ms_files_rewriting')) {
            /*
             * If ms-files rewriting is disabled (networks created post-3.5), it is fairly
             * straightforward: Append sites/%d if we're not on the main site (for post-MU
             * networks). (The extra directory prevents a four-digit ID from conflicting with
             * a year-based directory for the main site. But if a MU-era network has disabled
             * ms-files rewriting manually, they don't need the extra directory, as they never
             * had wp-content/uploads for the main site.)
             */
            if (defined('MULTISITE')) {
                $ms_dir = '/sites/' . get_current_blog_id();
            } else {
                $ms_dir = '/' . get_current_blog_id();
            }
            $dir .= $ms_dir;
            $url .= $ms_dir;
        } elseif (defined('UPLOADS') && !ms_is_switched()) {
            /*
             * Handle the old-form ms-files.php rewriting if the network still has that enabled.
             * When ms-files rewriting is enabled, then we only listen to UPLOADS when:
             * 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
             *    there, and
             * 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
             *    the original blog ID.
             *
             * Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
             * (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
             * as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
             * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
             */
            if (defined('BLOGUPLOADDIR')) {
                $dir = untrailingslashit(BLOGUPLOADDIR);
            } else {
                $dir = ABSPATH . UPLOADS;
            }
            $url = trailingslashit($siteurl) . 'files';
        }
    }
    $uploads = array('basedir' => $dir, 'baseurl' => $url);
    return $uploads;
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:70,代码来源:sp-site-support-functions.php


示例9: wp_upload_dir

/**
 * Get an array containing the current upload directory's path and url.
 *
 * Checks the 'upload_path' option, which should be from the web root folder,
 * and if it isn't empty it will be used. If it is empty, then the path will be
 * 'WP_CONTENT_DIR/uploads'. If the 'UPLOADS' constant is defined, then it will
 * override the 'upload_path' option and 'WP_CONTENT_DIR/uploads' path.
 *
 * The upload URL path is set either by the 'upload_url_path' option or by using
 * the 'WP_CONTENT_URL' constant and appending '/uploads' to the path.
 *
 * If the 'uploads_use_yearmonth_folders' is set to true (checkbox if checked in
 * the administration settings panel), then the time will be used. The format
 * will be year first and then month.
 *
 * If the path couldn't be created, then an error will be returned with the key
 * 'error' containing the error message. The error suggests that the parent
 * directory is not writable by the server.
 *
 * On success, the returned array will have many indices:
 * 'path' - base directory and sub directory or full path to upload directory.
 * 'url' - base url and sub directory or absolute URL to upload directory.
 * 'subdir' - sub directory if uploads use year/month folders option is on.
 * 'basedir' - path without subdir.
 * 'baseurl' - URL path without subdir.
 * 'error' - set to false.
 *
 * @since 2.0.0
 *
 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
 * @return array See above for description.
 */
function wp_upload_dir($time = null)
{
    $siteurl = get_option('siteurl');
    $upload_path = trim(get_option('upload_path'));
    if (empty($upload_path) || 'wp-content/uploads' == $upload_path) {
        $dir = WP_CONTENT_DIR . '/uploads';
    } elseif (0 !== strpos($upload_path, ABSPATH)) {
        // $dir is absolute, $upload_path is (maybe) relative to ABSPATH
        $dir = path_join(ABSPATH, $upload_path);
    } else {
        $dir = $upload_path;
    }
    if (!($url = get_option('upload_url_path'))) {
        if (empty($upload_path) || 'wp-content/uploads' == $upload_path || $upload_path == $dir) {
            $url = WP_CONTENT_URL . '/uploads';
        } else {
            $url = trailingslashit($siteurl) . $upload_path;
        }
    }
    /*
     * Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
     * We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
     */
    if (defined('UPLOADS') && !(is_multisite() && get_site_option('ms_files_rewriting'))) {
        $dir = ABSPATH . UPLOADS;
        $url = trailingslashit($siteurl) . UPLOADS;
    }
    // If multisite (and if not the main site in a post-MU network)
    if (is_multisite() && !(is_main_network() && is_main_site() && defined('MULTISITE'))) {
        if (!get_site_option('ms_files_rewriting')) {
            /*
             * If ms-files rewriting is disabled (networks created post-3.5), it is fairly
             * straightforward: Append sites/%d if we're not on the main site (for post-MU
             * networks). (The extra directory prevents a four-digit ID from conflicting with
             * a year-based directory for the main site. But if a MU-era network has disabled
             * ms-files rewriting manually, they don't need the extra directory, as they never
             * had wp-content/uploads for the main site.)
             */
            if (defined('MULTISITE')) {
                $ms_dir = '/sites/' . get_current_blog_id();
            } else {
                $ms_dir = '/' . get_current_blog_id();
            }
            $dir .= $ms_dir;
            $url .= $ms_dir;
        } elseif (defined('UPLOADS') && !ms_is_switched()) {
            /*
             * Handle the old-form ms-files.php rewriting if the network still has that enabled.
             * When ms-files rewriting is enabled, then we only listen to UPLOADS when:
             * 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
             *    there, and
             * 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
             *    the original blog ID.
             *
             * Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
             * (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
             * as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
             * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
             */
            if (defined('BLOGUPLOADDIR')) {
                $dir = untrailingslashit(BLOGUPLOADDIR);
            } else {
                $dir = ABSPATH . UPLOADS;
            }
            $url = trailingslashit($siteurl) . 'files';
        }
    }
    $basedir = $dir;
//.........这里部分代码省略.........
开发者ID:hpilevar,项目名称:WordPress,代码行数:101,代码来源:functions.php


示例10: run

 /**
  * Kicks off the background update process, looping through all pending updates.
  *
  * @since 3.7.0
  */
 public function run()
 {
     global $wpdb, $wp_version;
     if ($this->is_disabled()) {
         return;
     }
     if (!is_main_network() || !is_main_site()) {
         return;
     }
     $lock_name = 'auto_updater.lock';
     // Try to lock
     $lock_result = $wpdb->query($wpdb->prepare("INSERT IGNORE INTO `{$wpdb->options}` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time()));
     if (!$lock_result) {
         $lock_result = get_option($lock_name);
         // If we couldn't create a lock, and there isn't a lock, bail
         if (!$lock_result) {
             return;
         }
         // Check to see if the lock is still valid
         if ($lock_result > time() - HOUR_IN_SECONDS) {
             return;
         }
     }
     // Update the lock, as by this point we've definitely got a lock, just need to fire the actions
     update_option($lock_name, time());
     // Don't automatically run these thins, as we'll handle it ourselves
     remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20);
     remove_action('upgrader_process_complete', 'wp_version_check');
     remove_action('upgrader_process_complete', 'wp_update_plugins');
     remove_action('upgrader_process_complete', 'wp_update_themes');
     // Next, Plugins
     wp_update_plugins();
     // Check for Plugin updates
     $plugin_updates = get_site_transient('update_plugins');
     if ($plugin_updates && !empty($plugin_updates->response)) {
         foreach ($plugin_updates->response as $plugin) {
             $this->update('plugin', $plugin);
         }
         // Force refresh of plugin update information
         wp_clean_plugins_cache();
     }
     // Next, those themes we all love
     wp_update_themes();
     // Check for Theme updates
     $theme_updates = get_site_transient('update_themes');
     if ($theme_updates && !empty($theme_updates->response)) {
         foreach ($theme_updates->response as $theme) {
             $this->update('theme', (object) $theme);
         }
         // Force refresh of theme update information
         wp_clean_themes_cache();
     }
     // Next, Process any core update
     wp_version_check();
     // Check for Core updates
     $core_update = find_core_auto_update();
     if ($core_update) {
         $this->update('core', $core_update);
     }
     // Clean up, and check for any pending translations
     // (Core_Upgrader checks for core updates)
     $theme_stats = array();
     if (isset($this->update_results['theme'])) {
         foreach ($this->update_results['theme'] as $upgrade) {
             $theme_stats[$upgrade->item->theme] = true === $upgrade->result;
         }
     }
     wp_update_themes($theme_stats);
     // Check for Theme updates
     $plugin_stats = array();
     if (isset($this->update_results['plugin'])) {
         foreach ($this->update_results['plugin'] as $upgrade) {
             $plugin_stats[$upgrade->item->plugin] = true === $upgrade->result;
         }
     }
     wp_update_plugins($plugin_stats);
     // Check for Plugin updates
     // Finally, Process any new translations
     $language_updates = wp_get_translation_updates();
     if ($language_updates) {
         foreach ($language_updates as $update) {
             $this->update('translation', $update);
         }
         // Clear existing caches
         wp_clean_update_cache();
         wp_version_check();
         // check for Core updates
         wp_update_themes();
         // Check for Theme updates
         wp_update_plugins();
         // Check for Plugin updates
     }
     // Send debugging email to all development installs.
     if (!empty($this->update_results)) {
         $development_version = false !== strpos($wp_version, '-');
//.........这里部分代码省略.........
开发者ID:sunyang3721,项目名称:wp-for-sae,代码行数:101,代码来源:class-wp-upgrader.php


示例11: can_delete

 /**
  * Can the current user delete this network?
  *
  * @since 2.0.0
  *
  * @param WP_Network $network
  *
  * @return boolean
  */
 private function can_delete($network)
 {
     // Bail if main network
     if (is_main_network($network->id)) {
         return false;
     }
     // Can't delete current network
     if (get_current_network_id() === $network->id) {
         return false;
     }
     // Bail if user cannot delete network
     if (!current_user_can('delete_network', $network->id)) {
         return false;
     }
     // Assume true (if you're already on this screen)
     return true;
 }
开发者ID:stuttter,项目名称:wp-multi-network,代码行数:26,代码来源:class-wp-ms-networks-list-table.php


示例12: psts_note

	/**
	 * Add Custom messages in admin footer
	 *
	 */
	function psts_note() {
		global $current_screen;
		//Add for sites screen
		if ( is_main_network() && 'sites-network' == $current_screen->base ) {
			?>
			<p><strong>&#42 </strong>
			=> <?php _e( "The original Level doesn't exist, it might have been removed.", 'psts' ); ?></p><?php
		}
	}
开发者ID:vilmark,项目名称:vilmark_main,代码行数:13,代码来源:pro-sites.php


示例13: pluginRun

 public function pluginRun()
 {
     @ini_set('memory_limit', '256M');
     require_once Xpandbuddy::$pathName . '/library/Cron.php';
     require_once Xpandbuddy::$pathName . '/library/Sender.php';
     //dropbox
     add_action('wp_ajax_get_authorization_code', array('Xpandbuddy_Sender', 'getAuthorizationCode'));
     add_action('wp_ajax_get_google_code', array('Xpandbuddy_Sender', 'getGoogleCode'));
     add_action('wp_ajax_get_google_token', array('Xpandbuddy_Sender', 'getGoogleToken'));
     add_action('wp_ajax_get_access_token', array('Xpandbuddy_Sender', 'getAccessToken'));
     add_action('wp_ajax_check_backup_size', array('Xpandbuddy', 'checkBackupSize'));
     add_action('wp_ajax_activate_multiusers', array('Xpandbuddy', 'activateMultiusers'));
     add_action('wp_ajax_submit_clone', array('Xpandbuddy', 'runStepByStepBackup'));
     add_action('wp_ajax_send_backup', array('Xpandbuddy_Sender', 'sendBackupFileAction'));
     add_action('wp_ajax_set_start_date', array('Xpandbuddy', 'setStartDate'));
     add_action('wp_ajax_get_local_dirs', array('Xpandbuddy_Sender', 'ajaxGetDirsTree'));
     add_action('wp_ajax_ftp_connect', array('Xpandbuddy_Sender', 'getFtpConnect'));
     if (is_admin() && isset($_GET['page']) && strpos($_GET['page'], 'xpandbuddy') !== false && isset($_GET['code'])) {
         echo 'This is Authorization Code: ' . $_GET['code'];
         exit;
     }
     //end dropbox
     /*/ Update plugin {
     		global $wp_filter;
     		$priority=30;
     		if( isset( $wp_filter['plugins_api'] ) ){
     			foreach( array_keys( $wp_filter['plugins_api'] ) as $_priority ){
     				if( $_priority >= $priority ){
     					$priority=$_priority+1;
     				}
     			}
     		}
     		add_filter('pre_set_site_transient_update_plugins', array( 'Xpandbuddy', 'updatePlugin' ) );
     		add_filter('plugins_api', array( 'Xpandbuddy', 'pluginApiCall' ), $priority, 3);
     		self::pluginUpdateCall();
     		// } Update plugin */
     require_once Xpandbuddy::$pathName . '/library/Options.php';
     $_arrayOptions = Xpandbuddy_Options::get();
     if (!isset($_arrayOptions['homeurl_hash']) || $_arrayOptions['homeurl_hash'] != md5(home_url())) {
         add_action('init', array('Xpandbuddy', 'updateRewrite'));
         $_arrayOptions['homeurl_hash'] = md5(home_url());
         Xpandbuddy_Options::set($_arrayOptions);
     }
     self::getJson();
     if (is_multisite()) {
         if (isset($_arrayOptions['flg_active_miltisite']) && $_arrayOptions['flg_active_miltisite'] == true && is_main_network()) {
             add_action('admin_menu', array('Xpandbuddy', 'registerMenu'));
         }
         if (is_main_network()) {
             add_action('network_admin_menu', array('Xpandbuddy', 'registerMenu'));
         }
         //echo get_current_blog_id()." ".(int)is_main_site()." ".(int)is_main_network();
     } else {
         add_action('admin_menu', array('Xpandbuddy', 'registerMenu'));
     }
     // WP-CRON {
     add_filter('cron_schedules', array('Xpandbuddy_Cron', 'schedules'));
     if (!wp_next_scheduled('blogcloncron_event')) {
         wp_schedule_event(time(), 'blogcloncron_update', 'blogcloncron_event');
     }
     add_action('blogcloncron_event', array('Xpandbuddy_Cron', 'run'));
     // }
     if (!is_admin() || is_admin() && (isset($_GET['page']) && strpos($_GET['page'], 'xpandbuddy') === false || !isset($_GET['page']))) {
         return;
     }
     add_action('init', array('Xpandbuddy', 'disableEmojis'));
     self::get();
     if (!isset(self::$_options['db_version'])) {
         self::install();
     } else {
         self::updateDb();
     }
     add_action('admin_enqueue_scripts', array('Xpandbuddy', 'initialize'));
 }
开发者ID:themexpand,项目名称:xpand-buddy,代码行数:74,代码来源:Plugin.php


示例14: pre_schema_upgrade

/**
 * Runs before the schema is upgraded.
 *
 * @since 2.9.0
 */
function pre_schema_upgrade()
{
    global $wp_current_db_version, $wpdb;
    // Unused in Project Nami.
    // To be removed.
    // Multisite schema upgrades.
    if ($wp_current_db_version < 25448 && is_multisite() && !defined('DO_NOT_UPGRADE_GLOBAL_TABLES') && is_main_network()) {
        // Upgrade verions prior to 3.7
        if ($wp_current_db_version < 25179) {
            // New primary key for signups.
            $wpdb->query("ALTER TABLE {$wpdb->signups} ADD signup_id INT NOT NULL IDENTITY(1,1)");
        }
    }
    if ($wp_current_db_version < 30133) {
        // dbDelta() can recreate but can't drop the index.
        $wpdb->query("ALTER TABLE {$wpdb->terms} DROP INDEX slug");
    }
}
开发者ID:remonlam,项目名称:projectnami,代码行数:23,代码来源:upgrade.php


示例15: get_dynamic_prefix

 /**
  * Get the prefix path for the files
  *
  * @param string $time
  *
  * @return string
  */
 function get_dynamic_prefix($time = null)
 {
     $prefix = '';
     if ($this->get_setting('use-yearmonth-folders')) {
         $uploads = wp_upload_dir($time);
         $prefix = str_replace($this->get_base_upload_path(), '', $uploads['path']);
     }
     // support legacy MS installs (<3.5 since upgraded) for subsites
     if (is_multisite() && !(is_main_network() && is_main_site()) && false === strpos($prefix, 'sites/')) {
         $details = get_blog_details(get_current_blog_id());
         $legacy_ms_prefix = 'sites/' . $details->blog_id . '/';
         $legacy_ms_prefix = apply_filters('as3cf_legacy_ms_subsite_prefix', $legacy_ms_prefix, $details);
         $prefix = '/' . trailingslashit(ltrim($legacy_ms_prefix, '/')) . ltrim($prefix, '/');
     }
     return $prefix;
 }
开发者ID:sohel4r,项目名称:wordpress_4_1_1,代码行数:23,代码来源:amazon-s3-and-cloudfront.php


示例16: get_possible_failures

 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


示例17: upgrade_network

/**
 * Executes network-level upgrade routines.
 *
 * @since 0.0.1
 *
 * @global int   $hq_current_db_version
 * @global hqdb  $hqdb
 */
function upgrade_network()
{
    global $hq_current_db_version, $hqdb;
    // Always.
    if (is_main_network()) {
        /*
         * Deletes all expired transients. The multi-table delete syntax is used
         * to delete the transient record from table a, and the corresponding
         * transient_timeout record from table b.
         */
        $time = time();
        $sql = "DELETE a, b FROM {$hqdb->sitemeta} a, {$hqdb->sitemeta} b\n\t\t\tWHERE a.meta_key LIKE %s\n\t\t\tAND a.meta_key NOT LIKE %s\n\t\t\tAND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) )\n\t\t\tAND b.meta_value < %d";
        $hqdb->query($hqdb->prepare($sql, $hqdb->esc_like('_site_transient_') . '%', $hqdb->esc_like('_site_transient_timeout_') . '%', $time));
    }
    // 2.8.
    if ($hq_current_db_version < 11549) {
        $hqmu_sitewide_plugins = get_site_option('hqmu_sitewide_plugins');
        $active_sitewide_plugins = get_site_option('active_sitewide_plugins');
        if ($hqmu_sitewide_plugins) {
            if (!$active_sitewide_plugins) {
                $sitewide_plugins = (array) $hqmu_sitewide_plugins;
            } else {
                $sitewide_plugins = array_merge((array) $active_sitewide_plugins, (array) $hqmu_sitewide_plugins);
            }
            update_site_option('active_sitewide_plugins', $sitewide_plugins);
        }
        delete_site_option('hqmu_sitewide_plugins');
        delete_site_option('deactivated_sitewide_plugins');
        $start = 0;
        while ($rows = $hqdb->get_results("SELECT meta_key, meta_value FROM {$hqdb->sitemeta} ORDER BY meta_id LIMIT {$start}, 20")) {
            foreach ($rows as $row) {
                $value = $row->meta_value;
                if (!@unserialize($value)) {
                    $value = stripslashes($value);
                }
                if ($value !== $row->meta_value) {
                    update_site_option($row->meta_key, $value);
                }
            }
            $start += 20;
        }
    }
    // 3.0
    if ($hq_current_db_version < 13576) {
        update_site_option('global_terms_enabled', '1');
    }
    // 3.3
    if ($hq_current_db_version < 19390) {
        update_site_option('initial_db_version', $hq_current_db_version);
    }
    if ($hq_current_db_version < 19470) {
        if (false === get_site_option('active_sitewide_plugins')) {
            update_site_option('active_sitewide_plugins', array());
        }
    }
    // 3.4
    if ($hq_current_db_version < 20148) {
        // 'allowedthemes' keys things by stylesheet. 'allowed_themes' keyed things by name.
        $allowedthemes = get_site_option('allowedthemes');
        $allowed_themes = get_site_option('allowed_themes');
        if (false === $allowedthemes && is_array($allowed_themes) && $allowed_themes) {
            $converted = array();
            $themes = hq_get_themes();
            foreach ($themes as $stylesheet => $theme_data) {
                if (isset($allowed_themes[$theme_data->get('Name')])) {
                    $converted[$stylesheet] = true;
                }
            }
            update_site_option('allowedthemes', $converted);
            delete_site_option('allowed_themes');
        }
    }
    // 3.5
    if ($hq_current_db_version < 21823) {
        update_site_option('ms_files_rewriting', '1');
    }
    // 3.5.2
    if ($hq_current_db_version < 24448) {
        $illegal_names = get_site_option('illegal_names');
        if (is_array($illegal_names) && count($illegal_names) === 1) {
            $illegal_name = reset($illegal_names);
            $illegal_names = explode(' ', $illegal_name);
            update_site_option('illegal_names', $illegal_names);
        }
    }
    // 4.2
    if ($hq_current_db_version < 31351 && $hqdb->charset === 'utf8mb4') {
        if (hq_should_upgrade_global_tables()) {
            $hqdb->query("ALTER TABLE {$hqdb->usermeta} DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
            $hqdb->query("ALTER TABLE {$hqdb->site} DROP INDEX domain, ADD INDEX domain(domain(140),path(51))");
            $hqdb->query("ALTER TABLE {$hqdb->sitemeta} DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
            $hqdb->query("ALTER TABLE {$hqdb->signups} DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))");
//.........这里部分代码省略.........
开发者ID:gcorral,项目名称:hivequeen,代码行数:101,代码来源:upgrade.php


示例18: pre_schema_upgrade

/**
 * Runs before the schema is upgraded.
 *
 * @since 2.9.0
 */
function pre_schema_upgrade()
{
    global $wp_current_db_version, $wpdb;
    // Upgrade versions prior to 2.9
    if ($wp_current_db_version < 11557) {
        // Delete duplicate options. Keep the option with the highest option_id.
        $wpdb->query("DELETE o1 FROM {$wpdb->options} AS o1 JOIN {$wpdb->options} AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id");
        // Drop the old primary key and add the new.
        $wpdb->query("ALTER TABLE {$wpdb->options} DROP PRIMARY KEY, ADD PRIMARY KEY(option_id)");
        // Drop the old option_name index. dbDelta() doesn't do the drop.
        $wpdb->query("ALTER TABLE {$wpdb->options} DROP INDEX option_name");
    }
    // Multisite schema upgrades.
    if ($wp_current_db_version < 25448 && is_multisite() && !defined('DO_NOT_UPGRADE_GLOBAL_TABLES') && is_main_network()) {
        // Upgrade verions prior to 3.7
        if ($wp_current_db_version < 25179) {
            // New primary key for signups.
            $wpdb->query("ALTER TABLE {$wpdb->signups} ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST");
            $wpdb->query("ALTER TABLE {$wpdb->signups} DROP INDEX domain");
        }
        if ($wp_current_db_version < 25448) {
            // Convert archived from enum to tinyint.
            $wpdb->query("ALTER TABLE {$wpdb->blogs} CHANGE COLUMN archived archived varchar(1) NOT NULL default '0'");
            $wpdb->query("ALTER TABLE {$wpdb->blogs} CHANGE COLUMN archived archived tinyint(2) NOT NULL default 0");
        }
    }
}
开发者ID:Telemedellin,项目名称:feriadelasfloresmedellin,代码行数:32,代码来源:upgrade.php


示例19: run

 /**
  * Kicks off the background update process, looping through all pending updates.
  *
  * @since 3.7.0
  * @access public
  *
  * @global wpdb   $wpdb
  * @global string $wp_version
  */
 public function run()
 {
     global $wpdb, $wp_version;
     if ($this->is_disabled()) {
         return;
     }
     if (!is_main_network() || !is_main_site()) {
         return;
     }
     if (!$this->create_lock('auto_updater')) {
         return;
     }
     // Don't automatically run these thins, as we'll handle it ourselves
     remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20);
     remove_action('upgrader_process_complete', 'wp_version_check');
     remove_action('upgrader_process_complete', 'wp_update_plugins');
     remove_action('upgrader_process_complete', 'wp_update_themes');
     // Next, Plugins
     wp_update_plugins();
     // Check for Plugin updates
     $plugin_updates = get_site_transient('update_plugins');
     if ($plugin_updates && !empty($plugin_updates->response)) {
         foreach ($plugin_updates->response as $plugin) {
             $this->update('plugin', $plugin);
         }
         // Force refresh of plugin update information
         wp_clean_plugins_cache();
     }
     // Next, those themes we all love
     wp_update_themes();
     // Check for Theme updates
     $theme_updates = get_site_transient('update_themes');
     if ($theme_updates && !empty($theme_updates->response)) {
         foreach ($theme_updates->response as $theme) {
             $this->update('theme', (object) $theme);
         }
         // Force refresh of theme update information
         wp_clean_themes_cache();
     }
     // Next, Process any core update
     wp_version_check();
     // Check for Core updates
     $core_update = find_core_auto_update();
     if ($core_update) {
         $this->update('core', $core_update);
     }
     // Clean up, and check for any pending translations
     // (Core_Upgrader checks for core updates)
     $theme_stats = array();
     if (isset($this->update_results['theme'])) {
         foreach ($this->update_results['theme'] as $upgrade) {
             $theme_stats[$upgrade->item->theme] = true === $upgrade->result;
         }
     }
     wp_update_themes($theme_stats);
     // Check for Theme updates
     $plugin_stats = array();
     if (isset($this->update_results['plugin'])) {
         foreach ($this-&g 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_main_query函数代码示例发布时间:2022-05-15
下一篇:
PHP is_macaddr函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap