Ticket #3155: hotfix-20060921-1928.diff
File hotfix-20060921-1928.diff, 32.4 KB (added by , 19 years ago) |
---|
-
var/www/wp-dev/trunk/wp-includes/post-template.php
32 32 $post = &get_post($id); 33 33 34 34 $title = $post->post_title; 35 if ( !empty($post->post_password) ) 35 if ( !empty($post->post_password) ) { 36 36 $title = sprintf(__('Protected: %s'), $title); 37 else if ( 'private' == $post->post_status ) 38 $title = sprintf(__('Private: %s'), $title); 39 37 } else if (isset($post->post_status)) { 38 if ( 'private' == $post->post_status ) { 39 $title = sprintf(__('Private: %s'), $title); 40 } 41 } 40 42 return $title; 41 43 } 42 44 -
var/www/wp-dev/trunk/wp-includes/bookmark.php
97 97 $recently_updated_test = ''; 98 98 } 99 99 100 $get_updated = ''; 100 101 if ($show_updated) { 101 102 $get_updated = ", UNIX_TIMESTAMP(link_updated) AS link_updated_f "; 102 103 } -
var/www/wp-dev/trunk/wp-includes/query.php
347 347 return; 348 348 } 349 349 350 if ('404' == $qv['error']) { 351 $this->is_404 = true; 352 if ( !empty($query) ) { 353 do_action_ref_array('parse_query', array(&$this)); 350 if (isset($qv['error'])) { 351 if ('404' == $qv['error']) { 352 $this->is_404 = true; 353 if ( !empty($query) ) { 354 do_action_ref_array('parse_query', array(&$this)); 355 } 356 return; 354 357 } 355 return;356 358 } 357 359 358 $qv['m'] = (int) $qv['m']; 359 $qv['p'] = (int) $qv['p']; 360 if (isset($qv['m'])) { 361 $qv['m'] = (int) $qv['m']; 362 } else { 363 $qv['m'] = 0; 364 } 365 if (isset($qv['p'])) { 366 $qv['p'] = (int) $qv['p']; 367 } else { 368 $qv['p'] = 0; 369 } 360 370 361 371 // Compat. Map subpost to attachment. 362 if ( '' != $qv['subpost'] ) 363 $qv['attachment'] = $qv['subpost']; 364 if ( '' != $qv['subpost_id'] ) 365 $qv['attachment_id'] = $qv['subpost_id']; 372 if (isset($qv['subpost'])) { 373 if ( '' != $qv['subpost'] ) 374 $qv['attachment'] = $qv['subpost']; 375 } 376 if (isset($qv['subpost_id'])) { 377 if ( '' != $qv['subpost_id'] ) 378 $qv['attachment_id'] = $qv['subpost_id']; 379 } 366 380 381 // Fixes a lot warnings 382 if (!isset($qv['attachment_id'])) $qv['attachment_id'] = ''; 383 if (!isset($qv['attachment'])) $qv['attachment'] = ''; 384 if (!isset($qv['name'])) $qv['name'] = ''; 385 if (!isset($qv['hour'])) $qv['hour'] = ''; 386 if (!isset($qv['static'])) $qv['static'] = ''; 387 if (!isset($qv['pagename'])) $qv['pagename'] = ''; 388 if (!isset($qv['page_id'])) $qv['page_id'] = ''; 389 367 390 if ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) { 368 391 $this->is_single = true; 369 392 $this->is_attachment = true; … … 381 404 } elseif (!empty($qv['s'])) { 382 405 $this->is_search = true; 383 406 } else { 384 // Look for archive queries. Dates, categories, authors.407 // Look for archive queries. Dates, categories, authors. 385 408 409 // Fixes a lot warnings 410 if (!isset($qv['second'])) $qv['second'] = ''; 411 if (!isset($qv['minute'])) $qv['minute'] = ''; 412 if (!isset($qv['day'])) $qv['day'] = ''; 413 if (!isset($qv['monthnum'])) $qv['monthnum'] = ''; 414 if (!isset($qv['year'])) $qv['year'] = ''; 415 if (!isset($qv['w'])) $qv['w'] = ''; 416 if (!isset($qv['category_name'])) $qv['category_name'] = ''; 417 if (!isset($qv['author_name'])) $qv['author_name'] = ''; 418 if (!isset($qv['show_post_type'])) $qv['show_post_type'] = ''; 419 386 420 if ( (int) $qv['second']) { 387 421 $this->is_time = true; 388 422 $this->is_date = true; … … 465 499 } 466 500 } 467 501 502 // Fixes some warnings 503 if (!isset($qv['feed'])) $qv['feed'] = ''; 504 if (!isset($qv['tb'])) $qv['tb'] = ''; 505 if (!isset($qv['paged'])) $qv['paged'] = ''; 506 if (!isset($qv['comments_popup'])) $qv['comments_popup'] = ''; 507 if (!isset($qv['preview'])) $qv['preview'] = ''; 508 468 509 if ('' != $qv['feed']) { 469 510 $this->is_feed = true; 470 511 } … … 587 628 $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours)); 588 629 $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; 589 630 631 // Fixes a lot warnings 632 if (!isset($q['m'])) $q['m'] = ''; 633 if (!isset($q['w'])) $q['w'] = ''; 634 if (!isset($q['p'])) $q['p'] = ''; 635 if (!isset($q['hour'])) $q['hour'] = ''; 636 if (!isset($q['minute'])) $q['minute'] = ''; 637 if (!isset($q['second'])) $q['second'] = ''; 638 if (!isset($q['year'])) $q['year'] = ''; 639 if (!isset($q['monthnum'])) $q['monthnum'] = ''; 640 if (!isset($q['day'])) $q['day'] = ''; 641 if (!isset($q['subpost'])) $q['subpost'] = ''; 642 if (!isset($q['subpost_id'])) $q['subpost_id'] = ''; 643 if (!isset($q['name'])) $q['name'] = ''; 644 if (!isset($q['pagename'])) $q['pagename'] = ''; 645 if (!isset($q['attachment'])) $q['attachment'] = ''; 646 if (!isset($q['comments_popup'])) $q['comments_popup'] = ''; 647 if (!isset($q['attachment_id'])) $q['attachment_id'] = ''; 648 if (!isset($q['page_id'])) $q['page_id'] = ''; 649 if (!isset($q['category_name'])) $q['category_name'] = ''; 650 if (!isset($q['author_name'])) $q['author_name'] = ''; 651 590 652 // If a month is specified in the querystring, load that month 591 653 if ( (int) $q['m'] ) { 592 654 $q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']); … … 725 787 } 726 788 } 727 789 790 // Fixes a warning 791 if (!isset($search)) $search = ''; 792 728 793 // Category stuff 729 794 730 795 if ((empty($q['cat'])) || ($q['cat'] == '0') || … … 903 968 904 969 // Paging 905 970 if (empty($q['nopaging']) && ! $this->is_single && ! $this->is_page) { 906 $page = abs(intval($q['paged']));907 if ( empty($page)) {971 // Fixes a warning 972 if (!isset($q['paged'])) { 908 973 $page = 1; 974 } else { 975 $page = abs(intval($q['paged'])); 976 if (empty($page)) { 977 $page = 1; 978 } 909 979 } 910 980 911 981 if (($q['what_to_show'] == 'posts')) { 982 // Fixes a notice 983 if (!isset($q['offset'])) $q['offset'] = ''; 984 912 985 $q['offset'] = abs(intval($q['offset'])); 913 986 if ( empty($q['offset']) ) { 914 987 $pgstrt = ''; -
var/www/wp-dev/trunk/wp-includes/link-template.php
235 235 236 236 function edit_comment_link($link = 'Edit This', $before = '', $after = '') { 237 237 global $post, $comment; 238 238 if (!isset($post->post_type)) $post->post_type = ''; 239 if (!isset($post->ID)) $post->ID = 0; 239 240 if( $post->post_type == 'page' ){ 240 241 if ( ! current_user_can('edit_page', $post->ID) ) 241 242 return; -
var/www/wp-dev/trunk/wp-includes/wp-db.php
215 215 $this->query($query); 216 216 217 217 if ( $output == OBJECT ) { 218 return $this->last_result[$y] ? $this->last_result[$y] : null; 218 if (isset($this->last_result[$y])) { 219 return $this->last_result[$y]; 220 } else { 221 return null; 222 } 219 223 } elseif ( $output == ARRAY_A ) { 220 224 return $this->last_result[$y] ? get_object_vars($this->last_result[$y]) : null; 221 225 } elseif ( $output == ARRAY_N ) { … … 289 293 } 290 294 } 291 295 296 // ================================================================== 297 // Function to close the database connection (really simple one) 298 function close() { 299 if ($this->dbh !== false) { 300 if (@mysql_close($this->dbh) === false) { 301 // Something has failed 302 die("Failed closing connection to database!"); 303 } else { 304 // Remove the link resource 305 unset($this->dbh); 306 } 307 } 308 } 309 310 // Simple getter function 311 function getNumQueries() { 312 return $this->num_queries; 313 } 314 292 315 function timer_start() { 293 316 $mtime = microtime(); 294 317 $mtime = explode(' ', $mtime); … … 363 386 } 364 387 } 365 388 366 if ( ! isset($wpdb) ) 367 $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); 368 ?> 369 No newline at end of file 389 if ( ! isset($wpdb) ) { 390 if (defined('ENABLE_SQL_CACHE')) { 391 require_once(ABSPATH . WPINC . "/wp-db_cache.php"); 392 $wpdb = new wpdb_cache(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); 393 } else { 394 $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); 395 } 396 } 397 ?> -
var/www/wp-dev/trunk/wp-includes/category.php
119 119 } 120 120 reset ( $categories ); 121 121 122 return apply_filters('get_categories', $categories, $r); 122 // Apply all filters 123 $category = apply_filters('get_categories', $categories, $r); 124 return $category; 123 125 } 124 126 125 127 // Retrieves category data given a category ID or category object. -
var/www/wp-dev/trunk/wp-includes/general-template.php
199 199 $prefix = ''; 200 200 if ( isset($title) ) 201 201 $prefix = " $sep "; 202 else 203 $title = ''; 202 204 203 205 $title = $prefix . $title; 204 206 $title = apply_filters('wp_title', $title, $sep); -
var/www/wp-dev/trunk/wp-includes/capabilities.php
354 354 $args = array_merge(array('edit_page', $user_id), $args); 355 355 return call_user_func_array('map_meta_cap', $args); 356 356 } 357 $post_author_data = get_userdata($post->post_author); 357 if (isset($post->post_author)) { 358 $post_author_data = get_userdata($post->post_author); 359 } else { 360 // Does this really fix the notice? 361 return $caps; 362 } 358 363 //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>"; 359 364 // If the user is the author... 360 365 if ($user_id == $post_author_data->ID) { -
var/www/wp-dev/trunk/wp-includes/wp-db_cache.php
1 <?php 2 3 // SQL query caching system 4 // WARNING: This code has developer status and will (currently) not work! 5 6 class wpdb_cache extends wpdb { 7 //***** Local variables ***** 8 // The relative path for all cache files with trailing slash 9 var $cache_dir = "wp-content/cache/sql/"; 10 11 // The array for all cache firectories we want to create 12 var $cache_dirs = array('a' => "arrays", 'o' => "objects", 's' => "single"); 13 14 // Number of rows while the query 15 var $query_nums = 0; 16 17 // All cached tables 18 var $hashList = array(); 19 20 // Tables which needs fetching from cache/database 21 var $waitingList = array(); 22 23 // Current extracted tables from query string 24 var $currTables = array(); 25 26 // Counter for all cache hits 27 var $cache_hits = 0; 28 29 // Here is the usage of all directories 30 // arrays - For caching simple arrays (indexed and asosiative; incl. multi-dimension arrays) 31 // objects - For caching whole objects (e.g. from mysql_fetch_object() ) 32 // single - For caching single data (one column or result of COUNT/SUM() ) 33 34 // Cache initialization part 35 function wpdb_cache ($dbuser, $dbpassword, $dbname, $dbhost) { 36 // Make the cache dir absolute 37 $this->cache_dir = ABSPATH . $this->cache_dir; 38 39 // Make all paths absolute 40 foreach ($this->cache_dirs as $type=>$dir) { 41 $this->cache_dirs[$type] = $this->cache_dir . $dir . "/"; 42 } 43 44 // Check if the main directory does exist 45 if (!is_dir($this->cache_dir)) { 46 // Try to create it 47 @mkdir($this->cache_dir); 48 @chmod($this->cache_dir, 0777); 49 50 // Re-check it 51 if (!is_dir($this->cache_dir)) { 52 // Please create it on your own 53 die("Cannot create SQL cache directory (default: wp-content/cache/sql/)! Please create and CHMOD it to 0777."); 54 } else { 55 // Create more directories... 56 foreach ($this->cache_dirs as $dir) { 57 @mkdir($this->cache_dir. $dir); @chmod($this->cache_dir . $dir , 0777); 58 } 59 60 // Create the missing .htaccess file 61 $this->create_htaccess(); 62 } 63 } elseif (!file_exists($this->cache_dir . ".htaccess")) { 64 // Create missing .htaccess file 65 $this->create_htaccess(); 66 } 67 68 // Initialize the database layer 69 parent::wpdb($dbuser, $dbpassword, $dbname, $dbhost); 70 // When you remove the line above the database will no longer be accessible 71 // and the sky turns pitch dark! ;-) 72 } 73 74 // private: create .htaccess files for securing the directories against direct calls 75 function create_htaccess() { 76 $checkDirs = $this->cache_dirs; 77 $checkDirs[] = $this->cache_dir; 78 foreach ($checkDirs as $dir) { 79 $fp = @fopen($dir . ".htaccess", 'w') or die("SQL-CACHE: Cannot create .htaccess file in $dir."); 80 fwrite($fp, "Deny from all\n"); 81 fclose($fp); 82 } 83 } 84 85 // Query the database or cache file 86 // returns number of entries 87 function query ($qstring) { 88 global $table_prefix; 89 90 // Initialize counter 91 $this->query_nums = 0; 92 93 // Create MD5 checksum of current query + WP_SECRET (we will later use this) 94 if (defined('WP_SECRET')) { 95 // WP_SECRET adds some more security to it. :-) 96 $this->currQueryHash = md5(WP_SECRET.":".$qstring); 97 } else { 98 // Bad, when WP_SECRET is not defined! 99 $this->currQueryHash = md5($qstring); 100 } 101 102 // Extract all tables from the string. The ?: is for "non-capturing subpatterns" 103 // Thanx to Hinrich Sager <hinrich [DOT] sager [AT] web [DOT] de> from the PHPUG-Hamburg 104 // to help me here. :-) 105 preg_match_all(sprintf('/(?:FROM|JOIN|,)[\s](%s[\d\w]+)/i', $table_prefix), $qstring, $this->currTables); 106 107 // Take the 2nd array, so now we have all tables together :-) 108 $this->currTables = $this->currTables[1]; 109 110 // Do we have a SELECT command where we can take the cache? 111 $test = trim(strtoupper($qstring)); 112 if (substr($test, 0, 6) == "SELECT") { 113 // A SELECT query was send. Check if every table is cached 114 // We need $this->hashList for deleting cache files when UPDATE, INSERT et cetera is queried 115 foreach ($this->currTables as $table) { 116 if (!isset($this->hashList[$table])) { 117 // The table was not found in the hash list so we add it + the query 118 $this->hashList[$table] = array($this->currQueryHash); 119 } elseif (!in_array($this->currQueryHash, $this->hashList[$table])) { 120 // The table was been added to the hash list before but not this query string 121 $this->hashList[$table][] = $this->currQueryHash; 122 } else { 123 // Count the cache hit 124 $this->cache_hits++; 125 } 126 } 127 } else { 128 // Check for existing cahes by analyzing the query string 129 //die("OK"); 130 //$this->query_nums = $this->cache_flush_by_query($qstring); 131 } 132 133 // Dummy: 134 return parent::query($qstring); 135 } 136 137 // Shuts the caching system down 138 function close() { 139 // Shall we output debugging info? (useful for development) 140 if (defined('DEBUG_SQL_CACHE')) { 141 // Output cache debug informations 142 $this->cache_debug_output(); 143 } 144 145 // Close the database connection 146 parent::close(); 147 } 148 149 // Debug informations for the cache 150 function cache_debug_output() { 151 echo "Cache hits: <strong>".$this->cache_hits."</strong><br /> 152 Database queries: <strong>".wpdb::getNumQueries()."</strong><br /> 153 <br /> 154 <pre>".print_r($this->hashList, true)."</pre>"; 155 } 156 } 157 158 ?> -
var/www/wp-dev/trunk/wp-includes/classes.php
401 401 402 402 continue; 403 403 } 404 404 405 // Fixes two notices 406 if (!isset($previous_element->$parent_field)) $previous_element->$parent_field = 0; 407 if (!isset($previous_element->$id_field)) $previous_element->$id_field = 0; 408 405 409 // Walk the tree. 406 410 if ( !empty($previous_element) && ($element->$parent_field == $previous_element->$id_field) ) { 407 411 // Previous element is my parent. Descend a level. … … 446 450 447 451 // Start the element. 448 452 if ( !$to_depth || ($depth <= $to_depth) ) { 453 // Fixes a notice 454 if (!isset($element->$id_field)) $element->$id_field = 0; 449 455 if ( $element->$id_field != 0 ) { 450 456 $cb_args = array_merge( array($output, $element, $depth - 1), $args); 451 457 $output = call_user_func_array(array(&$this, 'start_el'), $cb_args); -
var/www/wp-dev/trunk/wp-includes/rss.php
376 376 require_once( dirname(__FILE__) . '/class-snoopy.php'); 377 377 378 378 function fetch_rss ($url) { 379 // Check if disabled 380 if (defined('__DISABLE_RSS')) return false; 381 379 382 // initialize constants 380 383 init(); 381 384 -
var/www/wp-dev/trunk/wp-includes/script-loader.php
92 92 if ( isset($handle[1]) ) 93 93 $this->args[$handle[0]] = $handle[1]; 94 94 $handle = $handle[0]; 95 if (!isset($return[$handle])) $return[$handle] = true; 95 96 if ( is_null($return[$handle]) ) // Prime the return array with $handles 96 97 $return[$handle] = true; 97 98 if ( $this->scripts[$handle]->deps ) { -
var/www/wp-dev/trunk/wp-includes/bookmark-template.php
251 251 $r = array_merge($defaults, $r); 252 252 extract($r); 253 253 254 $output = ''; 254 255 foreach ( (array) $bookmarks as $bookmark ) { 255 256 if ( !isset($bookmark->recently_updated) ) 256 257 $bookmark->recently_updated = false; -
var/www/wp-dev/trunk/wp-content/element-cache.php
Property changes on: /var/www/wp-dev/trunk/wp-content ___________________________________________________________________ Name: svn:ignore + cache
1 <?php 2 // Caches small elements from many core functions 3 class Element_Cache { 4 // The big cache array for all elements 5 var $elementCache = array(); 6 7 // Current loaded element 8 var $currentElement = false; 9 var $currentGroup = false; 10 11 // The cache directory 12 var $cache_dir = "wp-content/cache/element/"; 13 14 // Flush these caches to disc 15 var $flushThis = array(); 16 17 // Do some (maybe) initialization work 18 // public 19 function Element_Cache($newCacheDir = "") { 20 // Is a new relative paht name set? 21 if (!empty($newCacheDir)) $this->cache_dir = $newCacheDir; 22 23 // Generate full-qualified path name 24 $this->cache_dir = sprintf("%s%s", ABSPATH, $this->cache_dir); 25 26 // Is our working directory up? 27 if (!is_dir($this->cache_dir)) { 28 // Try to create it 29 @mkdir($this->cache_dir); 30 @chmod($this->cache_dir, 0777); 31 32 // Re-check it 33 if (!is_dir($this->cache_dir)) { 34 // FATAL ERROR! 35 die("ELEMENT-CACHE: Cannot create my directory ".$this->cache_dir.". Please do so and CHMOD it to 0777."); 36 } else { 37 // Create .htaccess file 38 $fp = @fopen($this->cache_dir . ".htaccess", 'w') or die("Cannot create .htaccess file!"); 39 fwrite($fp, "Deny from all\n"); 40 fclose($fp); 41 } 42 } 43 } 44 45 // Check if element is in the array 46 // private 47 function isHashInArray ($elgroup, $hash) { 48 if (isset($this->elementCache[$elgroup][$hash])) { 49 // Element is already cached! 50 $this->currentElement = $this->elementCache[$elgroup][$hash]; 51 $this->currentGroup = $elgroup; 52 $this->currentHash = $hash; 53 return true; 54 } 55 return false; 56 } 57 58 // Generate a hash useable for all elements 59 // private 60 function hash($element) { 61 // Generate hash 62 return md5(WP_SECRET.$element); 63 } 64 65 // Check if element is cached or not and gets the requested element 66 // public 67 function isElementCached ($elgroup, $element) { 68 // Generate hash 69 $this->currentHash = $this->hash($element); 70 71 // Do we have it in cache? 72 $status = $this->isHashInArray($elgroup, $this->currentHash); 73 if (!$status) { 74 // Generate filename 75 $name = sprintf("%s%s.cache", $this->cache_dir, $elgroup); 76 if (file_exists($name)) { 77 // Load the cache file 78 $this->elementCache[$elgroup] = unserialize(file_get_contents($name)); 79 80 // Check again... 81 $status = $this->isHashInArray($elgroup, $this->currentHash); 82 } 83 } 84 85 // If file exists or not makes no difference the element must be inside 86 return $status; 87 } 88 89 // Add an element to the cache (does not write it to disc!) 90 // public 91 function addElement($elgroup, $element, $data) { 92 // Is the element already added? 93 if (isset($this->elementCache[$elgroup][$this->currentHash])) return; 94 95 // Do we need to flush this group to disc? 96 if (!isset($this->flushThis[$elgroup])) $this->flushThis[$elgroup] = 1; 97 98 // Add it to the memory cache 99 $this->elementCache[$elgroup][$this->currentHash] = $data; 100 } 101 102 // Get the current loaded element 103 // public 104 function getCurrentElement() { 105 // Do we have it? 106 if (!$this->currentElement) return false; // Not set! 107 108 // Okay, look it up in our array... 109 $element = false; 110 if (isset($this->elementCache[$this->currentGroup][$this->currentHash])) { 111 // Load the element 112 $element = $this->elementCache[$this->currentGroup][$this->currentHash]; 113 114 // And remove the current element 115 $this->currentElement = false; 116 $this->currentHash = false; 117 } 118 119 // Return fetched element 120 return $element; 121 } 122 123 // Flush all changed/new caches to disc 124 function flushCache() { 125 foreach ($this->flushThis as $cache=>$dummy) { 126 // Serialize the cache 127 $output = serialize($this->elementCache[$cache]); 128 // Generate file name 129 $cacheFile = sprintf("%s%s.cache", $this->cache_dir, $cache); 130 // And put it out to the file 131 file_put_contents($cacheFile, $output); 132 } 133 } 134 } 135 136 // The initializer function 137 function element_cache_init() { 138 global $elCache; 139 $elCache = new Element_Cache(); 140 141 // Shutdown function 142 register_shutdown_function('element_cache_shutdown'); 143 } 144 145 // Shutdown function 146 function element_cache_shutdown() { 147 global $elCache; 148 // Flush (maybe) added/changed caches 149 $elCache->flushCache(); 150 // Do something more... 151 } 152 153 ?> -
var/www/wp-dev/trunk/wp-content/themes/default/functions.php
73 73 add_action('admin_menu', 'kubrick_add_theme_page'); 74 74 75 75 function kubrick_add_theme_page() { 76 if (!isset($_GET['page'])) $_GET['page'] = ""; 76 77 if ( $_GET['page'] == basename(__FILE__) ) { 77 78 if ( 'save' == $_REQUEST['action'] ) { 78 79 if ( isset($_REQUEST['njform']) ) { -
var/www/wp-dev/trunk/wp-settings.php
74 74 timer_start(); 75 75 76 76 // Change to E_ALL for development/debugging 77 error_reporting(E_ALL ^ E_NOTICE);77 error_reporting(E_ALL); 78 78 79 79 // For an advanced caching plugin to use, static because you would only want one 80 80 if ( defined('WP_CACHE') ) … … 109 109 // To be removed in 2.2 110 110 $tableposts = $tableusers = $tablecategories = $tablepost2cat = $tablecomments = $tablelink2cat = $tablelinks = $tablelinkcategories = $tableoptions = $tablepostmeta = ''; 111 111 112 if ( file_exists(ABSPATH . 'wp-content/object-cache.php') ) 112 if ( file_exists(ABSPATH . 'wp-content/object-cache.php') ) { 113 113 require (ABSPATH . 'wp-content/object-cache.php'); 114 else 114 } else { 115 115 require (ABSPATH . WPINC . '/cache.php'); 116 // You have to define ENABLE_ELEMENT_CACHE in your wp-config.php to get the element cacher working: 117 // define('ENABLE_ELEMENT_CACHE', true); 118 if ( file_exists(ABSPATH . 'wp-content/element-cache.php') && defined('ENABLE_ELEMENT_CACHE') ) { 119 require (ABSPATH . 'wp-content/element-cache.php'); 120 element_cache_init(); 121 } 122 } 116 123 124 // Initialize WordPress' cache 117 125 wp_cache_init(); 118 126 119 127 require (ABSPATH . WPINC . '/functions.php'); … … 239 247 } 240 248 register_shutdown_function('shutdown_action_hook'); 241 249 250 function shutdown_database_connection() { 251 global $wpdb; 252 $wpdb->close(); 253 } 254 255 // Add a shutdown function for the database connection 256 register_shutdown_function('shutdown_database_connection'); 257 242 258 // Everything is loaded and initialized. 243 259 do_action('init'); 244 260