DB Cache Reloaded Fix - Version 2.3

Version Description

  • Compatible to WordPress 3.4
Download this release

Release Info

Developer ivankristianto
Plugin Icon wp plugin DB Cache Reloaded Fix
Version 2.3
Comparing to
See all releases

Code changes from version 2.2.4 to 2.3

Files changed (5) hide show
  1. db-cache-reloaded.php +4 -4
  2. db-module.php +91 -1505
  3. db.php +1 -1
  4. readme.html +6 -2
  5. readme.txt +7 -4
db-cache-reloaded.php CHANGED
@@ -4,9 +4,9 @@
4
  * Short Name: db_cache_reloaded
5
  * Description: The fastest cache engine for WordPress, that produces cache of database queries with easy configuration. (Disable and enable caching after update). Now compatible with WordPress 3.1.
6
  * Author: Ivan Kristianto
7
- * Version: 2.2.4
8
  * Requires at least: 2.7
9
- * Tested up to: 3.1.2
10
  * Tags: db cache, db cache reloaded, db cache reloaded fix
11
  * Contributors: Ivan Kristianto
12
  * WordPress URI: http://wordpress.org/extend/plugins/db-cache-reloaded-fix/
@@ -272,7 +272,7 @@ class DBCacheReloaded {
272
  echo '</p></div>';
273
  } else {
274
  echo '<div id="message" class="error"><p>';
275
- _e('Caching can\'t be activated. Please <a href="http://codex.wordpress.org/Changing_File_Permissions" target="blank">chmod 755</a> <u>wp-content/db-cache-reloaded-fix/cache</u> folder', 'db-cache-reloaded');
276
  echo '</p></div>';
277
  }
278
  }
@@ -417,7 +417,7 @@ class DBCacheReloaded {
417
  echo '</p></div>';
418
  } else {
419
  echo '<div id="message" class="error"><p>';
420
- _e('Settings can\'t be saved. Please <a href="http://codex.wordpress.org/Changing_File_Permissions" target="blank">chmod 755</a> file <u>config.ini</u>', 'db-cache-reloaded');
421
  echo '</p></div>';
422
  }
423
  }
4
  * Short Name: db_cache_reloaded
5
  * Description: The fastest cache engine for WordPress, that produces cache of database queries with easy configuration. (Disable and enable caching after update). Now compatible with WordPress 3.1.
6
  * Author: Ivan Kristianto
7
+ * Version: 2.3
8
  * Requires at least: 2.7
9
+ * Tested up to: 3.4
10
  * Tags: db cache, db cache reloaded, db cache reloaded fix
11
  * Contributors: Ivan Kristianto
12
  * WordPress URI: http://wordpress.org/extend/plugins/db-cache-reloaded-fix/
272
  echo '</p></div>';
273
  } else {
274
  echo '<div id="message" class="error"><p>';
275
+ _e('Caching can\'t be activated. Please <a href="http://codex.wordpress.org/Changing_File_Permissions" target="blank">chmod 755</a> <u>wp-content/plugins/db-cache-reloaded-fix/cache</u> folder', 'db-cache-reloaded');
276
  echo '</p></div>';
277
  }
278
  }
417
  echo '</p></div>';
418
  } else {
419
  echo '<div id="message" class="error"><p>';
420
+ _e('Settings can\'t be saved. Please <a href="http://codex.wordpress.org/Changing_File_Permissions" target="blank">chmod 755</a> file <u>db-config.ini</u>', 'db-cache-reloaded');
421
  echo '</p></div>';
422
  }
423
  }
db-module.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin URI: http://www.ivankristianto.com/web-development/programming/db-cache-reloaded-fix-for-wordpress-3-1/1784/
4
  Description: Database Caching Module provided by DB Cache Reloaded plugin With WordPress 3.1 compatibility.
5
  Author: Ivan Kristianto
6
- Version: 1.6.1 (bundled with DB Cache Reloaded Fix 2.2.4)
7
  Author URI: http://www.ivankristianto.com
8
  Text Domain: db-cache-reloaded-fix
9
  */
