r112515 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112514‎ | r112515 | r112516 >
Date:21:00, 27 February 2012
Author:foxtrott
Status:ok
Tags:
Comment:
revert r112344, part revert r112224: SpecialPageFactory does not exist until MW 1.18
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Form.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormLinker.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormEdit.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormStart.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php
@@ -121,7 +121,7 @@
122122 * Helper function - returns a URL that includes Special:FormEdit.
123123 */
124124 static function getFormEditURL( $formName, $targetName) {
125 - $fe = SpecialPageFactory::getPage( 'FormEdit' );
 125+ $fe = SFUtils::getSpecialPage( 'FormEdit' );
126126 // Special handling for forms whose name contains a slash.
127127 if ( strpos( $formName, '/' ) !== false ) {
128128 return $fe->getTitle()->getLocalURL( array( 'form' => $formName, 'target' => $targetName ) );
Index: trunk/extensions/SemanticForms/specials/SF_FormEdit.php
@@ -71,7 +71,7 @@
7272
7373 static function printAltFormsList( $alt_forms, $target_name ) {
7474 $text = "";
75 - $fe = SpecialPageFactory::getPage( 'FormEdit' );
 75+ $fe = SFUtils::getSpecialPage( 'FormEdit' );
7676 $fe_url = $fe->getTitle()->getFullURL();
7777 $i = 0;
7878 foreach ( $alt_forms as $alt_form ) {
Index: trunk/extensions/SemanticForms/includes/SF_Form.php
@@ -52,7 +52,7 @@
5353
5454 function createMarkup() {
5555 $title = Title::makeTitle( SF_NS_FORM, $this->mFormName );
56 - $fs = SpecialPageFactory::getPage( 'FormStart' );
 56+ $fs = SFUtils::getSpecialPage( 'FormStart' );
5757 $form_start_url = SFUtils::titleURLString( $fs->getTitle() ) . "/" . $title->getPartialURL();
5858 $form_description = wfMsgForContent( 'sf_form_docu', $this->mFormName, $form_start_url );
5959 $form_input = "{{#forminput:form=" . $this->mFormName;
Index: trunk/extensions/SemanticForms/includes/SF_FormLinker.php
@@ -204,7 +204,7 @@
205205 return null;
206206 }
207207
208 - $fe = SpecialPageFactory::getPage( 'FormEdit' );
 208+ $fe = SFUtils::getSpecialPage( 'FormEdit' );
209209
210210 $fe_url = $fe->getTitle()->getLocalURL();
211211 if ( count( $default_forms ) > 0 ) {
Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -273,7 +273,7 @@
274274 }
275275 }
276276
277 - $fs = SpecialPageFactory::getPage( 'FormStart' );
 277+ $fs = SFUtils::getSpecialPage( 'FormStart' );
278278
279279 $fs_url = $fs->getTitle()->getLocalURL();
280280 $str = <<<END
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextInput.php
@@ -94,7 +94,7 @@
9595 }
9696
9797 public static function uploadableHTML( $input_id, $delimiter = null, $default_filename = null, $cur_value = '', $other_args = array() ) {
98 - $upload_window_page = SpecialPageFactory::getPage( 'UploadWindow' );
 98+ $upload_window_page = SFUtils::getSpecialPage( 'UploadWindow' );
9999 $query_string = "sfInputID=$input_id";
100100 if ( $delimiter != null ) {
101101 $query_string .= "&sfDelimiter=$delimiter";
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -296,7 +296,7 @@
297297 $output = $wgOut;
298298 } else {
299299 $output = $parser->getOutput();
300 - self::addJavascriptFiles( $parser );
 300+ self::addJavascriptFiles( $parser );
301301 }
302302
303303 $output->addModules( 'ext.semanticforms.main' );
@@ -306,7 +306,7 @@
307307 $output->addModules( 'ext.semanticforms.submit' );
308308 $output->addModules( 'ext.smw.tooltips' );
309309 $output->addModules( 'ext.smw.sorttable' );
310 - }
 310+ }
311311
312312 /**
313313 * Returns an array of all form names on this wiki.
@@ -719,6 +719,22 @@
720720 }
721721
722722 /**
 723+ * Compatibility helper function.
 724+ * Since 1.18 SpecialPageFactory::getPage should be used.
 725+ * SpecialPage::getPage is deprecated in 1.18.
 726+ *
 727+ * @since 2.3.3
 728+ *
 729+ * @param string $pageName
 730+ *
 731+ * @return SpecialPage|null
 732+ */
 733+ public static function getSpecialPage( $pageName ) {
 734+ $hasFactory = class_exists( 'SpecialPageFactory' ) && method_exists( 'SpecialPageFactory', 'getPage' );
 735+ return $hasFactory ? SpecialPageFactory::getPage( $pageName ) : SpecialPage::getPage( $pageName );
 736+ }
 737+
 738+ /**
723739 * Returns a SQL condition for autocompletion substring value in a column.
724740 * @param string $value_column Value column name
725741 * @param string $substring Substring to look for
@@ -862,7 +878,7 @@
863879 }
864880 }
865881
866 - $ad = SpecialPageFactory::getPage( $specialPageName );
 882+ $ad = SFUtils::getSpecialPage( $specialPageName );
867883 $link_url = $ad->getTitle()->getLocalURL() . "/$inFormName";
868884 if ( ! empty( $inTargetName ) ) {
869885 $link_url .= "/$inTargetName";
@@ -909,7 +925,7 @@
910926 }
911927
912928 static function loadScriptsForPopupForm( &$parser ) {
913 - $parser->getOutput()->addModules( 'ext.semanticforms.popupformedit' );
 929+ $parser->getOutput()->addModules( 'ext.semanticforms.popupformedit' );
914930 return true;
915931 }
916932

Follow-up revisions

RevisionCommit summaryAuthorDate
r112575Follow-up to r112515 - restored some tabbing that got changedyaron05:00, 28 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112224Removing support for MediaWiki 1.16 - that included removing pre-ResourceLoad...yaron17:20, 23 February 2012
r112344Follow-up to r112224 - removed now-unnecessary helper function SFUtils::getSp...yaron19:51, 24 February 2012

Status & tagging log