mirror of
https://github.com/WordPress/WordPress.git
synced 2024-06-22 21:04:57 +02:00
Fiddle with object destruction and shutdown. Curses upon php 5.2. fixes #3354
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
33ac749c08
commit
55a996f29d
|
@ -8,6 +8,8 @@ function wp_cache_add($key, $data, $flag = '', $expire = 0) {
|
||||||
function wp_cache_close() {
|
function wp_cache_close() {
|
||||||
global $wp_object_cache;
|
global $wp_object_cache;
|
||||||
|
|
||||||
|
if ( ! isset($wp_object_cache) )
|
||||||
|
return;
|
||||||
return $wp_object_cache->save();
|
return $wp_object_cache->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,8 +404,14 @@ class WP_Object_Cache {
|
||||||
}
|
}
|
||||||
|
|
||||||
function WP_Object_Cache() {
|
function WP_Object_Cache() {
|
||||||
|
return $this->__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
global $blog_id;
|
global $blog_id;
|
||||||
|
|
||||||
|
register_shutdown_function(array(&$this, "__destruct"));
|
||||||
|
|
||||||
if (defined('DISABLE_CACHE'))
|
if (defined('DISABLE_CACHE'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -438,5 +446,10 @@ class WP_Object_Cache {
|
||||||
|
|
||||||
$this->blog_id = $this->hash($blog_id);
|
$this->blog_id = $this->hash($blog_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __destruct() {
|
||||||
|
$this->save();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -40,6 +40,12 @@ class wpdb {
|
||||||
// DB Constructor - connects to the server and selects a database
|
// DB Constructor - connects to the server and selects a database
|
||||||
|
|
||||||
function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
|
function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
|
||||||
|
return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
|
||||||
|
}
|
||||||
|
|
||||||
|
function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
|
||||||
|
register_shutdown_function(array(&$this, "__destruct"));
|
||||||
|
|
||||||
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
|
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
|
||||||
if (!$this->dbh) {
|
if (!$this->dbh) {
|
||||||
$this->bail("
|
$this->bail("
|
||||||
|
@ -57,6 +63,10 @@ class wpdb {
|
||||||
$this->select($dbname);
|
$this->select($dbname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __destruct() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
// Select a DB (if another one needs to be selected)
|
// Select a DB (if another one needs to be selected)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user