當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wp_set_wpdb_vars函數代碼示例

本文整理匯總了PHP中wp_set_wpdb_vars函數的典型用法代碼示例。如果您正苦於以下問題:PHP wp_set_wpdb_vars函數的具體用法?PHP wp_set_wpdb_vars怎麽用?PHP wp_set_wpdb_vars使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wp_set_wpdb_vars函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sixscan_installation_manager

function sixscan_installation_manager()
{
    /* If running from partner install, the logic is a bit different */
    if (sixscan_common_is_partner_version() && sixscan_installation_partner_is_to_install() === FALSE) {
        return;
    }
    /* Before install of any kind progresses, user is shown a registration page.
    	On the first load it shows a registration screen and returns False.
    	If user clicks 'Agree' - the page reloads with &agree=yes parameter, sixscan_registration_at_install() returns True and registration continues.	
    	No data is transferred to the server until user clicks "Agree" */
    if (sixscan_registration_at_install() === FALSE) {
        return;
    }
    /* If we are waiting for user to input wpfs data */
    $tmp_key = sixscan_common_generate_random_string();
    if (sixscan_installation_wpfs_init($tmp_key) == FALSE) {
        return;
    }
    /* Run the install */
    $install_result = sixscan_installation_install($tmp_key);
    if ($install_result !== TRUE) {
        /*	If the install failed - print error message and deactivate the plugin */
        if (sixscan_common_is_partner_version() === FALSE) {
            print $install_result;
            /* Makes 6Scan not-active */
            $sixscan_plugin_name = plugin_basename(realpath(dirname(__FILE__) . "/../../6scan.php"));
            /*	This dirty patch is required because some hostings (free?) have a short sql timeout. When it timeouts, 6Scan can't
            			disable itelf, and user gets stuck in infinite deactivate loop. 
            			We can't enlarge the timeout, since it requires sql root access. We can only reconnect to the SQL.
            			This hack reconnects to SQL and deactivates the plugin */
            if (mysql_errno() != 0) {
                global $wpdb;
                $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
                wp_set_wpdb_vars();
            }
            /*	deactivate myself */
            deactivate_plugins($sixscan_plugin_name);
        } else {
            if (sixscan_installation_partner_run_first_time() === FALSE) {
                /* If we are in partner version, but not running for the first time - we can show the error */
                print $install_result;
            }
        }
    } else {
        /*	No redirects in partner version */
        if (sixscan_common_is_partner_version() === FALSE) {
            sixscan_registration_forward_to_dashboard("&sixscan_activated=1");
        }
    }
    /*	Zeroize our databse flag, so that we only try installing one time */
    if (sixscan_common_is_partner_version()) {
        sixscan_installation_partner_mark_install_tried();
    }
    /* Since registration is now on the client side, we no longer have to wait for server activation */
    sixscan_common_set_account_operational(TRUE);
}
開發者ID:nhathong1204,項目名稱:bdshungthinh,代碼行數:56,代碼來源:installation.php

示例2: wp_set_lang_dir

    WP_DEBUG ? include WP_CONTENT_DIR . '/advanced-cache.php' : @(include WP_CONTENT_DIR . '/advanced-cache.php');
}
// Define WP_LANG_DIR if not set.
wp_set_lang_dir();
// Load early WordPress files.
require ABSPATH . WPINC . '/compat.php';
require ABSPATH . WPINC . '/functions.php';
require ABSPATH . WPINC . '/class-wp.php';
require ABSPATH . WPINC . '/class-wp-error.php';
require ABSPATH . WPINC . '/plugin.php';
require ABSPATH . WPINC . '/pomo/mo.php';
// Include the wpdb class and, if present, a db.php database drop-in.
require_wp_db();
// Set the database table prefix and the format specifiers for database table columns.
$GLOBALS['table_prefix'] = $table_prefix;
wp_set_wpdb_vars();
// Start the WordPress object cache, or an external object cache if the drop-in is present.
wp_start_object_cache();
// Attach the default filters.
require ABSPATH . WPINC . '/default-filters.php';
// Initialize multisite if enabled.
if (is_multisite()) {
    require ABSPATH . WPINC . '/ms-blogs.php';
    require ABSPATH . WPINC . '/ms-settings.php';
} elseif (!defined('MULTISITE')) {
    define('MULTISITE', false);
}
register_shutdown_function('shutdown_action_hook');
// Stop most of WordPress from being loaded if we just want the basics.
if (SHORTINIT) {
    return false;
開發者ID:openify,項目名稱:wordpress-composer,代碼行數:31,代碼來源:wp-settings.php

示例3: wpdb_reconnect

 function wpdb_reconnect()
 {
     global $wpdb;
     $old_wpdb = $wpdb;
     //Reconnect to avoid timeout problem after ZIP files
     if (class_exists('wpdb') && function_exists('wp_set_wpdb_vars')) {
         if ($wpdb->use_mysqli) {
             @mysqli_close($wpdb->dbh);
         } else {
             if (function_exists('mysql_close')) {
                 @mysql_close($wpdb->dbh);
             }
         }
         $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
         wp_set_wpdb_vars();
         $wpdb->options = $old_wpdb->options;
         //fix for multi site full backup
     }
 }
開發者ID:Trideon,項目名稱:gigolo,代碼行數:19,代碼來源:backup.class.multicall.php

示例4: wpdb_reconnect

 /**
  * Reconnects to database to avoid timeout problem after ZIP files.
  *
  * @return void
  */
 public function wpdb_reconnect()
 {
     /** @var wpdb $wpdb */
     global $wpdb;
     if (is_callable(array($wpdb, 'check_connection'))) {
         $wpdb->check_connection();
         return;
     }
     if (class_exists('wpdb') && function_exists('wp_set_wpdb_vars')) {
         @mysql_close($wpdb->dbh);
         /** @handled class */
         $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
         wp_set_wpdb_vars();
         if (function_exists('is_multisite')) {
             if (is_multisite()) {
                 $wpdb->set_blog_id(get_current_blog_id());
             }
         }
     }
 }
開發者ID:jimrucinski,項目名稱:Vine,代碼行數:25,代碼來源:Backup.php

示例5: wpdb_reconnect

 /**
  * Reconnects to database to avoid timeout problem after ZIP files.
  *
  * @return void
  */
 function wpdb_reconnect()
 {
     global $wpdb;
     if (class_exists('wpdb') && function_exists('wp_set_wpdb_vars')) {
         @mysql_close($wpdb->dbh);
         $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
         wp_set_wpdb_vars();
     }
 }
開發者ID:jeanpage,項目名稱:ca_learn,代碼行數:14,代碼來源:backup.class.php


注:本文中的wp_set_wpdb_vars函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。