Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/95479


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, 20 insertions(+), 30 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/79/95479/1

diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index ce74c51..d979927 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -792,9 +792,7 @@
        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 ) );
@@ -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' ) ) {
@@ -1256,8 +1253,7 @@
        $wgCentralAuthLoginIcon = $wmgCentralAuthLoginIcon;
        $wgCentralAuthAutoNew = true;
 
-       $wgHooks['CentralAuthWikiList'][] = 'wmfCentralAuthWikiList';
-       function wmfCentralAuthWikiList( &$list ) {
+       $wgHooks['CentralAuthWikiList'][] = function( &$list ) {
                global $wgLocalDatabases, $IP, $wgSiteMatrixPrivateSites,
                        $wgSiteMatrixFishbowlSites, $wgSiteMatrixClosedSites;
 
@@ -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();
@@ -1315,7 +1307,7 @@
        return true;
 }
 
-function logPrefsEmail( $user, $old, $new ) {
+$wgHooks['PrefsEmailAudit'][] = function( $user, $old, $new ) {
        if ( $user->isAllowed( 'delete' ) ) {
                global $wgRequest;
                $headers = apache_request_headers();
@@ -1332,7 +1324,7 @@
        return true;
 }
 
-function logPrefsPassword( $user, $pass, $status ) {
+$wgHooks['PrefsPasswordAudit'][] = function( $user, $pass, $status ) {
        if ( $user->isAllowed( 'delete' ) ) {
                global $wgRequest;
                $headers = apache_request_headers();
@@ -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: newchange
Gerrit-Change-Id: I0ba056cce8e1ec53468105d551e4509c66c4b518
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>

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

Reply via email to