@@ -109,418 +109,8 @@ if ( !function_exists( 'is_multisite' ) ) { // Added in WP 3.0
109
  * @final
110
  */
111
  if ( !class_exists( 'dbrc_wpdb' ) ) {
112
- class dbrc_wpdb {
113
 
114
- /**
115
- * Whether to show SQL/DB errors
116
- *
117
- * @since 0.71
118
- * @access private
119
- * @var bool
120
- */
121
- var $show_errors = false;
122
-
123
- /**
124
- * Whether to suppress errors during the DB bootstrapping.
125
- *
126
- * @access private
127
- * @since 2.5
128
- * @var bool
129
- */
130
- var $suppress_errors = false;
131
-
132
- /**
133
- * The last error during query.
134
- *
135
- * @see get_last_error()
136
- * @since 2.5
137
- * @access private
138
- * @var string
139
- */
140
- var $last_error = '';
141
-
142
- /**
143
- * Amount of queries made
144
- *
145
- * @since 1.2.0
146
- * @access private
147
- * @var int
148
- */
149
- var $num_queries = 0;
150
-
151
- /**
152
- * Count of rows returned by previous query
153
- *
154
- * @since 1.2
155
- * @access private
156
- * @var int
157
- */
158
- var $num_rows = 0;
159
-
160
- /**
161
- * Count of affected rows by previous query
162
- *
163
- * @since 0.71
164
- * @access private
165
- * @var int
166
- */
167
- var $rows_affected = 0;
168
-
169
- /**
170
- * The ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT).
171
- *
172
- * @since 0.71
173
- * @access public
174
- * @var int
175
- */
176
- var $insert_id = 0;
177
-
178
- /**
179
- * Saved result of the last query made
180
- *
181
- * @since 1.2.0
182
- * @access private
183
- * @var array
184
- */
185
- var $last_query;
186
-
187
- /**
188
- * Results of the last query made
189
- *
190
- * @since 1.0.0
191
- * @access private
192
- * @var array|null
193
- */
194
- var $last_result;
195
-
196
- /**
197
- * Saved info on the table column
198
- *
199
- * @since 1.2.0
200
- * @access private
201
- * @var array
202
- */
203
- var $col_info;
204
-
205
- /**
206
- * Saved queries that were executed
207
- *
208
- * @since 1.5.0
209
- * @access private
210
- * @var array
211
- */
212
- var $queries;
213
-
214
- /**
215
- * WordPress table prefix
216
- *
217
- * You can set this to have multiple WordPress installations
218
- * in a single database. The second reason is for possible
219
- * security precautions.
220
- *
221
- * @since 0.71
222
- * @access private
223
- * @var string
224
- */
225
- var $prefix = '';
226
-
227
- /**
228
- * Whether the database queries are ready to start executing.
229
- *
230
- * @since 2.5.0
231
- * @access private
232
- * @var bool
233
- */
234
- var $ready = false;
235
-
236
- /**
237
- * {@internal Missing Description}}
238
- *
239
- * @since 3.0.0
240
- * @access public
241
- * @var int
242
- */
243
- var $blogid = 0;
244
-
245
- /**
246
- * {@internal Missing Description}}
247
- *
248
- * @since 3.0.0
249
- * @access public
250
- * @var int
251
- */
252
- var $siteid = 0;
253
-
254
- /**
255
- * List of WordPress per-blog tables
256
- *
257
- * @since 2.5.0
258
- * @access private
259
- * @see wpdb::tables()
260
- * @var array
261
- */
262
- var $tables = array( 'posts', 'comments', 'links', 'options', 'postmeta',
263
- 'terms', 'term_taxonomy', 'term_relationships', 'commentmeta' );
264
-
265
- /**
266
- * List of deprecated WordPress tables
267
- *
268
- * categories, post2cat, and link2cat were deprecated in 2.3.0, db version 5539
269
- *
270
- * @since 2.9.0
271
- * @access private
272
- * @see wpdb::tables()
273
- * @var array
274
- */
275
- var $old_tables = array( 'categories', 'post2cat', 'link2cat' );
276
-
277
- /**
278
- * List of WordPress global tables
279
- *
280
- * @since 3.0.0
281
- * @access private
282
- * @see wpdb::tables()
283
- * @var array
284
- */
285
- var $global_tables = array( 'users', 'usermeta' );
286
-
287
- /**
288
- * List of Multisite global tables
289
- *
290
- * @since 3.0.0
291
- * @access private
292
- * @see wpdb::tables()
293
- * @var array
294
- */
295
- var $ms_global_tables = array( 'blogs', 'signups', 'site', 'sitemeta',
296
- 'sitecategories', 'registration_log', 'blog_versions' );
297
-
298
- /**
299
- * WordPress Comments table
300
- *
301
- * @since 1.5.0
302
- * @access public
303
- * @var string
304
- */
305
- var $comments;
306
-
307
- /**
308
- * WordPress Comment Metadata table
309
- *
310
- * @since 2.9.0
311
- * @access public
312
- * @var string
313
- */
314
- var $commentmeta;
315
-
316
- /**
317
- * WordPress Links table
318
- *
319
- * @since 1.5.0
320
- * @access public
321
- * @var string
322
- */
323
- var $links;
324
-
325
- /**
326
- * WordPress Options table
327
- *
328
- * @since 1.5.0
329
- * @access public
330
- * @var string
331
- */
332
- var $options;
333
-
334
- /**
335
- * WordPress Post Metadata table
336
- *
337
- * @since 1.5.0
338
- * @access public
339
- * @var string
340
- */
341
- var $postmeta;
342
-
343
- /**
344
- * WordPress Posts table
345
- *
346
- * @since 1.5.0
347
- * @access public
348
- * @var string
349
- */
350
- var $posts;
351
-
352
- /**
353
- * WordPress Terms table
354
- *
355
- * @since 2.3.0
356
- * @access public
357
- * @var string
358
- */
359
- var $terms;
360
-
361
- /**
362
- * WordPress Term Relationships table
363
- *
364
- * @since 2.3.0
365
- * @access public
366
- * @var string
367
- */
368
- var $term_relationships;
369
-
370
- /**
371
- * WordPress Term Taxonomy table
372
- *
373
- * @since 2.3.0
374
- * @access public
375
- * @var string
376
- */
377
- var $term_taxonomy;
378
-
379
- /*
380
- * Global and Multisite tables
381
- */
382
-
383
- /**
384
- * WordPress User Metadata table
385
- *
386
- * @since 2.3.0
387
- * @access public
388
- * @var string
389
- */
390
- var $usermeta;
391
-
392
- /**
393
- * WordPress Users table
394
- *
395
- * @since 1.5.0
396
- * @access public
397
- * @var string
398
- */
399
- var $users;
400
-
401
- /**
402
- * Multisite Blogs table
403
- *
404
- * @since 3.0.0
405
- * @access public
406
- * @var string
407
- */
408
- var $blogs;
409
-
410
- /**
411
- * Multisite Blog Versions table
412
- *
413
- * @since 3.0.0
414
- * @access public
415
- * @var string
416
- */
417
- var $blog_versions;
418
-
419
- /**
420
- * Multisite Registration Log table
421
- *
422
- * @since 3.0.0
423
- * @access public
424
- * @var string
425
- */
426
- var $registration_log;
427
-
428
- /**
429
- * Multisite Signups table
430
- *
431
- * @since 3.0.0
432
- * @access public
433
- * @var string
434
- */
435
- var $signups;
436
-
437
- /**
438
- * Multisite Sites table
439
- *
440
- * @since 3.0.0
441
- * @access public
442
- * @var string
443
- */
444
- var $site;
445
-
446
- /**
447
- * Multisite Sitewide Terms table
448
- *
449
- * @since 3.0.0
450
- * @access public
451
- * @var string
452
- */
453
- var $sitecategories;
454
-
455
- /**
456
- * Multisite Site Metadata table
457
- *
458
- * @since 3.0.0
459
- * @access public
460
- * @var string
461
- */
462
- var $sitemeta;
463
-
464
- /**
465
- * Format specifiers for DB columns. Columns not listed here default to %s. Initialized during WP load.
466
- *
467
- * Keys are column names, values are format types: 'ID' => '%d'
468
- *
469
- * @since 2.8.0
470
- * @see wpdb:prepare()
471
- * @see wpdb:insert()
472
- * @see wpdb:update()
473
- * @see wp_set_wpdb_vars()
474
- * @access public
475
- * @var array
476
- */
477
- var $field_types = array();
478
-
479
- /**
480
- * Database table columns charset
481
- *
482
- * @since 2.2.0
483
- * @access public
484
- * @var string
485
- */
486
- var $charset;
487
-
488
- /**
489
- * Database table columns collate
490
- *
491
- * @since 2.2.0
492
- * @access public
493
- * @var string
494
- */
495
- var $collate;
496
-
497
- /**
498
- * Whether to use mysql_real_escape_string
499
- *
500
- * @since 2.8.0
501
- * @access public
502
- * @var bool
503
- */
504
- var $real_escape = false;
505
-
506
- /**
507
- * Database Username
508
- *
509
- * @since 2.9.0
510
- * @access private
511
- * @var string
512
- */
513
- var $dbuser;
514
-
515
- /**
516
- * A textual description of the last query/get_row/get_var call
517
- *
518
- * @since unknown
519
- * @access public
520
- * @var string
521
- */
522
- var $func_call;
523
-
524
  // --- DB Cache Start ---
525
  /**
526
  * Amount of all queries cached by DB Cache Reloaded made
@@ -561,643 +151,112 @@ class dbrc_wpdb {
561
  /**
562
  * DB Cache Reloaded DB module version
563
  *
564
- * @var int
565
- */
566
- var $dbcr_version = DBCR_DB_MODULE_VER;
567
- // --- DB Cache End ---
568
-
569
- /**
570
- * Connects to the database server and selects a database
571
- *
572
- * PHP4 compatibility layer for calling the PHP5 constructor.
573
- *
574
- * @uses wpdb::__construct() Passes parameters and returns result
575
- * @since 0.71
576
- *
577
- * @param string $dbuser MySQL database user
578
- * @param string $dbpassword MySQL database password
579
- * @param string $dbname MySQL database name
580
- * @param string $dbhost MySQL database host
581
- */
582
- function wpdb( $dbuser, $dbpassword, $dbname, $dbhost ) {
583
- if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB )
584
- $this->db_connect();
585
- return $this->__construct( $dbuser, $dbpassword, $dbname, $dbhost );
586
- }
587
-
588
- /**
589
- * Connects to the database server and selects a database
590
- *
591
- * PHP5 style constructor for compatibility with PHP5. Does
592
- * the actual setting up of the class properties and connection
593
- * to the database.
594
- *
595
- * @link http://core.trac.wordpress.org/ticket/3354
596
- * @since 2.0.8
597
- *
598
- * @param string $dbuser MySQL database user
599
- * @param string $dbpassword MySQL database password
600
- * @param string $dbname MySQL database name
601
- * @param string $dbhost MySQL database host
602
- */
603
- function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
604
- register_shutdown_function( array( &$this, '__destruct' ) );
605
-
606
- if ( defined( 'WP_DEBUG' ) && WP_DEBUG )
607
- $this->show_errors();
608
-
609
- if ( is_multisite() ) {
610
- $this->charset = 'utf8';
611
- if ( defined( 'DB_COLLATE' ) && DB_COLLATE )
612
- $this->collate = DB_COLLATE;
613
- else
614
- $this->collate = 'utf8_general_ci';
615
- } elseif ( defined( 'DB_COLLATE' ) ) {
616
- $this->collate = DB_COLLATE;
617
- }
618
-
619
- if ( defined( 'DB_CHARSET' ) )
620
- $this->charset = DB_CHARSET;
621
-
622
- $this->dbuser = $dbuser;
623
-
624
- $this->dbh = @mysql_connect( $dbhost, $dbuser, $dbpassword, true );
625
- if ( !$this->dbh ) {
626
- $this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/"
627
- <h1>Error establishing a database connection</h1>
628
- <p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p>
629
- <ul>
630
- <li>Are you sure you have the correct username and password?</li>
631
- <li>Are you sure that you have typed the correct hostname?</li>
632
- <li>Are you sure that the database server is running?</li>
633
- </ul>
634
- <p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
635
- "/*/WP_I18N_DB_CONN_ERROR*/, $dbhost ), 'db_connect_fail' );
636
- return;
637
- }
638
-
639
- $this->ready = true;
640
-
641
- if ( $this->has_cap( 'collation' ) && !empty( $this->charset ) ) {
642
- if ( function_exists( 'mysql_set_charset' ) ) {
643
- mysql_set_charset( $this->charset, $this->dbh );
644
- $this->real_escape = true;
645
- } else {
646
- $query = $this->prepare( 'SET NAMES %s', $this->charset );
647
- if ( ! empty( $this->collate ) )
648
- $query .= $this->prepare( ' COLLATE %s', $this->collate );
649
- $this->dbcr_query( $query, false );
650
- }
651
- }
652
-
653
- $this->select( $dbname, $this->dbh );
654
-
655
- // --- DB Cache Start ---
656
- // Caching
657
- // require_once would be better, but some people deletes plugin without deactivating it first
658
- if ( @include_once( DBCR_PATH.'/db-functions.php' ) ) {
659
- $this->dbcr_config = unserialize( @file_get_contents( WP_CONTENT_DIR.'/db-config.ini' ) );
660
- $this->dbcr_config['debug'] = false; //TODO: put this into option page
661
- $this->dbcr_cache =& new pcache();
662
- $this->dbcr_cache->lifetime = isset( $this->dbcr_config['timeout'] ) ? $this->dbcr_config['timeout'] : 1800;
663
- $this->dbcr_cache->lifetime *= 60; //convert to seconds
664
-
665
- // Clean unused
666
- // Move to cron for better performance
667
- /*$dbcheck = date('G')/4;
668
- if ( $dbcheck == intval( $dbcheck ) && ( !isset( $this->dbcr_config['lastclean'] )
669
- || $this->dbcr_config['lastclean'] < time() - 3600 ) ) {
670
- $this->dbcr_cache->clean();
671
- $this->dbcr_config['lastclean'] = time();
672
- $file = fopen(WP_CONTENT_DIR.'/db-config.ini', 'w+');
673
- if ($file) {
674
- fwrite($file, serialize($this->dbcr_config));
675
- fclose($file);
676
- }
677
- }*/
678
-
679
- // cache only frontside
680
- if (
681
- ( defined( 'WP_ADMIN' ) && WP_ADMIN ) ||
682
- ( defined( 'DOING_CRON' ) && DOING_CRON ) ||
683
- ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ||
684
- strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) ||
685
- strpos( $_SERVER['REQUEST_URI'], 'wp-login' ) ||
686
- strpos( $_SERVER['REQUEST_URI'], 'wp-register' ) ||
687
- strpos( $_SERVER['REQUEST_URI'], 'wp-signup' )
688
- ) {
689
- $this->dbcr_cacheable = false;
690
- }
691
- } else { // Cannot include db-functions.php
692
- $this->dbcr_cacheable = false;
693
- $this->dbcr_show_error = true;
694
- }
695
- // --- DB Cache End ---
696
- }
697
-
698
- /**
699
- * PHP5 style destructor and will run when database object is destroyed.
700
- *
701
- * @see wpdb::__construct()
702
- * @since 2.0.8
703
- * @return bool true
704
- */
705
- function __destruct() {
706
- return true;
707
- }
708
-
709
- /**
710
- * Sets the table prefix for the WordPress tables.
711
- *
712
- * @since 2.5.0
713
- *
714
- * @param string $prefix Alphanumeric name for the new prefix.
715
- * @return string|WP_Error Old prefix or WP_Error on error
716
- */
717
- function set_prefix( $prefix, $set_table_names = true ) {
718
-
719
- if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
720
- return new WP_Error('invalid_db_prefix', /*WP_I18N_DB_BAD_PREFIX*/'Invalid database prefix'/*/WP_I18N_DB_BAD_PREFIX*/);
721
-
722
- $old_prefix = is_multisite() ? '' : $prefix;
723
-
724
- if ( isset( $this->base_prefix ) )
725
- $old_prefix = $this->base_prefix;
726
-
727
- $this->base_prefix = $prefix;
728
-
729
- if ( $set_table_names ) {
730
- foreach ( $this->tables( 'global' ) as $table => $prefixed_table )
731
- $this->$table = $prefixed_table;
732
-
733
- if ( is_multisite() && empty( $this->blogid ) )
734
- return $old_prefix;
735
-
736
- $this->prefix = $this->get_blog_prefix();
737
-
738
- foreach ( $this->tables( 'blog' ) as $table => $prefixed_table )
739
- $this->$table = $prefixed_table;
740
-
741
- foreach ( $this->tables( 'old' ) as $table => $prefixed_table )
742
- $this->$table = $prefixed_table;
743
- }
744
- return $old_prefix;
745
- }
746
-
747
- /**
748
- * Sets blog id.
749
- *
750
- * @since 3.0.0
751
- * @access public
752
- * @param int $blog_id
753
- * @param int $site_id Optional.
754
- * @return string previous blog id
755
- */
756
- function set_blog_id( $blog_id, $site_id = 0 ) {
757
- if ( ! empty( $site_id ) )
758
- $this->siteid = $site_id;
759
-
760
- $old_blog_id = $this->blogid;
761
- $this->blogid = $blog_id;
762
-
763
- $this->prefix = $this->get_blog_prefix();
764
-
765
- foreach ( $this->tables( 'blog' ) as $table => $prefixed_table )
766
- $this->$table = $prefixed_table;
767
-
768
- foreach ( $this->tables( 'old' ) as $table => $prefixed_table )
769
- $this->$table = $prefixed_table;
770
-
771
- return $old_blog_id;
772
- }
773
-
774
- /**
775
- * Gets blog prefix.
776
- *
777
- * @uses is_multisite()
778
- * @since 3.0.0
779
- * @param int $blog_id Optional.
780
- * @return string Blog prefix.
781
- */
782
- function get_blog_prefix( $blog_id = null ) {
783
- if ( is_multisite() ) {
784
- if ( null === $blog_id )
785
- $blog_id = $this->blogid;
786
- if ( defined( 'MULTISITE' ) && ( 0 == $blog_id || 1 == $blog_id ) )
787
- return $this->base_prefix;
788
- else
789
- return $this->base_prefix . $blog_id . '_';
790
- } else {
791
- return $this->base_prefix;
792
- }
793
- }
794
-
795
- /**
796
- * Returns an array of WordPress tables.
797
- *
798
- * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to
799
- * override the WordPress users and usersmeta tables that would otherwise
800
- * be determined by the prefix.
801
- *
802
- * The scope argument can take one of the following:
803
- *
804
- * 'all' - returns 'all' and 'global' tables. No old tables are returned.
805
- * 'blog' - returns the blog-level tables for the queried blog.
806
- * 'global' - returns the global tables for the installation, returning multisite tables only if running multisite.
807
- * 'ms_global' - returns the multisite global tables, regardless if current installation is multisite.
808
- * 'old' - returns tables which are deprecated.
809
- *
810
- * @since 3.0.0
811
- * @uses wpdb::$tables
812
- * @uses wpdb::$old_tables
813
- * @uses wpdb::$global_tables
814
- * @uses wpdb::$ms_global_tables
815
- * @uses is_multisite()
816
- *
817
- * @param string $scope Optional. Can be all, global, ms_global, blog, or old tables. Defaults to all.
818
- * @param bool $prefix Optional. Whether to include table prefixes. Default true. If blog
819
- * prefix is requested, then the custom users and usermeta tables will be mapped.
820
- * @param int $blog_id Optional. The blog_id to prefix. Defaults to wpdb::$blogid. Used only when prefix is requested.
821
- * @return array Table names. When a prefix is requested, the key is the unprefixed table name.
822
- */
823
- function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) {
824
- switch ( $scope ) {
825
- case 'all' :
826
- $tables = array_merge( $this->global_tables, $this->tables );
827
- if ( is_multisite() )
828
- $tables = array_merge( $tables, $this->ms_global_tables );
829
- break;
830
- case 'blog' :
831
- $tables = $this->tables;
832
- break;
833
- case 'global' :
834
- $tables = $this->global_tables;
835
- if ( is_multisite() )
836
- $tables = array_merge( $tables, $this->ms_global_tables );
837
- break;
838
- case 'ms_global' :
839
- $tables = $this->ms_global_tables;
840
- break;
841
- case 'old' :
842
- $tables = $this->old_tables;
843
- break;
844
- default :
845
- return array();
846
- break;
847
- }
848
-
849
- if ( $prefix ) {
850
- if ( ! $blog_id )
851
- $blog_id = $this->blogid;
852
- $blog_prefix = $this->get_blog_prefix( $blog_id );
853
- $base_prefix = $this->base_prefix;
854
- $global_tables = array_merge( $this->global_tables, $this->ms_global_tables );
855
- foreach ( $tables as $k => $table ) {
856
- if ( in_array( $table, $global_tables ) )
857
- $tables[ $table ] = $base_prefix . $table;
858
- else
859
- $tables[ $table ] = $blog_prefix . $table;
860
- unset( $tables[ $k ] );
861
- }
862
-
863
- if ( isset( $tables['users'] ) && defined( 'CUSTOM_USER_TABLE' ) )
864
- $tables['users'] = CUSTOM_USER_TABLE;
865
-
866
- if ( isset( $tables['usermeta'] ) && defined( 'CUSTOM_USER_META_TABLE' ) )
867
- $tables['usermeta'] = CUSTOM_USER_META_TABLE;
868
- }
869
-
870
- return $tables;
871
- }
872
-
873
- /**
874
- * Selects a database using the current database connection.
875
- *
876
- * The database name will be changed based on the current database
877
- * connection. On failure, the execution will bail and display an DB error.
878
- *
879
- * @since 0.71
880
- *
881
- * @param string $db MySQL database name
882
- * @param resource $dbh Optional link identifier.
883
- * @return null Always null.
884
- */
885
- function select( $db, $dbh = null) {
886
- if ( is_null($dbh) )
887
- $dbh = $this->dbh;
888
-
889
- if ( !@mysql_select_db( $db, $dbh ) ) {
890
- $this->ready = false;
891
- $this->bail( sprintf( /*WP_I18N_DB_SELECT_DB*/'
892
- <h1>Can&#8217;t select database</h1>
893
- <p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>%1$s</code> database.</p>
894
- <ul>
895
- <li>Are you sure it exists?</li>
896
- <li>Does the user <code>%2$s</code> have permission to use the <code>%1$s</code> database?</li>
897
- <li>On some systems the name of your database is prefixed with your username, so it would be like <code>username_%1$s</code>. Could that be the problem?</li>
898
- </ul>
899
- <p>If you don\'t know how to set up a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>.</p>'/*/WP_I18N_DB_SELECT_DB*/, $db, $this->dbuser ), 'db_select_fail' );
900
- return;
901
- }
902
- }
903
-
904
- /**
905
- * Weak escape, using addslashes()
906
- *
907
- * @see addslashes()
908
- * @since 2.8.0
909
- * @access private
910
- *
911
- * @param string $string
912
- * @return string
913
- */
914
- function _weak_escape( $string ) {
915
- return addslashes( $string );
916
- }
917
-
918
- /**
919
- * Real escape, using mysql_real_escape_string() or addslashes()
920
- *
921
- * @see mysql_real_escape_string()
922
- * @see addslashes()
923
- * @since 2.8
924
- * @access private
925
- *
926
- * @param string $string to escape
927
- * @return string escaped
928
- */
929
- function _real_escape( $string ) {
930
- if ( $this->dbh && $this->real_escape )
931
- return mysql_real_escape_string( $string, $this->dbh );
932
- else
933
- return addslashes( $string );
934
- }
935
-
936
- /**
937
- * Escape data. Works on arrays.
938
- *
939
- * @uses wpdb::_escape()
940
- * @uses wpdb::_real_escape()
941
- * @since 2.8
942
- * @access private
943
- *
944
- * @param string|array $data
945
- * @return string|array escaped
946
- */
947
- function _escape( $data ) {
948
- if ( is_array( $data ) ) {
949
- foreach ( (array) $data as $k => $v ) {
950
- if ( is_array($v) )
951
- $data[$k] = $this->_escape( $v );
952
- else
953
- $data[$k] = $this->_real_escape( $v );
954
- }
955
- } else {
956
- $data = $this->_real_escape( $data );
957
- }
958
-
959
- return $data;
960
- }
961
-
962
- /**
963
- * Escapes content for insertion into the database using addslashes(), for security.
964
- *
965
- * Works on arrays.
966
- *
967
- * @since 0.71
968
- * @param string|array $data to escape
969
- * @return string|array escaped as query safe string
970
- */
971
- function escape( $data ) {
972
- if ( is_array( $data ) ) {
973
- foreach ( (array) $data as $k => $v ) {
974
- if ( is_array( $v ) )
975
- $data[$k] = $this->escape( $v );
976
- else
977
- $data[$k] = $this->_weak_escape( $v );
978
- }
979
- } else {
980
- $data = $this->_weak_escape( $data );
981
- }
982
-
983
- return $data;
984
- }
985
-
986
- /**
987
- * Escapes content by reference for insertion into the database, for security
988
- *
989
- * @uses wpdb::_real_escape()
990
- * @since 2.3.0
991
- * @param string $string to escape
992
- * @return void
993
- */
994
- function escape_by_ref( &$string ) {
995
- $string = $this->_real_escape( $string );
996
- }
997
-
998
- /**
999
- * Prepares a SQL query for safe execution. Uses sprintf()-like syntax.
1000
- *
1001
- * The following directives can be used in the query format string:
1002
- * %d (decimal number)
1003
- * %s (string)
1004
- * %% (literal percentage sign - no argument needed)
1005
- *
1006
- * Both %d and %s are to be left unquoted in the query string and they need an argument passed for them.
1007
- * Literals (%) as parts of the query must be properly written as %%.
1008
- *
1009
- * This function only supports a small subset of the sprintf syntax; it only supports %d (decimal number), %s (string).
1010
- * Does not support sign, padding, alignment, width or precision specifiers.
1011
- * Does not support argument numbering/swapping.
1012
- *
1013
- * May be called like {@link http://php.net/sprintf sprintf()} or like {@link http://php.net/vsprintf vsprintf()}.
1014
- *
1015
- * Both %d and %s should be left unquoted in the query string.
1016
- *
1017
- * <code>
1018
- * wpdb::prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d", 'foo', 1337 )
1019
- * wpdb::prepare( "SELECT DATE_FORMAT(`field`, '%%c') FROM `table` WHERE `column` = %s", 'foo' );
1020
- * </code>
1021
- *
1022
- * @link http://php.net/sprintf Description of syntax.
1023
- * @since 2.3.0
1024
- *
1025
- * @param string $query Query statement with sprintf()-like placeholders
1026
- * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like
1027
- * {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if
1028
- * being called like {@link http://php.net/sprintf sprintf()}.
1029
- * @param mixed $args,... further variables to substitute into the query's placeholders if being called like
1030
- * {@link http://php.net/sprintf sprintf()}.
1031
- * @return null|false|string Sanitized query string, null if there is no query, false if there is an error and string
1032
- * if there was something to prepare
1033
- */
1034
- function prepare( $query = null ) { // ( $query, *$args )
1035
- if ( is_null( $query ) )
1036
- return;
1037
-
1038
- $args = func_get_args();
1039
- array_shift( $args );
1040
- // If args were passed as an array (as in vsprintf), move them up
1041
- if ( isset( $args[0] ) && is_array($args[0]) )
1042
- $args = $args[0];
1043
- $query = str_replace( "'%s'", '%s', $query ); // in case someone mistakenly already singlequoted it
1044
- $query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
1045
- $query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
1046
- array_walk( $args, array( &$this, 'escape_by_ref' ) );
1047
- return @vsprintf( $query, $args );
1048
- }
1049
-
1050
- /**
1051
- * Print SQL/DB error.
1052
- *
1053
- * @since 0.71
1054
- * @global array $EZSQL_ERROR Stores error information of query and error string
1055
- *
1056
- * @param string $str The error to display
1057
- * @return bool False if the showing of errors is disabled.
1058
- */
1059
- function print_error( $str = '' ) {
1060
- global $EZSQL_ERROR;
1061
-
1062
- if ( !$str )
1063
- $str = mysql_error( $this->dbh );
1064
- $EZSQL_ERROR[] = array( 'query' => $this->last_query, 'error_str' => $str );
1065
-
1066
- if ( $this->suppress_errors )
1067
- return false;
1068
-
1069
- if ( $caller = $this->get_caller() )
1070
- $error_str = sprintf( /*WP_I18N_DB_QUERY_ERROR_FULL*/'WordPress database error %1$s for query %2$s made by %3$s'/*/WP_I18N_DB_QUERY_ERROR_FULL*/, $str, $this->last_query, $caller );
1071
- else
1072
- $error_str = sprintf( /*WP_I18N_DB_QUERY_ERROR*/'WordPress database error %1$s for query %2$s'/*/WP_I18N_DB_QUERY_ERROR*/, $str, $this->last_query );
1073
-
1074
- if ( function_exists( 'error_log' )
1075
- && ( $log_file = @ini_get( 'error_log' ) )
1076
- && ( 'syslog' == $log_file || @is_writable( $log_file ) )
1077
- )
1078
- @error_log( $error_str );
1079
-
1080
- // Are we showing errors?
1081
- if ( ! $this->show_errors )
1082
- return false;
1083
-
1084
- // If there is an error then take note of it
1085
- if ( is_multisite() ) {
1086
- $msg = "WordPress database error: [$str]\n{$this->last_query}\n";
1087
- if ( defined( 'ERRORLOGFILE' ) )
1088
- error_log( $msg, 3, ERRORLOGFILE );
1089
- if ( defined( 'DIEONDBERROR' ) )
1090
- wp_die( $msg );
1091
- } else {
1092
- $str = htmlspecialchars( $str, ENT_QUOTES );
1093
- $query = htmlspecialchars( $this->last_query, ENT_QUOTES );
1094
-
1095
- print "<div id='error'>
1096
- <p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br />
1097
- <code>$query</code></p>
1098
- </div>";
1099
- }
1100
- }
1101
-
1102
- /**
1103
- * Enables showing of database errors.
1104
- *
1105
- * This function should be used only to enable showing of errors.
1106
- * wpdb::hide_errors() should be used instead for hiding of errors. However,
1107
- * this function can be used to enable and disable showing of database
1108
- * errors.
1109
- *
1110
- * @since 0.71
1111
- * @see wpdb::hide_errors()
1112
- *
1113
- * @param bool $show Whether to show or hide errors
1114
- * @return bool Old value for showing errors.
1115
  */
