WordPress.org

Make WordPress Core

Changeset 4686


Ignore:
Timestamp:
01/06/2007 11:36:51 PM (13 years ago)
Author:
ryan
Message:

Fiddle with object destruction and shutdown. Curses upon php 5.2. fixes #3354

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/cache.php

    r4495 r4686  
    99    global $wp_object_cache;
    1010
     11    if ( ! isset($wp_object_cache) )
     12        return;
    1113    return $wp_object_cache->save();
    1214}
     
    393395
    394396    function WP_Object_Cache() {
     397        return $this->__construct();
     398    }
     399   
     400    function __construct() {
    395401        global $blog_id;
     402
     403        register_shutdown_function(array(&$this, "__destruct"));
    396404
    397405        if (defined('DISABLE_CACHE'))
     
    429437        $this->blog_id = $this->hash($blog_id);
    430438    }
     439
     440    function __destruct() {
     441        $this->save();
     442        return true;   
     443    }
    431444}
    432445?>
  • trunk/wp-includes/wp-db.php

    r4619 r4686  
    4545     */
    4646    function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
     47        return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
     48    }
     49   
     50    function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
     51        register_shutdown_function(array(&$this, "__destruct"));
     52
    4753        $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
    4854        if (!$this->dbh) {
     
    6066
    6167        $this->select($dbname);
     68    }
     69
     70    function __destruct() {
     71        return true;       
    6272    }
    6373
Note: See TracChangeset for help on using the changeset viewer.