r35132 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35131‎ | r35132 | r35133 >
Date:04:59, 21 May 2008
Author:nickj
Status:old
Tags:
Comment:
Prevent two E_STRICT warnings when running "php maintenance/update.php" to update from 1.12 alpha to 1.13 alpha.

--------------------------------------------------
# php maintenance/update.php

MediaWiki 1.13alpha Updater

Going to run database updates for wikidb
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds...0

Strict Standards: Type: 8: Undefined offset: 1 in wiki/includes/Database.php on line 1420
Database.tableName("ipblocks") # line 1164, file: wiki/includes/Database.php
Database.tableExists("ipblocks") # line 203, file: wiki/maintenance/updaters.inc
add_field("ipblocks", "ipb_id", "patch-ipblocks.sql") # line unknown, file: unknown
call_user_func_array("add_field", Array[3]) # line 1051, file: wiki/maintenance/updaters.inc
do_all_updates(false, true) # line 60, file: wiki/maintenance/update.php

[ ... snip same warning repeated thousands of times ... ]
--------------------------------------------------

... also ... :

--------------------------------------------------
Strict Standards: Type: 8: Undefined index: USE INDEX in wiki/includes/Database.php on line 977
Database.selectSQLText(Array[2], Array[2], Array[3], "Database::select", Array[0], Array[0]) # line 952, file: wiki/includes/Database.php
Database.select(Array[2], Array[2], Array[3]) # line 32, file: wiki/maintenance/deleteDefaultMessages.php
deleteDefaultMessages() # line 1077, file: wiki/maintenance/updaters.inc
do_all_updates(false, true) # line 60, file: wiki/maintenance/update.php
--------------------------------------------------
Modified paths:
  • /trunk/phase3/includes/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Database.php
@@ -974,7 +974,7 @@
975975 $options = array( $options );
976976 }
977977 if( is_array( $table ) ) {
978 - if ( !empty($join_conds) || is_array( @$options['USE INDEX'] ) )
 978+ if ( !empty($join_conds) || ( isset( $options['USE INDEX'] ) && is_array( @$options['USE INDEX'] ) ) )
979979 $from = ' FROM ' . $this->tableNamesWithUseIndexOrJOIN( $table, @$options['USE INDEX'], $join_conds );
980980 else
981981 $from = ' FROM ' . implode( ',', array_map( array( &$this, 'tableName' ), $table ) );
@@ -1417,7 +1417,9 @@
14181418 # Split database and table into proper variables.
14191419 # We reverse the explode so that database.table and table both output
14201420 # the correct table.
1421 - @list( $table, $database ) = array_reverse( explode( '.', $name, 2 ) );
 1421+ $dbDetails = array_reverse( explode( '.', $name, 2 ) );
 1422+ if( isset( $dbDetails[1] ) ) @list( $table, $database ) = $dbDetails;
 1423+ else @list( $table ) = $dbDetails;
14221424 $prefix = $this->mTablePrefix; # Default prefix
14231425
14241426 # A database name has been specified in input. Quote the table name

Status & tagging log