1116
- function show_errors( $show = true ) {
1117
- $errors = $this->show_errors;
1118
- $this->show_errors = $show;
1119
- return $errors;
1120
- }
1121
-
1122
  /**
1123
- * Disables showing of database errors.
1124
  *
1125
- * By default database errors are not shown.
1126
  *
 
1127
  * @since 0.71
1128
- * @see wpdb::show_errors()
1129
  *
1130
- * @return bool Whether showing of errors was active
 
 
 
1131
  */
1132
- function hide_errors() {
1133
- $show = $this->show_errors;
1134
- $this->show_errors = false;
1135
- return $show;
1136
  }
1137
 
1138
  /**
1139
- * Whether to suppress database errors.
1140
  *
1141
- * By default database errors are suppressed, with a simple
1142
- * call to this function they can be enabled.
 
1143
  *
1144
- * @since 2.5
1145
- * @see wpdb::hide_errors()
1146
- * @param bool $suppress Optional. New value. Defaults to true.
1147
- * @return bool Old value
1148
- */
1149
- function suppress_errors( $suppress = true ) {
1150
- $errors = $this->suppress_errors;
1151
- $this->suppress_errors = (bool) $suppress;
1152
- return $errors;
1153
- }
1154
-
1155
- /**
1156
- * Kill cached query results.
1157
  *
1158
- * @since 0.71
1159
- * @return void
 
 
1160
  */
