r106084 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106083‎ | r106084 | r106085 >
Date:20:37, 13 December 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
fix deprecated method usage
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
@@ -123,7 +123,7 @@
124124 * Helper function - returns a URL that includes Special:FormEdit.
125125 */
126126 static function getFormEditURL( $formName, $targetName) {
127 - $fe = SpecialPage::getPage( 'FormEdit' );
 127+ $fe = SFUtils::getSpecialPage( 'FormEdit' );
128128 // Special handling for forms whose name contains a slash.
129129 if ( strpos( $formName, '/' ) !== false ) {
130130 return $fe->getTitle()->getLocalURL( array( 'form' => $formName, 'target' => $targetName ) );
Index: trunk/extensions/SemanticForms/specials/SF_FormEdit.php
@@ -72,7 +72,7 @@
7373
7474 static function printAltFormsList( $alt_forms, $target_name ) {
7575 $text = "";
76 - $fe = SpecialPage::getPage( 'FormEdit' );
 76+ $fe = SFUtils::getSpecialPage( 'FormEdit' );
7777 $fe_url = $fe->getTitle()->getFullURL();
7878 $i = 0;
7979 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 = SpecialPage::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,8 @@
205205 return null;
206206 }
207207
208 - $fe = SpecialPage::getPage( 'FormEdit' );
 208+ $fe = SFUtils::getSpecialPage( 'FormEdit' );
 209+
209210 $fe_url = $fe->getTitle()->getLocalURL();
210211 if ( count( $default_forms ) > 0 ) {
211212 $form_edit_url = $fe_url . "/" . $default_forms[0] . "/" . SFUtils::titleURLString( $target_page_title );
Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -215,7 +215,7 @@
216216 }
217217 }
218218
219 - $ad = SpecialPage::getPage( 'FormEdit' );
 219+ $ad = SFUtils::getSpecialPage( 'FormEdit' );
220220 $link_url = $ad->getTitle()->getLocalURL() . "/$inFormName";
221221 if ( ! empty( $inTargetName ) ) {
222222 $link_url .= "/$inTargetName";
@@ -332,7 +332,8 @@
333333 $inQueryStr = $param;
334334 }
335335
336 - $fs = SpecialPage::getPage( 'FormStart' );
 336+ $fs = SFUtils::getSpecialPage( 'FormStart' );
 337+
337338 $fs_url = $fs->getTitle()->getLocalURL();
338339 $str = <<<END
339340 <form name="createbox" action="$fs_url" method="get" class="$classStr">
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextInput.php
@@ -43,7 +43,7 @@
4444 }
4545
4646 public static function uploadableHTML( $input_id, $delimiter = null, $default_filename = null, $cur_value = '', $other_args = array() ) {
47 - $upload_window_page = SpecialPage::getPage( 'UploadWindow' );
 47+ $upload_window_page = SFUtils::getSpecialPage( 'UploadWindow' );
4848 $query_string = "sfInputID=$input_id";
4949 if ( $delimiter != null ) {
5050 $query_string .= "&sfDelimiter=$delimiter";
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -836,4 +836,21 @@
837837
838838 return true;
839839 }
 840+
 841+ /**
 842+ * Compatibility helper function.
 843+ * Since 1.17 SpecialPageFactory::getPage should be used.
 844+ * SpecialPage::getPage is deprecated in 1.18.
 845+ *
 846+ * @since 2.3.3
 847+ *
 848+ * @param string $pageName
 849+ *
 850+ * @return SpecialPage|null
 851+ */
 852+ public static function getSpecialPage( $pageName ) {
 853+ $hasFactory = class_exists( 'SpecialPageFactory' ) && method_exists( 'SpecialPageFactory', 'getPage' );
 854+ return $hasFactory ? SpecialPageFactory::getPage( $pageName ) : SpecialPage::getPage( $pageName );
 855+ }
 856+
840857 }

Status & tagging log