From: Happy-melon Date: Thu, 6 Jan 2011 20:40:42 +0000 (+0000) Subject: More ancient deprecated functions: X-Git-Tag: 1.31.0-rc.0~32746 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=128f33aa5edc;p=lhc%2Fweb%2Fwiklou.git More ancient deprecated functions: * OutputPage::setParserOptions() - 1.6 (r12183) * OutputPage::addPrimaryWikitext() - 1.10 (r19095) * OutputPage::addSecondaryWikiText() - 1.10 (r19520) * OutputPage::tryParserCache() - 1.16 (r52888) * OutputPage::reportTime() - 1.6 (r11117) * OutputPage:: - 1.7 (r14631) --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 4127210ce0..0d761a64d2 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1000,14 +1000,6 @@ class OutputPage { $this->mDebugtext .= $text; } - /** - * @deprecated use parserOptions() instead - */ - public function setParserOptions( $options ) { - wfDeprecated( __METHOD__ ); - return $this->parserOptions( $options ); - } - /** * Get/set the ParserOptions object to use for wikitext parsing * @@ -1118,43 +1110,6 @@ class OutputPage { wfProfileOut( __METHOD__ ); } - /** - * Add wikitext to the buffer, assuming that this is the primary text for a page view - * Saves the text into the parser cache if possible. - * - * @param $text String: wikitext - * @param $article Article object - * @param $cache Boolean - * @deprecated Use Article::outputWikitext - */ - public function addPrimaryWikiText( $text, $article, $cache = true ) { - global $wgParser; - - wfDeprecated( __METHOD__ ); - - $popts = $this->parserOptions(); - $popts->setTidy( true ); - $parserOutput = $wgParser->parse( - $text, $article->mTitle, - $popts, true, true, $this->mRevisionId - ); - $popts->setTidy( false ); - if ( $cache && $article && $parserOutput->isCacheable() ) { - $parserCache = ParserCache::singleton(); - $parserCache->save( $parserOutput, $article, $popts ); - } - - $this->addParserOutput( $parserOutput ); - } - - /** - * @deprecated use addWikiTextTidy() - */ - public function addSecondaryWikiText( $text, $linestart = true ) { - wfDeprecated( __METHOD__ ); - $this->addWikiTextTitleTidy( $text, $this->getTitle(), $linestart ); - } - /** * Add a ParserOutput object, but without Html * @@ -1282,24 +1237,6 @@ class OutputPage { return $parsed; } - /** - * @deprecated - * - * @param $article Article - * @return Boolean: true if successful, else false. - */ - public function tryParserCache( &$article ) { - wfDeprecated( __METHOD__ ); - $parserOutput = ParserCache::singleton()->get( $article, $article->getParserOptions() ); - - if ( $parserOutput !== false ) { - $this->addParserOutput( $parserOutput ); - return true; - } else { - return false; - } - } - /** * Set the value of the "s-maxage" part of the "Cache-control" HTTP header * @@ -1755,17 +1692,6 @@ class OutputPage { print $outs; } - /** - * @deprecated use wfReportTime() instead. - * - * @return String - */ - public function reportTime() { - wfDeprecated( __METHOD__ ); - $time = wfReportTime(); - return $time; - } - /** * Produce a "user is blocked" page. * @@ -2101,53 +2027,6 @@ class OutputPage { $this->addModules( 'mediawiki.legacy.password' ); } - /** @deprecated */ - public function errorpage( $title, $msg ) { - wfDeprecated( __METHOD__ ); - throw new ErrorPageError( $title, $msg ); - } - - /** @deprecated */ - public function databaseError( $fname, $sql, $error, $errno ) { - throw new MWException( "OutputPage::databaseError is obsolete\n" ); - } - - /** @deprecated */ - public function fatalError( $message ) { - wfDeprecated( __METHOD__ ); - throw new FatalError( $message ); - } - - /** @deprecated */ - public function unexpectedValueError( $name, $val ) { - wfDeprecated( __METHOD__ ); - throw new FatalError( wfMsg( 'unexpected', $name, $val ) ); - } - - /** @deprecated */ - public function fileCopyError( $old, $new ) { - wfDeprecated( __METHOD__ ); - throw new FatalError( wfMsg( 'filecopyerror', $old, $new ) ); - } - - /** @deprecated */ - public function fileRenameError( $old, $new ) { - wfDeprecated( __METHOD__ ); - throw new FatalError( wfMsg( 'filerenameerror', $old, $new ) ); - } - - /** @deprecated */ - public function fileDeleteError( $name ) { - wfDeprecated( __METHOD__ ); - throw new FatalError( wfMsg( 'filedeleteerror', $name ) ); - } - - /** @deprecated */ - public function fileNotFoundError( $name ) { - wfDeprecated( __METHOD__ ); - throw new FatalError( wfMsg( 'filenotfound', $name ) ); - } - public function showFatalError( $message ) { $this->setPageTitle( wfMsg( 'internalerror' ) ); $this->setRobotPolicy( 'noindex,nofollow' ); @@ -2917,7 +2796,7 @@ class OutputPage { * @param $modules Array: list of jQuery modules which should be loaded * @return Array: the list of modules which were not loaded. * @since 1.16 - * @deprecated No longer needed as of 1.17 + * @deprecated @since 1.17 */ public function includeJQuery( $modules = array() ) { return array(); diff --git a/includes/specials/SpecialComparePages.php b/includes/specials/SpecialComparePages.php index 4650fc9458..fe5d8db78e 100644 --- a/includes/specials/SpecialComparePages.php +++ b/includes/specials/SpecialComparePages.php @@ -40,47 +40,6 @@ class SpecialComparePages extends SpecialPage { parent::__construct( 'ComparePages' ); } - protected function setup( $par ) { - global $wgRequest, $wgUser; - - // Options - $opts = new FormOptions(); - $this->opts = $opts; // bind - $opts->add( 'page1', '' ); - $opts->add( 'page2', '' ); - $opts->add( 'rev1', '' ); - $opts->add( 'rev2', '' ); - $opts->add( 'action', '' ); - - // Set values - $opts->fetchValuesFromRequest( $wgRequest ); - - $title1 = Title::newFromText( $opts->getValue( 'page1' ) ); - $title2 = Title::newFromText( $opts->getValue( 'page2' ) ); - - if( $title1 && $title1->exists() && $opts->getValue( 'rev1' ) == '' ) { - $pda = new Article( $title1 ); - $pdi = $pda->getID(); - $pdLastRevision = Revision::loadFromPageId( wfGetDB( DB_SLAVE ), $pdi ); - $opts->setValue( 'rev1', $pdLastRevision->getId() ); - } elseif ( $opts->getValue( 'rev1' ) != '' ) { - $pdrev = Revision::newFromId( $opts->getValue( 'rev1' ) ); - if( $pdrev ) $opts->setValue( 'page1', $pdrev->getTitle()->getPrefixedText() ); - } - if( $title2 && $title2->exists() && $opts->getValue( 'rev2' ) == '' ) { - $pda = new Article( $title2 ); - $pdi = $pda->getID(); - $pdLastRevision = Revision::loadFromPageId( wfGetDB( DB_SLAVE ), $pdi ); - $opts->setValue('rev2', $pdLastRevision->getId() ); - } elseif ( $opts->getValue( 'rev2' ) != '' ) { - $pdrev = Revision::newFromId( $opts->getValue( 'rev2' ) ); - if( $pdrev ) $opts->setValue( 'page2', $pdrev->getTitle()->getPrefixedText() ); - } - - // Store some objects - $this->skin = $wgUser->getSkin(); - } - /** * Show a form for filtering namespace and username * @@ -91,80 +50,87 @@ class SpecialComparePages extends SpecialPage { $this->setHeaders(); $this->outputHeader(); - $this->setup( $par ); + $form = new HTMLForm( array( + 'Page1' => array( + 'type' => 'text', + 'name' => 'page1', + 'label-message' => 'compare-page1', + 'size' => '40', + 'section' => 'page1', + ), + 'Revision1' => array( + 'type' => 'int', + 'name' => 'rev1', + 'label-message' => 'compare-rev1', + 'size' => '8', + 'section' => 'page1', + ), + 'Page2' => array( + 'type' => 'text', + 'name' => 'page2', + 'label-message' => 'compare-page2', + 'size' => '40', + 'section' => 'page2', + ), + 'Revision2' => array( + 'type' => 'int', + 'name' => 'rev2', + 'label-message' => 'compare-rev2', + 'size' => '8', + 'section' => 'page2', + ), + 'Action' => array( + 'type' => 'hidden', + 'name' => 'action', + ), + 'Diffonly' => array( + 'type' => 'hidden', + 'name' => 'diffonly', + ), + ), 'compare' ); + $form->setSubmitText( wfMsg( 'compare-submit' ) ); + $form->suppressReset(); + $form->setMethod( 'get' ); + $form->setTitle( $this->getTitle() ); + + $form->loadData(); + $form->displayForm( '' ); + + self::showDiff( $form->mFieldData ); + } + + public static function showDiff( $data ){ + + if( $data['Revision1'] ){ + $rev1 = $data['Revision1']; + } elseif( $data['Page1'] ) { + $title = Title::newFromText( $data['Page1'] ); + if( $title instanceof Title ){ + $rev1 = $title->getLatestRevID(); + } + } else { + $rev1 = null; + } - // Settings - $this->form(); + if( $data['Revision2'] ){ + $rev2 = $data['Revision2']; + } elseif( $data['Page2'] ) { + $title = Title::newFromText( $data['Page2'] ); + if( $title instanceof Title ){ + $rev2 = $title->getLatestRevID(); + } + } else { + $rev2 = null; + } - if( $this->opts->getValue( 'rev1' ) && $this->opts->getValue( 'rev2' ) ) { + if( $rev1 && $rev2 ) { $de = new DifferenceEngine( null, - $this->opts->getValue( 'rev1' ), - $this->opts->getValue( 'rev2' ), + $rev1, + $rev2, null, // rcid - ( $this->opts->getValue( 'action' ) == 'purge' ), + ( $data["Action"] == 'purge' ), false ); $de->showDiffPage( true ); } } - - protected function form() { - global $wgOut, $wgScript; - - // Consume values - $page1 = $this->opts->consumeValue( 'page1' ); - $page2 = $this->opts->consumeValue( 'page2' ); - $rev1 = $this->opts->consumeValue( 'rev1' ); - $rev2 = $this->opts->consumeValue( 'rev2' ); - - // Store query values in hidden fields so that form submission doesn't lose them - $hidden = array(); - foreach ( $this->opts->getUnconsumedValues() as $key => $value ) { - $hidden[] = Html::hidden( $key, $value ); - } - $hidden = implode( "\n", $hidden ); - - $form = Html::openElement( 'form', array( 'action' => $wgScript ) ) . - Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . - Xml::fieldset( wfMsg( 'compare-selector' ) ) . - Html::openElement( 'table', array( 'id' => 'mw-diff-table', 'style' => 'width:100%' ) ) . - " - " . - Html::element( 'label', array( 'for' => 'page1' ), wfMsg( 'compare-page1' ) ) . - " - " . - Html::input( 'page1', $page1, 'text', array( 'size' => 40, 'id' => 'page1' ) ) . - " - " . - Html::element( 'label', array( 'for' => 'page2' ), wfMsg( 'compare-page2' ) ) . - " - " . - Html::input( 'page2', $page2, 'text', array( 'size' => 40, 'id' => 'page2' ) ) . - " - " . - " - " . - Html::element( 'label', array( 'for' => 'rev1' ), wfMsg( 'compare-rev1' ) ) . - " - " . - Html::input( 'rev1', $rev1, 'text', array( 'size' => 8, 'id' => 'rev1' ) ) . - " - " . - Html::element( 'label', array( 'for' => 'rev2' ), wfMsg( 'compare-rev2' ) ) . - " - " . - Html::input( 'rev2', $rev2, 'text', array( 'size' => 8, 'id' => 'rev2' ) ) . - " - " . - " - " . - Xml::submitButton( wfMsg( 'compare-submit' ) ) . - " - " . - Html::closeElement( 'table' ) . - Html::closeElement( 'fieldset' ) . - $hidden . - Html::closeElement( 'form' ); - - $wgOut->addHTML( $form ); - } }