1161
- function flush() {
1162
- $this->last_result = array();
1163
- $this->col_info = null;
1164
- $this->last_query = null;
1165
- }
1166
 
1167
- function db_connect( $query = "SELECT" ) {
1168
- global $db_list, $global_db_list;
1169
- if ( ! is_array( $db_list ) )
1170
- return true;
1171
 
1172
- if ( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
1173
- $action = 'global';
1174
- $details = $global_db_list[ mt_rand( 0, count( $global_db_list ) -1 ) ];
1175
- $this->db_global = $details;
1176
- } elseif ( preg_match("/^\\s*(alter table|create|insert|delete|update|replace) /i",$query) ) {
1177
- $action = 'write';
1178
- $details = $db_list[ 'write' ][ mt_rand( 0, count( $db_list[ 'write' ] ) -1 ) ];
1179
- $this->db_write = $details;
1180
- } else {
1181
- $action = '';
1182
- $details = $db_list[ 'read' ][ mt_rand( 0, count( $db_list[ 'read' ] ) -1 ) ];
1183
- $this->db_read = $details;
1184
- }
1185
 
1186
- $dbhname = "dbh" . $action;
1187
- $this->$dbhname = @mysql_connect( $details[ 'db_host' ], $details[ 'db_user' ], $details[ 'db_password' ] );
1188
- if (!$this->$dbhname ) {
1189
- $this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/"
1190
- <h1>Error establishing a database connection</h1>
1191
- <p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p>
1192
- <ul>
1193
- <li>Are you sure you have the correct username and password?</li>
1194
- <li>Are you sure that you have typed the correct hostname?</li>
1195
- <li>Are you sure that the database server is running?</li>
1196
- </ul>
1197
- <p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
1198
- "/*/WP_I18N_DB_CONN_ERROR*/, $details['db_host'] ), 'db_connect_fail' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1199
  }
1200
- $this->select( $details[ 'db_name' ], $this->$dbhname );
 
 
 
 
 
 
 
 
 
 
 
1201
  }
