本文整理汇总了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);
}
示例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;
示例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
}
}
示例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());
}
}
}
}
示例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();
}
}