r86141 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86140‎ | r86141 | r86142 >
Date:21:38, 15 April 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r86101; fetchRow cannot just be replaced like fetchObject :)
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_AutocompleteAPI.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php
@@ -8,8 +8,6 @@
99 * @ingroup SF
1010 */
1111
12 -if ( !defined( 'MEDIAWIKI' ) ) die();
13 -
1412 /**
1513 * @ingroup SFSpecialPages
1614 */
@@ -85,11 +83,15 @@
8684
8785 // Get the names of all templates on this site.
8886 $all_templates = array();
89 - $res = $db->select( 'page', 'page_title',
 87+ $res = $db->select(
 88+ 'page',
 89+ 'page_title',
9090 array( 'page_namespace' => NS_TEMPLATE, 'page_is_redirect' => 0 ),
91 - array( 'ORDER BY' => 'page_title' ) );
 91+ array( 'ORDER BY' => 'page_title' )
 92+ );
 93+
9294 if ( $db->numRows( $res ) > 0 ) {
93 - foreach ( $res as $row ) {
 95+ while ( $row = $db->fetchRow( $res ) ) {
9496 $template_name = str_replace( '_', ' ', $row[0] );
9597 $all_templates[] = $template_name;
9698 }
Index: trunk/extensions/SemanticForms/includes/SF_AutocompleteAPI.php
@@ -145,7 +145,7 @@
146146 $res = $db->select( $from_clause, "DISTINCT $value_field",
147147 $conditions, __METHOD__, $sql_options );
148148
149 - foreach ( $res as $row ) {
 149+ while ( $row = $db->fetchRow( $res ) ) {
150150 if ( $substring != null ) {
151151 $values[] = array( 'title' => str_replace( '_', ' ', $row[0] ) );
152152 } else {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86101Strict, while to foreach...reedy23:35, 14 April 2011