r68537 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68536‎ | r68537 | r68538 >
Date:01:02, 25 June 2010
Author:juliano
Status:deferred
Tags:
Comment:
Allow Special:Wikilog queries by namespace.
Modified paths:
  • /trunk/extensions/Wikilog/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/Wikilog/SpecialWikilog.php (modified) (history)
  • /trunk/extensions/Wikilog/WikilogQuery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikilog/SpecialWikilog.php
@@ -403,7 +403,12 @@
404404 $query = new WikilogItemQuery();
405405 $query->setPubStatus( $opts['show'] );
406406 if ( ( $t = $opts['wikilog'] ) ) {
407 - $query->setWikilogTitle( Title::newFromText( $t ) );
 407+ $t = Title::newFromText( $t );
 408+ if ( $t->getText() == '*' ) {
 409+ $query->setNamespace( $t->getNamespace() );
 410+ } else {
 411+ $query->setWikilogTitle( $t );
 412+ }
408413 }
409414 if ( ( $t = $opts['category'] ) ) {
410415 $query->setCategory( $t );
Index: trunk/extensions/Wikilog/WikilogQuery.php
@@ -158,6 +158,7 @@
159159
160160 # Local variables.
161161 private $mWikilogTitle = null; ///< Filter by wikilog.
 162+ private $mNamespace = false; ///< Filter by namespace.
162163 private $mPubStatus = self::PS_ALL; ///< Filter by published status.
163164 private $mCategory = false; ///< Filter by category.
164165 private $mAuthor = false; ///< Filter by author.
@@ -195,6 +196,14 @@
196197 }
197198
198199 /**
 200+ * Sets the wikilog namespace to query for.
 201+ * @param $ns Namespace to query for.
 202+ */
 203+ public function setNamespace( $ns ) {
 204+ $this->mNamespace = $ns;
 205+ }
 206+
 207+ /**
199208 * Sets the publish status to query for.
200209 * @param $pubStatus Publish status, string or integer.
201210 */
@@ -273,12 +282,13 @@
274283 /**
275284 * Accessor functions.
276285 */
277 - public function getWikilogTitle() { return $this->mWikilogTitle; }
278 - public function getPubStatus() { return $this->mPubStatus; }
279 - public function getCategory() { return $this->mCategory; }
280 - public function getAuthor() { return $this->mAuthor; }
281 - public function getTag() { return $this->mTag; }
282 - public function getDate() { return $this->mDate; }
 286+ public function getWikilogTitle() { return $this->mWikilogTitle; }
 287+ public function getNamespace() { return $this->mNamespace; }
 288+ public function getPubStatus() { return $this->mPubStatus; }
 289+ public function getCategory() { return $this->mCategory; }
 290+ public function getAuthor() { return $this->mAuthor; }
 291+ public function getTag() { return $this->mTag; }
 292+ public function getDate() { return $this->mDate; }
283293
284294 /**
285295 * Organizes all the query information and constructs the table and
@@ -305,6 +315,8 @@
306316 # Filter by wikilog name.
307317 if ( $this->mWikilogTitle !== null ) {
308318 $q_conds['wlp_parent'] = $this->mWikilogTitle->getArticleId();
 319+ } elseif ( $this->mNamespace ) {
 320+ $q_conds['p.page_namespace'] = $this->mNamespace;
309321 }
310322
311323 # Filter by published status.
@@ -368,6 +380,8 @@
369381
370382 if ( $this->mNeedWikilogParam && $this->mWikilogTitle ) {
371383 $query['wikilog'] = $this->mWikilogTitle->getPrefixedDBKey();
 384+ } elseif ( $this->mNamespace ) {
 385+ $query['wikilog'] = Title::makeTitle( $this->mNamespace, "*" )->getPrefixedDBKey();
372386 }
373387
374388 if ( $this->mPubStatus == self::PS_ALL ) {
@@ -442,6 +456,7 @@
443457
444458 # Local variables.
445459 private $mModStatus = self::MS_ALL; ///< Filter by moderation status.
 460+ private $mNamespace = false; ///< Filter by namespace.
446461 private $mWikilog = null; ///< Filter by wikilog.
447462 private $mItem = null; ///< Filter by wikilog item (article).
448463 private $mThread = false; ///< Filter by thread.
@@ -505,8 +520,18 @@
506521 }
507522
508523 /**
 524+ * Set the namespace to query for. Only comments for articles published
 525+ * in the given namespace are returned. The wikilog and item filters have
 526+ * precedence over this filter.
 527+ * @param $ns Namespace to query for.
 528+ */
 529+ public function setNamespace ( $ns ) {
 530+ $this->mNamespace = $ns;
 531+ }
 532+
 533+ /**
509534 * Set the wikilog to query for. Only comments for articles published in
510 - * the given wikilog is returned. The item filter has precedence over this
 535+ * the given wikilog are returned. The item filter has precedence over this
511536 * filter.
512537 * @param $wikilogTitle Wikilog title object to query for (Title).
513538 */
@@ -583,6 +608,7 @@
584609 * Accessor functions.
585610 */
586611 public function getModStatus() { return $this->mModStatus; }
 612+ public function getNamespace() { return $this->mNamespace; }
587613 public function getWikilog() { return $this->mWikilog; }
588614 public function getItem() { return $this->mItem; }
589615 public function getThread() { return $this->mThread; }
@@ -632,6 +658,8 @@
633659 } elseif ( $this->mWikilog !== null ) {
634660 $join_wlp = true;
635661 $q_conds['wlp_parent'] = $this->mWikilog->getArticleId();
 662+ } elseif ( $this->mNamespace ) {
 663+ $q_conds['c.page_namespace'] = $this->mNamespace;
636664 }
637665
638666 # Filter by author.
@@ -678,6 +706,8 @@
679707 $query['item'] = $this->mItem->mTitle->getPrefixedDBKey();
680708 } elseif ( $this->mWikilog ) {
681709 $query['wikilog'] = $this->mWikilog->getPrefixedDBKey();
 710+ } elseif ( $this->mNamespace ) {
 711+ $query['wikilog'] = Title::makeTitle( $this->mNamespace, "*" )->getPrefixedDBKey();
682712 }
683713
684714 if ( $this->mModStatus != self::MS_ALL ) {
Index: trunk/extensions/Wikilog/RELEASE-NOTES
@@ -43,6 +43,9 @@
4444 * Comment syndication feeds are now available. Currently, there is one feed
4545 per wikilog article, that lists comments made to that article. In the
4646 future, feeds per thread, per wikilog and global may be provided.
 47+* Added support for MediaWiki 1.16 Vector skin.
 48+* Special:Wikilog now allows quering by namespace, with the "Namespace:*"
 49+ syntax.
4750
4851 === Bug fixes ===
4952
@@ -56,6 +59,7 @@
5760 Noted by Vitaliy Filippov.
5861 * Don't croak in Wikilog::getWikilogInfo() if $title is NULL. Patch by
5962 Vitaliy Filippov.
 63+* Improved consistency of edit links with the rest of MediaWiki.
6064
6165
6266 == Wikilog 1.0.1 ==

Status & tagging log