1202
 
1203
  /**
@@ -1410,478 +469,5 @@ class dbrc_wpdb {
1410
 
1411
  return $return_val;
1412
  }
1413
-
1414
- /**
1415
- * Insert a row into a table.
1416
- *
1417
- * <code>
1418
- * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 'bar' ) )
1419
- * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
1420
- * </code>
1421
- *
1422
- * @since 2.5.0
1423
- * @see wpdb::prepare()
1424
- * @see wpdb::$field_types
1425
- * @see wp_set_wpdb_vars()
1426
- *
1427
- * @param string $table table name
1428
- * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
1429
- * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data.
1430
- * A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
1431
- * @return int|false The number of rows inserted, or false on error.
1432
- */
1433
- function insert( $table, $data, $format = null ) {
1434
- return $this->_insert_replace_helper( $table, $data, $format, 'INSERT' );
1435
- }
1436
-
1437
- /**
1438
- * Replace a row into a table.
1439
- *
1440
- * <code>
1441
- * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 'bar' ) )
1442
- * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
1443
- * </code>
1444
- *
1445
- * @since 3.0.0
1446
- * @see wpdb::prepare()
1447
- * @see wpdb::$field_types
1448
- * @see wp_set_wpdb_vars()
1449
- *
1450
- * @param string $table table name
1451
- * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
1452
- * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data.
1453
- * A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
1454
- * @return int|false The number of rows affected, or false on error.
1455
- */
1456
- function replace( $table, $data, $format = null ) {
1457
- return $this->_insert_replace_helper( $table, $data, $format, 'REPLACE' );
1458
- }
1459
-
1460
- /**
1461
- * Helper function for insert and replace.
1462
- *
1463
- * Runs an insert or replace query based on $type argument.
1464
- *
1465
- * @access private
1466
- * @since 3.0.0
1467
- * @see wpdb::prepare()
1468
- * @see wpdb::$field_types
1469
- * @see wp_set_wpdb_vars()
1470
- *
1471
- * @param string $table table name
1472
- * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
1473
- * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data.
1474
- * A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
1475
- * @return int|false The number of rows affected, or false on error.
1476
- */
1477
- function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) {
1478
- if ( ! in_array( strtoupper( $type ), array( 'REPLACE', 'INSERT' ) ) )
1479
- return false;
1480
- $formats = $format = (array) $format;
1481
- $fields = array_keys( $data );
1482
- $formatted_fields = array();
1483
- foreach ( $fields as $field ) {
1484
- if ( !empty( $format ) )
1485
- $form = ( $form = array_shift( $formats ) ) ? $form : $format[0];
1486
- elseif ( isset( $this->field_types[$field] ) )
1487
- $form = $this->field_types[$field];
1488
- else
1489
- $form = '%s';
1490
- $formatted_fields[] = $form;
1491
- }
1492
- $sql = "{$type} INTO `$table` (`" . implode( '`,`', $fields ) . "`) VALUES ('" . implode( "','", $formatted_fields ) . "')";
1493
- return $this->dbcr_query( $this->prepare( $sql, $data ), false );
1494
- }
1495
-
1496
- /**
1497
- * Update a row in the table
1498
- *
1499
- * <code>
1500
- * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 'bar' ), array( 'ID' => 1 ) )
1501
- * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) )
1502
- * </code>
1503
- *
1504
- * @since 2.5.0
1505
- * @see wpdb::prepare()
1506
- * @see wpdb::$field_types
1507
- * @see wp_set_wpdb_vars()
1508
- *
1509
- * @param string $table table name
1510
- * @param array $data Data to update (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
1511
- * @param array $where A named array of WHERE clauses (in column => value pairs). Multiple clauses will be joined with ANDs. Both $where columns and $where values should be "raw".
1512
- * @param array|string $format Optional. An array of formats to be mapped to each of the values in $data. If string, that format will be used for all of the values in $data.
1513
- * A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
1514
- * @param array|string $format_where Optional. An array of formats to be mapped to each of the values in $where. If string, that format will be used for all of the items in $where. A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $where will be treated as strings.
1515
- * @return int|false The number of rows updated, or false on error.
1516
- */
1517
- function update( $table, $data, $where, $format = null, $where_format = null ) {
1518
- if ( ! is_array( $data ) || ! is_array( $where ) )
1519
- return false;
1520
-
1521
- $formats = $format = (array) $format;
1522
- $bits = $wheres = array();
1523
- foreach ( (array) array_keys( $data ) as $field ) {
1524
- if ( !empty( $format ) )
1525
- $form = ( $form = array_shift( $formats ) ) ? $form : $format[0];
1526
- elseif ( isset($this->field_types[$field]) )
1527
- $form = $this->field_types[$field];
1528
- else
1529
- $form = '%s';
1530
- $bits[] = "`$field` = {$form}";
1531
- }
1532
-
1533
- $where_formats = $where_format = (array) $where_format;
1534
- foreach ( (array) array_keys( $where ) as $field ) {
1535
- if ( !empty( $where_format ) )
1536
- $form = ( $form = array_shift( $where_formats ) ) ? $form : $where_format[0];
1537
- elseif ( isset( $this->field_types[$field] ) )
1538
- $form = $this->field_types[$field];
1539
- else
1540
- $form = '%s';
1541
- $wheres[] = "`$field` = {$form}";
1542
- }
1543
-
1544
- $sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres );
1545
- return $this->dbcr_query( $this->prepare( $sql, array_merge( array_values( $data ), array_values( $where ) ) ), false );
1546
- }
1547
-
1548
- /**
1549
- * Retrieve one variable from the database.
1550
- *
1551
- * Executes a SQL query and returns the value from the SQL result.
1552
- * If the SQL result contains more than one column and/or more than one row, this function returns the value in the column and row specified.
1553
- * If $query is null, this function returns the value in the specified column and row from the previous SQL result.
1554
- *
1555
- * @since 0.71
1556
- *
1557
- * @param string|null $query Optional. SQL query. Defaults to null, use the result from the previous query.
1558
- * @param int $x Optional. Column of value to return. Indexed from 0.
1559
- * @param int $y Optional. Row of value to return. Indexed from 0.
1560
- * @return string|null Database query result (as string), or null on failure
1561
- */
1562
- function get_var( $query = null, $x = 0, $y = 0 ) {
1563
- $this->func_call = "\$db->get_var(\"$query\", $x, $y)";
1564
- if ( $query )
1565
- $this->dbcr_query( $query );
1566
-
1567
- // Extract var out of cached results based x,y vals
1568
- if ( !empty( $this->last_result[$y] ) ) {
1569
- $values = array_values( get_object_vars( $this->last_result[$y] ) );
1570
- }
1571
-
1572
- // If there is a value return it else return null
1573
- return ( isset( $values[$x] ) && $values[$x] !== '' ) ? $values[$x] : null;
1574
- }
1575
-
1576
- /**
1577
- * Retrieve one row from the database.
1578
- *
1579
- * Executes a SQL query and returns the row from the SQL result.
1580
- *
1581
- * @since 0.71
1582
- *
1583
- * @param string|null $query SQL query.
1584
- * @param string $output Optional. one of ARRAY_A | ARRAY_N | OBJECT constants. Return an associative array (column => value, ...),
1585
- * a numerically indexed array (0 => value, ...) or an object ( ->column = value ), respectively.
1586
- * @param int $y Optional. Row to return. Indexed from 0.
1587
- * @return mixed Database query result in format specifed by $output or null on failure
1588
- */
1589
- function get_row( $query = null, $output = OBJECT, $y = 0 ) {
1590
- $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
1591
- if ( $query )
1592
- $this->dbcr_query( $query );
1593
- else
1594
- return null;
1595
-
1596
- if ( !isset( $this->last_result[$y] ) )
1597
- return null;
1598
-
1599
- if ( $output == OBJECT ) {
1600
- return $this->last_result[$y] ? $this->last_result[$y] : null;
1601
- } elseif ( $output == ARRAY_A ) {
1602
- return $this->last_result[$y] ? get_object_vars( $this->last_result[$y] ) : null;
1603
- } elseif ( $output == ARRAY_N ) {
1604
- return $this->last_result[$y] ? array_values( get_object_vars( $this->last_result[$y] ) ) : null;
1605
- } else {
1606
- $this->print_error(/*WP_I18N_DB_GETROW_ERROR*/" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N"/*/WP_I18N_DB_GETROW_ERROR*/);
1607
- }
1608
- }
1609
-
1610
- /**
1611
- * Retrieve one column from the database.
1612
- *
1613
- * Executes a SQL query and returns the column from the SQL result.
1614
- * If the SQL result contains more than one column, this function returns the column specified.
1615
- * If $query is null, this function returns the specified column from the previous SQL result.
1616
- *
1617
- * @since 0.71
1618
- *
1619
- * @param string|null $query Optional. SQL query. Defaults to previous query.
1620
- * @param int $x Optional. Column to return. Indexed from 0.
1621
- * @return array Database query result. Array indexed from 0 by SQL result row number.
1622
- */
1623
- function get_col( $query = null , $x = 0 ) {
1624
- if ( $query )
1625
- $this->dbcr_query( $query );
1626
-
1627
- $new_array = array();
1628
- // Extract the column values
1629
- for ( $i = 0, $j = count( $this->last_result ); $i < $j; $i++ ) {
1630
- $new_array[$i] = $this->get_var( null, $x, $i );
1631
- }
1632
- return $new_array;
1633
- }
1634
-
1635
- /**
1636
- * Retrieve an entire SQL result set from the database (i.e., many rows)
1637
- *
1638
- * Executes a SQL query and returns the entire SQL result.
1639
- *
1640
- * @since 0.71
1641
- *
1642
- * @param string $query SQL query.
1643
- * @param string $output Optional. Any of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants. With one of the first three, return an array of rows indexed from 0 by SQL result row number.
1644
- * Each row is an associative array (column => value, ...), a numerically indexed array (0 => value, ...), or an object. ( ->column = value ), respectively.
1645
- * With OBJECT_K, return an associative array of row objects keyed by the value of each row's first column's value. Duplicate keys are discarded.
1646
- * @return mixed Database query results
1647
- */
1648
- function get_results( $query = null, $output = OBJECT ) {
1649
- $this->func_call = "\$db->get_results(\"$query\", $output)";
1650
-
1651
- if ( $query )
1652
- $this->dbcr_query( $query );
1653
- else
1654
- return null;
1655
-
1656
- $new_array = array();
1657
- if ( $output == OBJECT ) {
1658
- // Return an integer-keyed array of row objects
1659
- return $this->last_result;
1660
- } elseif ( $output == OBJECT_K ) {
1661
- // Return an array of row objects with keys from column 1
1662
- // (Duplicates are discarded)
1663
- foreach ( $this->last_result as $row ) {
1664
- $key = array_shift( get_object_vars( $row ) );
1665
- if ( ! isset( $new_array[ $key ] ) )
1666
- $new_array[ $key ] = $row;
1667
- }
1668
- return $new_array;
1669
- } elseif ( $output == ARRAY_A || $output == ARRAY_N ) {
1670
- // Return an integer-keyed array of...
1671
- if ( $this->last_result ) {
1672
- foreach( (array) $this->last_result as $row ) {
1673
- if ( $output == ARRAY_N ) {
1674
- // ...integer-keyed row arrays
1675
- $new_array[] = array_values( get_object_vars( $row ) );
1676
- } else {
1677
- // ...column name-keyed row arrays
1678
- $new_array[] = get_object_vars( $row );
1679
- }
1680
- }
1681
- }
1682
- return $new_array;
1683
- }
1684
- return null;
1685
- }
1686
-
1687
- /**
1688
- * Retrieve column metadata from the last query.
1689
- *
1690
- * @since 0.71
1691
- *
1692
- * @param string $info_type Optional. Type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill
1693
- * @param int $col_offset Optional. 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type
1694
- * @return mixed Column Results
1695
- */
1696
- function get_col_info( $info_type = 'name', $col_offset = -1 ) {
1697
- if ( $this->col_info ) {
1698
- if ( $col_offset == -1 ) {
1699
- $i = 0;
1700
- $new_array = array();
1701
- foreach( (array) $this->col_info as $col ) {
1702
- $new_array[$i] = $col->{$info_type};
1703
- $i++;
1704
- }
1705
- return $new_array;
1706
- } else {
1707
- return $this->col_info[$col_offset]->{$info_type};
1708
- }
1709
- }
1710
- }
1711
-
1712
- /**
1713
- * Starts the timer, for debugging purposes.
1714
- *
1715
- * @since 1.5.0
1716
- *
1717
- * @return true
1718
- */
1719
- function timer_start() {
1720
- $mtime = explode( ' ', microtime() );
1721
- $this->time_start = $mtime[1] + $mtime[0];
1722
- return true;
1723
- }
1724
-
1725
- /**
1726
- * Stops the debugging timer.
1727
- *
1728
- * @since 1.5.0
1729
- *
1730
- * @return int Total time spent on the query, in milliseconds
1731
- */
1732
- function timer_stop() {
1733
- $mtime = explode( ' ', microtime() );
1734
- $time_end = $mtime[1] + $mtime[0];
1735
- $time_total = $time_end - $this->time_start;
1736
- return $time_total;
1737
- }
1738
-
1739
- /**
1740
- * Wraps errors in a nice header and footer and dies.
1741
- *
1742
- * Will not die if wpdb::$show_errors is true
1743
- *
1744
- * @since 1.5.0
1745
- *
1746
- * @param string $message The Error message
1747
- * @param string $error_code Optional. A Computer readable string to identify the error.
1748
- * @return false|void
1749
- */
1750
- function bail( $message, $error_code = '500' ) {
1751
- if ( !$this->show_errors ) {
1752
- if ( class_exists( 'WP_Error' ) )
1753
- $this->error = new WP_Error($error_code, $message);
1754
- else
1755
- $this->error = $message;
1756
- return false;
1757
- }
1758
- wp_die($message);
1759
- }
1760
-
1761
- /**
1762
- * Whether MySQL database is at least the required minimum version.
1763
- *
1764
- * @since 2.5.0
1765
- * @uses $wp_version
1766
- * @uses $required_mysql_version
1767
- *
1768
- * @return WP_Error
1769
- */
1770
- function check_database_version() {
1771
- global $wp_version, $required_mysql_version;
1772
- // Make sure the server has the required MySQL version
1773
- if ( isset( $required_mysql_version ) ) {
1774
- if ( version_compare($this->db_version(), $required_mysql_version, '<') )
1775
- return new WP_Error('database_version', sprintf( __( '<strong>ERROR</strong>: WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ));
1776
- } elseif ( version_compare( $wp_version, '2.9', '<' ) ) { // WP 2.8 requires MySQL 4.0.0
1777
- // Make sure the server has MySQL 4.0
1778
- if ( version_compare($this->db_version(), '4.0.0', '<') )
1779
- return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
1780
- } else { // WP 2.9 requires MySQL 4.1.2
1781
- // Make sure the server has MySQL 4.1.2
1782
- if ( version_compare($this->db_version(), '4.1.2', '<') )
1783
- return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.1.2 or higher'), $wp_version));
1784
- }
1785
- }
1786
-
1787
- /**
1788
- * Whether the database supports collation.
1789
- *
1790
- * Called when WordPress is generating the table scheme.
1791
- *
1792
- * @since 2.5.0
1793
- *
1794
- * @return bool True if collation is supported, false if version does not
1795
- */
1796
- function supports_collation() {
1797
- return $this->has_cap( 'collation' );
1798
- }
1799
-
1800
- /**
1801
- * Determine if a database supports a particular feature
1802
- *
1803
- * @since 2.7
1804
- * @see wpdb::db_version()
1805
- *
1806
- * @param string $db_cap the feature
1807
- * @return bool
1808
- */
1809
- function has_cap( $db_cap ) {
1810
- $version = $this->db_version();
1811
-
1812
- switch ( strtolower( $db_cap ) ) {
1813
- case 'collation' : // @since 2.5.0
1814
- case 'group_concat' : // @since 2.7
1815
- case 'subqueries' : // @since 2.7
1816
- return version_compare( $version, '4.1', '>=' );
1817
- };
1818
-
1819
- return false;
1820
- }
1821
-
1822
- /**
1823
- * Retrieve the name of the function that called wpdb.
1824
- *
1825
- * Searches up the list of functions until it reaches
1826
- * the one that would most logically had called this method.
1827
- *
1828
- * @since 2.5.0
1829
- *
1830
- * @return string The name of the calling function
1831
- */
1832
- function get_caller() {
1833
- // requires PHP 4.3+
1834
- if ( !is_callable('debug_backtrace') )
1835
- return '';
1836
-
1837
- $trace = array_reverse( debug_backtrace() );
1838
- $caller = array();
1839
-
1840
- foreach ( $trace as $call ) {
1841
- if ( isset( $call['class'] ) && __CLASS__ == $call['class'] )
1842
- continue; // Filter out wpdb calls.
1843
- $caller[] = isset( $call['class'] ) ? "{$call['class']}->{$call['function']}" : $call['function'];
1844
- }
1845
-
1846
- return join( ', ', $caller );
1847
- }
1848
-
1849
- /**
1850
- * The database version number.
1851
- *
1852
- * @return false|string false on failure, version number on success
1853
- */
1854
- function db_version() {
1855
- return preg_replace( '/[^0-9.].*/', '', mysql_get_server_info( $this->dbh ) );
1856
- }
1857
-
1858
- // Show error message when something is messed with DB Cache Reloaded plugin
1859
- function _dbcr_admin_notice() {
1860
- // Display error message
1861
- echo '<div id="notice" class="error"><p>';
1862
- printf( __('<b>DB Cache Reloaded Error:</b> cannot include <code>db-functions.php</code> file. Please either reinstall plugin or remove <code>%s</code> file.', 'db-cache-reloaded'), WP_CONTENT_DIR.'/db.php' );
1863
- echo '</p></div>', "\n";
1864
- }
1865
- }
1866
-
1867
- }else { // class_exists( 'dbrc_wpdb' )
1868
- // This should not happen, but I got few error reports regarding this issue
1869
- if ( class_exists( 'ReflectionClass' ) ) {
1870
- // We have Reflection classes - display detailed information
1871
- $ref_class = new ReflectionClass( 'dbrc_wpdb' );
1872
- define( 'DBCR_WPDB_EXISTED', $ref_class->getFileName().':'.$ref_class->getStartLine() );
1873
- } else {
1874
- // No Reflection - just display general info
1875
- define( 'DBCR_WPDB_EXISTED', true );
1876
- }
1877
  }
1878
-
1879
- //if ( ! isset( $wpdb ) ) {
1880
- /**
1881
- * WordPress Database Object, if it isn't set already in wp-content/db.php
1882
- * @global object $wpdb Creates a new wpdb object based on wp-config.php Constants for the database
1883
- * @since 0.71
1884
- */
1885
- // $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
1886
- //}
1887
- ?>
3
  Plugin URI: http://www.ivankristianto.com/web-development/programming/db-cache-reloaded-fix-for-wordpress-3-1/1784/
4
  Description: Database Caching Module provided by DB Cache Reloaded plugin With WordPress 3.1 compatibility.
5
  Author: Ivan Kristianto
6
+ Version: 1.7 (bundled with DB Cache Reloaded Fix 2.3)
7
  Author URI: http://www.ivankristianto.com
8
  Text Domain: db-cache-reloaded-fix
9
  */
109
  * @final
110
  */
111
  if ( !class_exists( 'dbrc_wpdb' ) ) {
112
+ class dbrc_wpdb extends wpdb{
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  // --- DB Cache Start ---
115
  /**
116
  * Amount of all queries cached by DB Cache Reloaded made
151
  /**
152
  * DB Cache Reloaded DB module version
153
  *
154
+ * @var int
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  */
156
+ var $dbcr_version = DBCR_DB_MODULE_VER;
157
+ // --- DB Cache End ---
158
+
 
 
 
159
  /**
160
+ * Connects to the database server and selects a database
161
  *
162
+ * PHP4 compatibility layer for calling the PHP5 constructor.
163
  *
164
+ * @uses wpdb::__construct() Passes parameters and returns result
165
  * @since 0.71
 
166
  *
167
+ * @param string $dbuser MySQL database user
168
+ * @param string $dbpassword MySQL database password
169
+ * @param string $dbname MySQL database name
170
+ * @param string $dbhost MySQL database host
171
  */
172
+ function wpdb( $dbuser, $dbpassword, $dbname, $dbhost ) {
173
+ if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB )
174
+ $this->db_connect();
175
+ return $this->__construct( $dbuser, $dbpassword, $dbname, $dbhost );
176
  }
177
 
178
  /**
179
+ * Connects to the database server and selects a database
180
  *
181
+ * PHP5 style constructor for compatibility with PHP5. Does
182
+ * the actual setting up of the class properties and connection
183
+ * to the database.
184
  *
185
+ * @link http://core.trac.wordpress.org/ticket/3354
186
+ * @since 2.0.8
 
 
 
 
 
 
 
 
 
 
 
187
  *
188
+ * @param string $dbuser MySQL database user
189
+ * @param string $dbpassword MySQL database password
190
+ * @param string $dbname MySQL database name
191
+ * @param string $dbhost MySQL database host
192
  */
193
+ function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
194
+ register_shutdown_function( array( &$this, '__destruct' ) );
195
+
196
+ if ( WP_DEBUG )
197
+ $this->show_errors();
198
 
199
+ $this->init_charset();
 
 
 
200
 
201
+ $this->dbuser = $dbuser;
202
+ $this->dbpassword = $dbpassword;
203
+ $this->dbname = $dbname;
204
+ $this->dbhost = $dbhost;
 
 
 
 
 
 
 
 
 
205
 
206
+ $this->db_connect();
207
+
208
+ // --- DB Cache Start ---
209
+ // Caching
210
+ // require_once would be better, but some people deletes plugin without deactivating it first
211
+ if ( @include_once( DBCR_PATH.'/db-functions.php' ) ) {
212
+ $this->dbcr_config = unserialize( @file_get_contents( WP_CONTENT_DIR.'/db-config.ini' ) );
213
+ $this->dbcr_config['debug'] = false; //TODO: put this into option page
214
+ $this->dbcr_cache =& new pcache();
215
+ $this->dbcr_cache->lifetime = isset( $this->dbcr_config['timeout'] ) ? $this->dbcr_config['timeout'] : 1800;
216
+ $this->dbcr_cache->lifetime *= 60; //convert to seconds
217
+
218
+ // Clean unused
219
+ // Move to cron for better performance
220
+ /*$dbcheck = date('G')/4;
221
+ if ( $dbcheck == intval( $dbcheck ) && ( !isset( $this->dbcr_config['lastclean'] )
222
+ || $this->dbcr_config['lastclean'] < time() - 3600 ) ) {
223
+ $this->dbcr_cache->clean();
224
+ $this->dbcr_config['lastclean'] = time();
225
+ $file = fopen(WP_CONTENT_DIR.'/db-config.ini', 'w+');
226
+ if ($file) {
227
+ fwrite($file, serialize($this->dbcr_config));
228
+ fclose($file);
229
+ }
230
+ }*/
231
+
232
+ // cache only frontside
233
+ if (
234
+ ( defined( 'WP_ADMIN' ) && WP_ADMIN ) ||
235
+ ( defined( 'DOING_CRON' ) && DOING_CRON ) ||
236
+ ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ||
237
+ strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) ||
238
+ strpos( $_SERVER['REQUEST_URI'], 'wp-login' ) ||
239
+ strpos( $_SERVER['REQUEST_URI'], 'wp-register' ) ||
240
+ strpos( $_SERVER['REQUEST_URI'], 'wp-signup' )
241
+ ) {
242
+ $this->dbcr_cacheable = false;
243
+ }
244
+ } else { // Cannot include db-functions.php
245
+ $this->dbcr_cacheable = false;
246
+ $this->dbcr_show_error = true;
247
  }
248
+ // --- DB Cache End ---
249
+ }
250
+
251
+ /**
252
+ * PHP5 style destructor and will run when database object is destroyed.
253
+ *
254
+ * @see wpdb::__construct()
255
+ * @since 2.0.8
256
+ * @return bool true
257
+ */
258
+ function __destruct() {
259
+ return true;
260
  }
