r68760 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68759‎ | r68760 | r68761 >
Date:04:25, 30 June 2010
Author:mah
Status:ok (Comments)
Tags:
Comment:
r68756 - Make the use of MW_CONFIG_CALLBACK compatible with PHP 5.1
Modified paths:
  • /trunk/phase3/includes/WebStart.php (modified) (history)
  • /trunk/phase3/maintenance/doMaintenance.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/doMaintenance.php
@@ -2,7 +2,7 @@
33 /**
44 * We want to make this whole thing as seamless as possible to the
55 * end-user. Unfortunately, we can't do _all_ of the work in the class
6 - * because A) included files are not in global scope, but in the scope
 6+ * because A) included files are not in global scope, but in the scope
77 * of their caller, and B) MediaWiki has way too many globals. So instead
88 * we'll kinda fake it, and do the requires() inline. <3 PHP
99 *
@@ -64,7 +64,12 @@
6565 if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
6666 # Use a callback function to configure MediaWiki
6767 require_once( "$IP/includes/DefaultSettings.php" );
68 - call_user_func( MW_CONFIG_CALLBACK );
 68+
 69+ $callback = MW_CONFIG_CALLBACK;
 70+ if ( strpos( $callback, '::' ) !== false ) {
 71+ $callback = explode( '::', $callback, 2);
 72+ }
 73+ call_user_func( $callback );
6974 } elseif ( file_exists( "$IP/wmf-config/wikimedia-mode" ) ) {
7075 // Load settings, using wikimedia-mode if needed
7176 // Fixme: replace this hack with general farm-friendly code
Index: trunk/phase3/includes/WebStart.php
@@ -101,7 +101,12 @@
102102 if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
103103 # Use a callback function to configure MediaWiki
104104 require_once( "$IP/includes/DefaultSettings.php" );
105 - call_user_func( MW_CONFIG_CALLBACK );
 105+
 106+ $callback = MW_CONFIG_CALLBACK;
 107+ if ( strpos( $callback, '::' ) !== false ) {
 108+ $callback = explode( '::', $callback, 2);
 109+ }
 110+ call_user_func( $callback );
106111 } else {
107112 # LocalSettings.php is the per site customization file. If it does not exit
108113 # the wiki installer need to be launched or the generated file moved from

Follow-up revisions

RevisionCommit summaryAuthorDate
r74975Followup r68760: add commentdemon22:37, 18 October 2010
r79479Per my comment on r68760: Make MWfunction class, complete with call_user_func...soxred9306:48, 2 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r68756Fix for r68645: <doclink> was removed in refactordemon00:52, 30 June 2010

Comments

#Comment by MarkAHershberger (talk | contribs)   04:27, 30 June 2010

commit comment is incorrect: should be r68645

#Comment by Platonides (talk | contribs)   12:25, 7 July 2010

Shouldn't you add a comment in the code to note why you are going the explode() way?

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

Instead of these explodes everywhere, maybe we should make a global function (ewwwwww) or class method that does those automatically.

Status & tagging log