r100173 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100172‎ | r100173 | r100174 >
Date:22:18, 18 October 2011
Author:reedy
Status:ok
Tags:
Comment:
Strange dynamic singleton code doesn't work in php 5.2 (gives syntax errors on fenari so can't scap)

Swap for singleton class map in ApiContestQuery and comment out problem line in ContestValidationTests
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/Contest/api/ApiContestQuery.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/test/ContestValidationTests.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/Contest/test/ContestValidationTests.php
@@ -50,7 +50,7 @@
5151 $classes = array( 'Contest', 'ContestChallenge' );
5252
5353 foreach ( $classes as $class ) {
54 - $this->assertEquals( count( $class::s()->select() ), $class::s()->count() );
 54+// $this->assertEquals( count( $class::s()->select() ), $class::s()->count() );
5555 }
5656 }
5757
Index: branches/wmf/1.18wmf1/extensions/Contest/api/ApiContestQuery.php
@@ -40,7 +40,11 @@
4141 protected function getClass() {
4242 $className = $this->getClassInfo();
4343 $className = $className['class'];
44 - return $className::s();
 44+ static $classes = array();
 45+ if ( !isset( $classes[$className] ) ) {
 46+ $classes[$className] = new $className( array() );
 47+ }
 48+ return $classes[$className];
4549 }
4650
4751 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r100323Forwards merge r100173 (fixes for php 5.2) after rebranchreedy02:13, 20 October 2011

Status & tagging log