http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89009

Revision: 89009
Author:   foxtrott
Date:     2011-05-27 23:16:49 +0000 (Fri, 27 May 2011)
Log Message:
-----------
followup r89006: use feature detection instead of MW version check

Modified Paths:
--------------
    trunk/extensions/SemanticForms/specials/SF_UploadWindow2.php

Modified: trunk/extensions/SemanticForms/specials/SF_UploadWindow2.php
===================================================================
--- trunk/extensions/SemanticForms/specials/SF_UploadWindow2.php        
2011-05-27 22:55:21 UTC (rev 89008)
+++ trunk/extensions/SemanticForms/specials/SF_UploadWindow2.php        
2011-05-27 23:16:49 UTC (rev 89009)
@@ -1086,15 +1086,17 @@
 }
 
 global $wgVersion;
+$uceMethod = new ReflectionMethod( 'SpecialPage', 'userCanExecute' );
+$uceParams = $uceMethod->getParameters();
 // @TODO The "User" class was added to the function header
 // for SpecialPage::userCanExecute in MW 1.18 (r86407) - somehow
 // both the old and new signatures need to be supported. When support
 // is dropped for MW below 1.18 this should be reintegrated into one
 // class.
-if ( version_compare( $wgVersion, '1.18alpha', '<' )) {
+if ( $uceParams[0]->getClass() ) { // found a class definition for param $user
 
        /**
-        * Class variant for MW up to 1.17
+        * Class variant for MW 1.18+
         */
        class SFUploadWindow2 extends SFUploadWindow2Proto {
                /**
@@ -1105,7 +1107,7 @@
                 * @param User $user
                 * @return bool
                 */
-               public function userCanExecute( $user ) {
+               public function userCanExecute( User $user ) {
                        return UploadBase::isEnabled() && 
parent::userCanExecute( $user );
                }
 
@@ -1115,7 +1117,7 @@
 } else {
 
        /**
-        * Class variant for MW 1.18+
+        * Class variant for MW up to 1.17
         */
        class SFUploadWindow2 extends SFUploadWindow2Proto {
                /**
@@ -1126,7 +1128,7 @@
                 * @param User $user
                 * @return bool
                 */
-               public function userCanExecute( User $user ) {
+               public function userCanExecute( $user ) {
                        return UploadBase::isEnabled() && 
parent::userCanExecute( $user );
                }
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to