261
 
262
  /**
469
 
470
  return $return_val;
471
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
472
  }
473
+ }
 
 
 
 
 
 
 
 
 
db.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin URI: http://www.ivankristianto.com/web-development/programming/db-cache-reloaded-fix-for-wordpress-3-1/1784/
4
  Description: Database Caching Module provided by DB Cache Reloaded plugin With WordPress 3.1 compatibility.
5
  Author: Ivan Kristianto
6
- Version: 1.6.1 (bundled with DB Cache Reloaded 2.2.4)
7
  Author URI: http://www.ivankristianto.com
8
  Text Domain: db-cache-reloaded-fix
9
  */
3
  Plugin URI: http://www.ivankristianto.com/web-development/programming/db-cache-reloaded-fix-for-wordpress-3-1/1784/
4
  Description: Database Caching Module provided by DB Cache Reloaded plugin With WordPress 3.1 compatibility.
5
  Author: Ivan Kristianto
6
+ Version: 1.7 (bundled with DB Cache Reloaded 2.3)
7
  Author URI: http://www.ivankristianto.com
8
  Text Domain: db-cache-reloaded-fix
9
  */
readme.html CHANGED
@@ -2,10 +2,10 @@
2
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
  <head>
4
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
5
- <title>DB Cache Reloaded 2.2 Fix Readme</title>
6
  </head>
