r77312 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77311‎ | r77312 | r77313 >
Date:23:45, 25 November 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Use all passed parameters
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -210,13 +210,14 @@
211211 /**
212212 * Quickie protection against huuuuuuuuge batch inserts
213213 */
214 - protected function insertChunks( $db, $table, $data, $method, $options = array() ) {
 214+ protected function insertChunks( $db, $table, $data, $method = __METHOD__, $options = array() ) {
215215 $chunkSize = 100;
216216 for ( $i = 0; $i < count( $data ); $i += $chunkSize ) {
217 - $db->insert( 'code_paths',
 217+ $db->insert( $table,
218218 array_slice( $data, $i, $chunkSize ),
219 - __METHOD__,
220 - array( 'IGNORE' ) );
 219+ $method,
 220+ $options
 221+ );
221222 }
222223 }
223224

Comments

#Comment by Nikerabbit (talk | contribs)   07:45, 26 November 2010

Hey I didn't know __METHOD__ works in function parameters. Is this a new thing? Did you check that callers pass correct $table?

#Comment by Reedy (talk | contribs)   12:00, 26 November 2010

There is only one caller of this function, so all is fine. Just made it workable as more "general purpose"

__METHOD__ and __FUNCTION__ both seem to work fine...

Status & tagging log