Make WordPress Core

Changeset 4841


Ignore:
Timestamp:
01/30/2007 06:33:48 PM (20 years ago)
Author:
markjaquith
Message:

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

Location:
branches/2.0/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/wp-includes/cache.php

    r4487 r4841  
    99        global $wp_object_cache;
    1010
     11        if ( ! isset($wp_object_cache) )
     12                return;
    1113        return $wp_object_cache->save();
    1214}
    … …  
    403405
    404406        function WP_Object_Cache() {
     407                return $this->__construct();
     408        }
     409       
     410        function __construct() {
    405411                global $blog_id;
     412
     413                register_shutdown_function(array(&$this, "__destruct"));
    406414
    407415                if (defined('DISABLE_CACHE'))
    … …  
    439447                $this->blog_id = $this->hash($blog_id);
    440448        }
     449
     450        function __destruct() {
     451                $this->save();
     452                return true;   
     453        }
    441454}
    442455?>
  • branches/2.0/wp-includes/wp-db.php

    r4620 r4841  
    4141
    4242        function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
     43                return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
     44        }
     45       
     46        function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
     47                register_shutdown_function(array(&$this, "__destruct"));
     48
    4349                $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
    4450                if (!$this->dbh) {
    … …  
    5662
    5763                $this->select($dbname);
     64        }
     65
     66        function __destruct() {
     67                return true;           
    5868        }
    5969
Note: See TracChangeset for help on using the changeset viewer.