7
  <body>
8
- <h1>DB Cache Reloaded 2.2 Fix Readme</h1>
9
  <p>The fastest cache engine for WordPress, that produces cache of database queries with easy configuration - now with bugs fixed. And WordPress 3.1 Compatible</p>
10
  <p><b>Plugin Homepage:</b> <a href="http://www.ivankristianto.com/web-development/programming/db-cache-reloaded-fix-for-wordpress-3-1/1784/">DB Cache Reloaded Fix</a></p>
11
  <p><b>Plugin Homepage on WordPress.org:</b> <a href="http://wordpress.org/extend/plugins/db-cache-reloaded-fix/">DB Cache Reloaded</a></p>
@@ -106,6 +106,10 @@ It saves information separately and also caches hidden requests to database.</p>
106
  <p>By default DB Cache Reloaded saves cached queries in <code>wp-content/db-cache-reloaded-fix/cache</code> dir (or another, if you changed value of <code>WP_CONTENT_DIR</code> constant). If you want to change this location, please define <code>DBCR_CACHE_DIR</code> constant in your <code>wp-config.php</code> file - it should point to existing directory. DB Cache Reloaded will use it instead of default location.</p>
107
 
108
  <h2>Changelog</h2>
 
 
 
 
109
  <p>2.2.4</p>
