r79119 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79118‎ | r79119 | r79120 >
Date:18:30, 28 December 2010
Author:soxred93
Status:resolved (Comments)
Tags:
Comment:
Fix r79109: listTables() does not work without a prefix, and verified that SQLite works now
Modified paths:
  • /trunk/phase3/includes/db/DatabaseMysql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseMysql.php
@@ -546,7 +546,7 @@
547547 $vars = get_object_vars($table);
548548 $table = array_pop( $vars );
549549
550 - if( strpos( $table, $prefix ) === 0 || is_null( $prefix ) ) {
 550+ if( empty( $prefix ) || strpos( $table, $prefix ) === 0 ) {
551551 $endArray[] = $table;
552552 }
553553 }
Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -620,7 +620,7 @@
621621 $result = $this->select(
622622 'sqlite_master',
623623 'name',
624 - "type='TABLE'"
 624+ "type='table'"
625625 );
626626
627627 $endArray = array();
@@ -629,7 +629,7 @@
630630 $vars = get_object_vars($table);
631631 $table = array_pop( $vars );
632632
633 - if( strpos( $table, $prefix ) === 0 || is_null( $prefix ) ) {
 633+ if( empty( $prefix ) || strpos( $table, $prefix ) === 0 ) {
634634 $endArray[] = $table;
635635 }
636636 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r84826Remove remaining empty() call in r79119reedy01:22, 27 March 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79109It's here! It's finally here! The skies are falling, pigs have sprouted wings...soxred9317:15, 28 December 2010

Comments

#Comment by Bryan (talk | contribs)   18:24, 29 December 2010

Why empty? Why not simply a negative boolean comparison?

#Comment by 😂 (talk | contribs)   18:32, 29 December 2010

empty() is evil.

#Comment by X! (talk | contribs)   06:16, 2 January 2011

It looks like I've fixed this at some later revision.

Status & tagging log