Jack Phoenix has uploaded a new change for review.

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

Change subject: Fix fatals under MW 1.24 + bump time and memory limits
......................................................................

Fix fatals under MW 1.24 + bump time and memory limits

Change-Id: If467f508c2aec208686bcc271df9fb8d8010d80f
---
M RefreshSpecial.body.php
1 file changed, 35 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RefreshSpecial 
refs/changes/77/178177/1

diff --git a/RefreshSpecial.body.php b/RefreshSpecial.body.php
index 75ba53a..37e65e1 100644
--- a/RefreshSpecial.body.php
+++ b/RefreshSpecial.body.php
@@ -38,6 +38,11 @@
                        return;
                }
 
+               // Bump up PHP's memory and time limits a bit, the defaults 
aren't good
+               // enough; this extension's pretty intensive
+               ini_set( 'memory_limit', '512M' );
+               set_time_limit( 240 );
+
                $out->setPageTitle( $this->msg( 'refreshspecial-title' 
)->plain() );
 
                $cSF = new RefreshSpecialForm();
@@ -104,21 +109,29 @@
                 * that brings up an interesting question - do we need that 
limit or not?
                 */
                foreach ( QueryPage::getPages() as $page ) {
-                       @list( $class, $special, $limit ) = $page;
+                       list( $class, $special ) = $page;
+                       $limit = isset( $page[2] ) ? $page[2] : null;
 
                        $specialObj = SpecialPageFactory::getPage( $special );
                        if ( !$specialObj ) {
                                $out->addWikiText( $this->msg( 
'refreshspecial-no-page' )->plain() . " $special\n" );
                                exit;
                        }
-                       $file = $specialObj->getFile();
-                       if ( $file ) {
-                               // @todo FIXME: I have *no* clue why this fugly 
hack is needed,
-                               // but without it MW constructs an invalid 
include path and due
-                               // to the very nature of require_once(), we get 
lovely fatals.
-                               $file = str_replace( 'specialpage/', '', $file 
);
-                               require_once( $file );
+
+                       if ( $specialObj instanceof QueryPage ) {
+                               $queryPage = $specialObj;
+                       } else {
+                               if ( !class_exists( $class ) ) {
+                                       $file = $specialObj->getFile();
+                                       // @todo FIXME: I have *no* clue why 
this fugly hack is needed,
+                                       // but without it MW constructs an 
invalid include path and due
+                                       // to the very nature of 
require_once(), we get lovely fatals.
+                                       $file = str_replace( 'specialpage/', 
'', $file );
+                                       require_once $file;
+                               }
+                               $queryPage = new $class;
                        }
+
                        $queryPage = new $class;
                        $checked = '';
                        if ( $queryPage->isExpensive() ) {
@@ -196,7 +209,8 @@
                );
 
                foreach ( QueryPage::getPages() as $page ) {
-                       @list( $class, $special, $limit ) = $page;
+                       list( $class, $special ) = $page;
+                       $limit = isset( $page[2] ) ? $page[2] : null;
                        if ( !in_array( $special, $to_refresh ) ) {
                                continue;
                        }
@@ -206,13 +220,18 @@
                                $out->addWikiText( $this->msg( 
'refreshspecial-no-page' )->plain() . ": $special\n" );
                                exit;
                        }
-                       $file = $specialObj->getFile();
-                       if ( $file ) {
-                               // @todo FIXME: I have *no* clue why this fugly 
hack is needed,
-                               // but without it MW constructs an invalid 
include path and due
-                               // to the very nature of require_once(), we get 
lovely fatals.
-                               $file = str_replace( 'specialpage/', '', $file 
);
-                               require_once( $file );
+                       if ( $specialObj instanceof QueryPage ) {
+                               $queryPage = $specialObj;
+                       } else {
+                               if ( !class_exists( $class ) ) {
+                                       $file = $specialObj->getFile();
+                                       // @todo FIXME: I have *no* clue why 
this fugly hack is needed,
+                                       // but without it MW constructs an 
invalid include path and due
+                                       // to the very nature of 
require_once(), we get lovely fatals.
+                                       $file = str_replace( 'specialpage/', 
'', $file );
+                                       require_once $file;
+                               }
+                               $queryPage = new $class;
                        }
                        $queryPage = new $class;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If467f508c2aec208686bcc271df9fb8d8010d80f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RefreshSpecial
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <j...@countervandalism.net>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to