jenkins-bot has submitted this change and it was merged.

Change subject: Change numerous global functions for anonymous ones
......................................................................


Change numerous global functions for anonymous ones

Change-Id: I0ba056cce8e1ec53468105d551e4509c66c4b518
---
M wmf-config/CommonSettings.php
1 file changed, 26 insertions(+), 36 deletions(-)

Approvals:
  Reedy: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index c9327a3..d2f2736 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -792,14 +792,12 @@
        include( $IP . '/extensions/SecurePoll/SecurePoll.php' );
 
        $wgSecurePollScript = 'auth-api.php';
-       $wgHooks['SecurePoll_JumpUrl'][] = 'wmfSecurePollJumpUrl';
-
-       function wmfSecurePollJumpUrl( $page, &$url ) {
+       $wgHooks['SecurePoll_JumpUrl'][] = function( $page, &$url ) {
                global $site, $lang;
 
                $url = wfAppendQuery( $url, array( 'site' => $site, 'lang' => 
$lang ) );
                return true;
-       }
+       };
 }
 
 // PoolCounter
@@ -956,7 +954,7 @@
 }
 
 if ( $wmgUseFooterContactLink ) {
-       $wgHooks['SkinTemplateOutputPageBeforeExec'][] = function ( $sk, &$tpl 
) {
+       $wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $sk, &$tpl ) 
{
                $contactLink = Html::element( 'a', array( 'href' => $sk->msg( 
'contact-url' )->escaped() ),
                        $sk->msg( 'contact' )->text() );
                $tpl->set( 'contact', $contactLink );
@@ -1108,8 +1106,7 @@
 }
 
 // Disable redirects to HTTPS for clients in some countries
-$wgHooks['CanIPUseHTTPS'][] = 'wmfCanIPUseHTTPS';
-function wmfCanIPUseHTTPS( $ip, &$canDo ) {
+$wgHooks['CanIPUseHTTPS'][] = function( $ip, &$canDo ) {
        global $wmgHTTPSBlacklistCountries;
 
        if ( !function_exists( 'geoip_country_code_by_name' ) ) {
@@ -1125,7 +1122,7 @@
                $canDo = false;
        }
        return true;
-}
+};
 
 if ( isset( $_REQUEST['captchabypass'] ) && $_REQUEST['captchabypass'] == 
$wmgCaptchaPassword ) {
        $wmgEnableCaptcha = false;
@@ -1256,8 +1253,7 @@
        $wgCentralAuthLoginIcon = $wmgCentralAuthLoginIcon;
        $wgCentralAuthAutoNew = true;
 
-       $wgHooks['CentralAuthWikiList'][] = 'wmfCentralAuthWikiList';
-       function wmfCentralAuthWikiList( &$list ) {
+       $wgHooks['CentralAuthWikiList'][] = function( &$list ) {
                global $wgLocalDatabases, $IP, $wgSiteMatrixPrivateSites,
                        $wgSiteMatrixFishbowlSites, $wgSiteMatrixClosedSites;
 
@@ -1268,7 +1264,7 @@
                        $wgSiteMatrixClosedSites
                );
                return true;
-       }
+       };
 
        // Let's give it another try
        $wgCentralAuthCreateOnView = true;
@@ -1283,11 +1279,7 @@
 }
 $wgMajorSiteNoticeID = '2';
 
-$wgHooks['LoginAuthenticateAudit'][] = 'logBadPassword';
-$wgHooks['PrefsEmailAudit'][] = 'logPrefsEmail';
-$wgHooks['PrefsPasswordAudit'][] = 'logPrefsPassword';
-
-function logBadPassword( $user, $pass, $retval ) {
+$wgHooks['LoginAuthenticateAudit'][] = function( $user, $pass, $retval ) {
        if ( $user->isAllowed( 'delete' ) && $retval != LoginForm::SUCCESS ) {
                global $wgRequest;
                $headers = apache_request_headers();
@@ -1313,9 +1305,9 @@
                         );
        }
        return true;
-}
+};
 
-function logPrefsEmail( $user, $old, $new ) {
+$wgHooks['PrefsEmailAudit'][] = function( $user, $old, $new ) {
        if ( $user->isAllowed( 'delete' ) ) {
                global $wgRequest;
                $headers = apache_request_headers();
@@ -1330,9 +1322,9 @@
                        '' );
        }
        return true;
-}
+};
 
-function logPrefsPassword( $user, $pass, $status ) {
+$wgHooks['PrefsPasswordAudit'][] = function( $user, $pass, $status ) {
        if ( $user->isAllowed( 'delete' ) ) {
                global $wgRequest;
                $headers = apache_request_headers();
@@ -1347,7 +1339,7 @@
                        '' );
        }
        return true;
-}
+};
 
 if ( file_exists( '/etc/wikimedia-image-scaler' ) ) {
        $wgMaxShellMemory = 400 * 1024;
@@ -1480,24 +1472,22 @@
        include "$IP/extensions/WikimediaMessages/WikimediaLicenseTexts.php";
 }
 
-function wfNoDeleteMainPage( &$title, &$user, $action, &$result ) {
-       if ( $action !== 'delete' && $action !== 'move' ) {
-               return true;
-       }
-       $main = Title::newMainPage();
-       $mainText = $main->getPrefixedDBkey();
-       if ( $mainText === $title->getPrefixedDBkey() ) {
-               $result = array( 'cant-delete-main-page' );
-               return false;
-       }
-       return true;
-}
-
 if ( $wgDBname == 'enwiki' ) {
-       // Please don't interferew with our hundreds of wikis ability to manage 
themselves.
+       // Please don't interfere with our hundreds of wikis ability to manage 
themselves.
        // Only use this shitty hack for enwiki. Thanks.
        // -- brion 2008-04-10
-       $wgHooks['getUserPermissionsErrorsExpensive'][] = 'wfNoDeleteMainPage';
+       $wgHooks['getUserPermissionsErrorsExpensive'][] = function( &$title, 
&$user, $action, &$result ) {
+               if ( $action !== 'delete' && $action !== 'move' ) {
+                       return true;
+               }
+               $main = Title::newMainPage();
+               $mainText = $main->getPrefixedDBkey();
+               if ( $mainText === $title->getPrefixedDBkey() ) {
+                       $result = array( 'cant-delete-main-page' );
+                       return false;
+               }
+               return true;
+       };
 }
 
 // PHP language binding to make Swift accessible via cURL

-- 
To view, visit https://gerrit.wikimedia.org/r/95479
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0ba056cce8e1ec53468105d551e4509c66c4b518
Gerrit-PatchSet: 3
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to