110
  <ul>
111
  <li>Add French (fr_FR) translation</li>
2
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
  <head>
4
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
5
+ <title>DB Cache Reloaded 2.3 Fix Readme</title>
6
  </head>
7
  <body>
8
+ <h1>DB Cache Reloaded 2.3 Fix Readme</h1>
9
  <p>The fastest cache engine for WordPress, that produces cache of database queries with easy configuration - now with bugs fixed. And WordPress 3.1 Compatible</p>
10
  <p><b>Plugin Homepage:</b> <a href="http://www.ivankristianto.com/web-development/programming/db-cache-reloaded-fix-for-wordpress-3-1/1784/">DB Cache Reloaded Fix</a></p>
11
  <p><b>Plugin Homepage on WordPress.org:</b> <a href="http://wordpress.org/extend/plugins/db-cache-reloaded-fix/">DB Cache Reloaded</a></p>
106
  <p>By default DB Cache Reloaded saves cached queries in <code>wp-content/db-cache-reloaded-fix/cache</code> dir (or another, if you changed value of <code>WP_CONTENT_DIR</code> constant). If you want to change this location, please define <code>DBCR_CACHE_DIR</code> constant in your <code>wp-config.php</code> file - it should point to existing directory. DB Cache Reloaded will use it instead of default location.</p>
107
 
108
  <h2>Changelog</h2>
109
+ <p>2.3</p>
110
+ <ul>
111
+ <li>Compatible to WordPress 3.4</li>
112
+ </ul>
113
  <p>2.2.4</p>
114
  <ul>
115
  <li>Add French (fr_FR) translation</li>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: ivankristianto
3
  Donate link: http://www.ivankristianto.com/portfolio/
4
  Tags: performance, caching, wp-cache, db-cache, cache
5
  Requires at least: 3.0
6
- Tested up to: 3.1.2
7
- Stable tag: 2.2.4
8
 
9
  The fastest cache engine for WordPress, that produces cache of database queries with easy configuration. Compatible with WordPress 3.1
10
 
@@ -24,9 +24,9 @@ If you are using WordPress 2.9, please use DB Cache Reloaded version 2.0 or neve
24
 
25
  If you are using WordPress 3.0, please use DB Cache Reloaded version 2.1 or never - earlier versions are not compatible with WordPress 3.0.
26
 
27
- TODO LIST:
28
 
29
- * Support Multi Database (In development)
30
 
31
  Available translations:
32
 
@@ -145,6 +145,9 @@ By default DB Cache Reloaded saves cached queries in `wp-content/db-cache-reload
145
 
146
  == Changelog ==
147
 
 
 
 
148
  = 2.2.4 =
149
  * Add French (fr_FR) translation
150
  * Move cache folder from wp-contents/tmp to db-cache-reloaded-fix/cache to fix permission issue
3
  Donate link: http://www.ivankristianto.com/portfolio/
4
  Tags: performance, caching, wp-cache, db-cache, cache
5
  Requires at least: 3.0
6
+ Tested up to: 3.4
7
+ Stable tag: 2.4
8
 
9
  The fastest cache engine for WordPress, that produces cache of database queries with easy configuration. Compatible with WordPress 3.1
10
 
24
 
25
  If you are using WordPress 3.0, please use DB Cache Reloaded version 2.1 or never - earlier versions are not compatible with WordPress 3.0.
26
 
27
+ For Web Developer:
28
 
29
+ If you are a web developer fork me on [Github] (https://github.com/ivankristianto/DB-Cache-Reloaded-Fix)
30
 
31
  Available translations:
32
 
145
 
146
  == Changelog ==
147
 
148
+ = 2.3 =
149
+ * Compatible to WordPress 3.4
150
+
151
  = 2.2.4 =
152
  * Add French (fr_FR) translation
153
  * Move cache folder from wp-contents/tmp to db-cache-reloaded-fix/cache to fix permission issue