r102755 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102754‎ | r102755 | r102756 >
Date:05:23, 11 November 2011
Author:juliano
Status:deferred
Tags:
Comment:
Remove obsolete code for 1.16 support.
Modified paths:
  • /trunk/extensions/Wikilog/README (modified) (history)
  • /trunk/extensions/Wikilog/TODO (modified) (history)
  • /trunk/extensions/Wikilog/Wikilog.php (modified) (history)
  • /trunk/extensions/Wikilog/WikilogComment.php (modified) (history)
  • /trunk/extensions/Wikilog/WikilogCommentsPage.php (modified) (history)
  • /trunk/extensions/Wikilog/WikilogFeed.php (modified) (history)
  • /trunk/extensions/Wikilog/WikilogHooks.php (modified) (history)
  • /trunk/extensions/Wikilog/WikilogParser.php (modified) (history)
  • /trunk/extensions/Wikilog/WikilogUtils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikilog/WikilogUtils.php
@@ -59,9 +59,6 @@
6060 * parser that we could mess up without interfering with normal page
6161 * rendering, and we can't create a new instance because of too many
6262 * broken extensions around. Check self::parserSanityCheck().
63 - *
64 - * @todo (In Wikilog 1.3.x) Remove deprecated WikilogParserCache
65 - * in favor of ParserOptions::addExtraKey().
6663 */
6764 public static function parsedArticle( Title $title, $feed = false ) {
6865 global $wgWikilogCloneParser;
@@ -84,13 +81,7 @@
8582 if ( $feed ) {
8683 $parserOpt->setEditSection( false );
8784
88 - # NOTE (Mw1.16- COMPAT) ParserOptions::addExtraKey() added in
89 - # MediaWiki 1.17 (r70822) makes WikilogParserCache obsolete.
90 - if ( method_exists( $parserOpt, 'addExtraKey' ) ) {
91 - $parserOpt->addExtraKey( "WikilogFeed" );
92 - } else {
93 - $parserCache = WikilogParserCache::singleton();
94 - }
 85+ $parserOpt->addExtraKey( "WikilogFeed" );
9586 } else {
9687 $parserOpt->enableLimitReport();
9788 }
Index: trunk/extensions/Wikilog/WikilogComment.php
@@ -29,12 +29,6 @@
3030 if ( !defined( 'MEDIAWIKI' ) )
3131 die();
3232
33 -# NOTE (Mw1.16- COMPAT): GAID_FOR_UPDATE removed and replaced by
34 -# Title::GAID_FOR_UPDATE in Mw1.17. Remove this define and replace its
35 -# occurrence WikilogComment::getCommentArticleTitle() in Wl1.3.
36 -if ( !defined( 'GAID_FOR_UPDATE' ) )
37 - define( 'GAID_FOR_UPDATE', Title::GAID_FOR_UPDATE );
38 -
3933 /**
4034 * Wikilog article comment database entry.
4135 */
@@ -244,14 +238,12 @@
245239
246240 /**
247241 * Returns comment article title.
248 - * @todo (In Wikilog 1.3.x) Replace GAID_FOR_UPDATE with
249 - * Title::GAID_FOR_UPDATE.
250242 */
251243 public function getCommentArticleTitle() {
252244 if ( $this->mCommentTitle ) {
253245 return $this->mCommentTitle;
254246 } elseif ( $this->mCommentPage ) {
255 - return Title::newFromID( $this->mCommentPage, GAID_FOR_UPDATE );
 247+ return Title::newFromID( $this->mCommentPage, Title::GAID_FOR_UPDATE );
256248 } else {
257249 $it = $this->mItem->mTitle;
258250 return Title::makeTitle(
Index: trunk/extensions/Wikilog/Wikilog.php
@@ -82,7 +82,6 @@
8383 // WikilogParser.php
8484 'WikilogParser' => $dir . 'WikilogParser.php',
8585 'WikilogParserOutput' => $dir . 'WikilogParser.php',
86 - 'WikilogParserCache' => $dir . 'WikilogParser.php',
8786
8887 // WikilogItemPager.php
8988 'WikilogItemPager' => $dir . 'WikilogItemPager.php',
Index: trunk/extensions/Wikilog/WikilogCommentsPage.php
@@ -29,12 +29,6 @@
3030 if ( !defined( 'MEDIAWIKI' ) )
3131 die();
3232
33 -# NOTE (Mw1.16- COMPAT): GAID_FOR_UPDATE removed and replaced by
34 -# Title::GAID_FOR_UPDATE in Mw1.17. Remove this define and replace its
35 -# occurrence WikilogCommentsPage::setCommentApproval() in Wl1.3.
36 -if ( !defined( 'GAID_FOR_UPDATE' ) )
37 - define( 'GAID_FOR_UPDATE', Title::GAID_FOR_UPDATE );
38 -
3933 /**
4034 * Wikilog comments namespace handler class.
4135 *
@@ -407,7 +401,7 @@
408402 array( 'content', 'parsemag' ),
409403 $comment->mUserText
410404 );
411 - $id = $title->getArticleID( GAID_FOR_UPDATE );
 405+ $id = $title->getArticleID( Title::GAID_FOR_UPDATE );
412406 if ( $this->doDeleteArticle( $reason, false, $id ) ) {
413407 $comment->deleteComment();
414408 $log->addEntry( 'c-reject', $title, '' );
Index: trunk/extensions/Wikilog/WikilogParser.php
@@ -611,43 +611,3 @@
612612 public function getAuthors() { return $this->mAuthors; }
613613 public function getTags() { return $this->mTags; }
614614 }
615 -
616 -/**
617 - * Since wikilog parses articles with specific options in order to be
618 - * rendered in feeds, it is necessary to store these parsed outputs in
619 - * the cache separately. This derived class from ParserCache overloads the
620 - * getKey() function in order to provide a specific namespace for this
621 - * purpose.
622 - *
623 - * @deprecated In MediaWiki 1.17, in favor of $parserOpt->addExtraKey().
624 - * @note MediaWiki 1.17 completely breaks this hack (in r70783). getKey() has
625 - * different parameters and very different implementation. Current version
626 - * is compatible with 1.16 and should only be used in that version, but may
627 - * issue warnings when used in 1.17. In 1.17, this class should never be
628 - * used due to the branch in WikilogUtils::parsedArticle(). It will be
629 - * removed anyways, as soon as we drop support for 1.16.
630 - * @todo (In Wikilog 1.3.x) Remove this class (see also WikilogUtils::parsedArticle()).
631 - */
632 -class WikilogParserCache
633 - extends ParserCache
634 -{
635 - public static function singleton() {
636 - static $instance;
637 - if ( !isset( $instance ) ) {
638 - global $parserMemc;
639 - $instance = new WikilogParserCache( $parserMemc );
640 - }
641 - return $instance;
642 - }
643 -
644 - public function getKey( $article, $popts ) {
645 - if ( $popts instanceof User ) // API change in MediaWiki 1.15.
646 - $popts = ParserOptions::newFromUser( $popts );
647 -
648 - $user = $popts->mUser;
649 - $pageid = intval( $article->getID() );
650 - $hash = $user->getPageRenderingHash();
651 - $key = wfMemcKey( 'wlcache', 'idhash', "$pageid-$hash" );
652 - return $key;
653 - }
654 -}
Index: trunk/extensions/Wikilog/WikilogFeed.php
@@ -242,13 +242,7 @@
243243 "too young: age ($age) < timeout ($wgFeedCacheTimeout) " .
244244 "($feedkey; $tsCache; $tsData)\n" );
245245
246 - # NOTE (Mw1.16- COMPAT): OutputPage::setLastModified()
247 - # introduced in Mw1.17. Remove this guard after Wl1.2.
248 - if ( method_exists( $wgOut, 'setLastModified' ) ) {
249 - $wgOut->setLastModified( $tsCache );
250 - } else {
251 - $wgOut->mLastModified = wfTimestamp( TS_RFC2822, $tsCache );
252 - }
 246+ $wgOut->setLastModified( $tsCache );
253247
254248 return $messageMemc->get( $feedkey );
255249 } elseif ( $tsCache >= $tsData ) {
Index: trunk/extensions/Wikilog/README
@@ -33,7 +33,7 @@
3434
3535 == Requirements ==
3636
37 -* MediaWiki 1.16 or higher.
 37+* MediaWiki 1.17 or higher.
3838 * A MySQL database backend.
3939
4040 == Installation ==
Index: trunk/extensions/Wikilog/WikilogHooks.php
@@ -322,32 +322,19 @@
323323 *
324324 * @todo Add support for PostgreSQL and SQLite databases.
325325 */
326 - static function ExtensionSchemaUpdates( $updater = null ) {
 326+ static function ExtensionSchemaUpdates( $updater ) {
327327 $dir = dirname( __FILE__ ) . '/';
328328
329 - if ( $updater === null ) {
330 - global $wgDBtype, $wgExtNewIndexes, $wgExtNewTables;
331 - if ( $wgDBtype == 'mysql' ) {
332 - $wgExtNewTables[] = array( "wikilog_wikilogs", "{$dir}wikilog-tables.sql" );
333 - $wgExtNewIndexes[] = array( "wikilog_comments", "wlc_timestamp", "{$dir}archives/patch-comments-indexes.sql" );
334 - } else {
335 - // TODO: PostgreSQL, SQLite, etc...
336 - print "\n" .
337 - "Warning: There are no table structures for the Wikilog\n" .
338 - "extension other than for MySQL at this moment.\n\n";
339 - }
 329+ if ( $updater->getDB()->getType() == 'mysql' ) {
 330+ $updater->addExtensionUpdate( array( 'addTable', "wikilog_wikilogs",
 331+ "{$dir}wikilog-tables.sql", true ) );
 332+ $updater->addExtensionUpdate( array( 'addIndex', "wikilog_comments",
 333+ "wlc_timestamp", "{$dir}archives/patch-comments-indexes.sql", true ) );
340334 } else {
341 - if ( $updater->getDB()->getType() == 'mysql' ) {
342 - $updater->addExtensionUpdate( array( 'addTable', "wikilog_wikilogs",
343 - "{$dir}wikilog-tables.sql", true ) );
344 - $updater->addExtensionUpdate( array( 'addIndex', "wikilog_comments",
345 - "wlc_timestamp", "{$dir}archives/patch-comments-indexes.sql", true ) );
346 - } else {
347 - // TODO: PostgreSQL, SQLite, etc...
348 - print "\n" .
349 - "Warning: There are no table structures for the Wikilog\n" .
350 - "extension other than for MySQL at this moment.\n\n";
351 - }
 335+ // TODO: PostgreSQL, SQLite, etc...
 336+ print "\n" .
 337+ "Warning: There are no table structures for the Wikilog\n" .
 338+ "extension other than for MySQL at this moment.\n\n";
352339 }
353340 return true;
354341 }
Index: trunk/extensions/Wikilog/TODO
@@ -2,11 +2,4 @@
33
44 === Wikilog 1.3.0. ===
55
6 -* Drop support for Mw 1.16 and earlier.
7 -* Remove Mw1.16 compatibility boilerplate in:
8 - - WikilogFeed::loadFromCache() (bug 21916).
9 - - WikilogComment::getCommentArticleTitle() (GAID_FOR_UPDATE).
10 - - WikilogCommentsPage::setCommentApproval() (GAID_FOR_UPDATE).
11 -* Remove deprecated WikilogParserCache:
12 - - WikilogParserCache class definition in WikilogParser.php.
13 - - WikilogUtils::parsedArticle() in WikilogUtils.php.
 6+(empty)

Status & tagging log