http://www.mediawiki.org/wiki/Special:Code/MediaWiki/68537

Revision: 68537
Author:   juliano
Date:     2010-06-25 01:02:45 +0000 (Fri, 25 Jun 2010)

Log Message:
-----------
Allow Special:Wikilog queries by namespace.

Modified Paths:
--------------
    trunk/extensions/Wikilog/RELEASE-NOTES
    trunk/extensions/Wikilog/SpecialWikilog.php
    trunk/extensions/Wikilog/WikilogQuery.php

Modified: trunk/extensions/Wikilog/RELEASE-NOTES
===================================================================
--- trunk/extensions/Wikilog/RELEASE-NOTES      2010-06-25 00:39:04 UTC (rev 
68536)
+++ trunk/extensions/Wikilog/RELEASE-NOTES      2010-06-25 01:02:45 UTC (rev 
68537)
@@ -43,6 +43,9 @@
 * Comment syndication feeds are now available. Currently, there is one feed
   per wikilog article, that lists comments made to that article. In the
   future, feeds per thread, per wikilog and global may be provided.
+* Added support for MediaWiki 1.16 Vector skin.
+* Special:Wikilog now allows quering by namespace, with the "Namespace:*"
+  syntax.
 
 === Bug fixes ===
 
@@ -56,6 +59,7 @@
   Noted by Vitaliy Filippov.
 * Don't croak in Wikilog::getWikilogInfo() if $title is NULL. Patch by
   Vitaliy Filippov.
+* Improved consistency of edit links with the rest of MediaWiki.
 
 
 == Wikilog 1.0.1 ==

Modified: trunk/extensions/Wikilog/SpecialWikilog.php
===================================================================
--- trunk/extensions/Wikilog/SpecialWikilog.php 2010-06-25 00:39:04 UTC (rev 
68536)
+++ trunk/extensions/Wikilog/SpecialWikilog.php 2010-06-25 01:02:45 UTC (rev 
68537)
@@ -403,7 +403,12 @@
                $query = new WikilogItemQuery();
                $query->setPubStatus( $opts['show'] );
                if ( ( $t = $opts['wikilog'] ) ) {
-                       $query->setWikilogTitle( Title::newFromText( $t ) );
+                       $t = Title::newFromText( $t );
+                       if ( $t->getText() == '*' ) {
+                               $query->setNamespace( $t->getNamespace() );
+                       } else {
+                               $query->setWikilogTitle( $t );
+                       }
                }
                if ( ( $t = $opts['category'] ) ) {
                        $query->setCategory( $t );

Modified: trunk/extensions/Wikilog/WikilogQuery.php
===================================================================
--- trunk/extensions/Wikilog/WikilogQuery.php   2010-06-25 00:39:04 UTC (rev 
68536)
+++ trunk/extensions/Wikilog/WikilogQuery.php   2010-06-25 01:02:45 UTC (rev 
68537)
@@ -158,6 +158,7 @@
 
        # Local variables.
        private $mWikilogTitle = null;                  ///< Filter by wikilog.
+       private $mNamespace = false;                    ///< Filter by 
namespace.
        private $mPubStatus = self::PS_ALL;             ///< Filter by 
published status.
        private $mCategory = false;                             ///< Filter by 
category.
        private $mAuthor = false;                               ///< Filter by 
author.
@@ -195,6 +196,14 @@
        }
 
        /**
+        * Sets the wikilog namespace to query for.
+        * @param $ns Namespace to query for.
+        */
+       public function setNamespace( $ns ) {
+               $this->mNamespace = $ns;
+       }
+
+       /**
         * Sets the publish status to query for.
         * @param $pubStatus Publish status, string or integer.
         */
@@ -273,12 +282,13 @@
        /**
         * Accessor functions.
         */
-       public function getWikilogTitle()       { return $this->mWikilogTitle; }
-       public function getPubStatus()          { return $this->mPubStatus; }
-       public function getCategory()           { return $this->mCategory; }
-       public function getAuthor()             { return $this->mAuthor; }
-       public function getTag()                        { return $this->mTag; }
-       public function getDate()                       { return $this->mDate; }
+       public function getWikilogTitle() { return $this->mWikilogTitle; }
+       public function getNamespace() { return $this->mNamespace; }
+       public function getPubStatus() { return $this->mPubStatus; }
+       public function getCategory() { return $this->mCategory; }
+       public function getAuthor() { return $this->mAuthor; }
+       public function getTag() { return $this->mTag; }
+       public function getDate() { return $this->mDate; }
 
        /**
         * Organizes all the query information and constructs the table and
@@ -305,6 +315,8 @@
                # Filter by wikilog name.
                if ( $this->mWikilogTitle !== null ) {
                        $q_conds['wlp_parent'] = 
$this->mWikilogTitle->getArticleId();
+               } elseif ( $this->mNamespace ) {
+                       $q_conds['p.page_namespace'] = $this->mNamespace;
                }
 
                # Filter by published status.
@@ -368,6 +380,8 @@
 
                if ( $this->mNeedWikilogParam && $this->mWikilogTitle ) {
                        $query['wikilog'] = 
$this->mWikilogTitle->getPrefixedDBKey();
+               } elseif ( $this->mNamespace ) {
+                       $query['wikilog'] = Title::makeTitle( 
$this->mNamespace, "*" )->getPrefixedDBKey();
                }
 
                if ( $this->mPubStatus == self::PS_ALL ) {
@@ -442,6 +456,7 @@
 
        # Local variables.
        private $mModStatus = self::MS_ALL;     ///< Filter by moderation 
status.
+       private $mNamespace = false;            ///< Filter by namespace.
        private $mWikilog = null;                       ///< Filter by wikilog.
        private $mItem = null;                          ///< Filter by wikilog 
item (article).
        private $mThread = false;                       ///< Filter by thread.
@@ -505,8 +520,18 @@
        }
 
        /**
+        * Set the namespace to query for. Only comments for articles published
+        * in the given namespace are returned. The wikilog and item filters 
have
+        * precedence over this filter.
+        * @param $ns Namespace to query for.
+        */
+       public function setNamespace ( $ns ) {
+               $this->mNamespace = $ns;
+       }
+
+       /**
         * Set the wikilog to query for. Only comments for articles published in
-        * the given wikilog is returned. The item filter has precedence over 
this
+        * the given wikilog are returned. The item filter has precedence over 
this
         * filter.
         * @param $wikilogTitle Wikilog title object to query for (Title).
         */
@@ -583,6 +608,7 @@
         * Accessor functions.
         */
        public function getModStatus() { return $this->mModStatus; }
+       public function getNamespace() { return $this->mNamespace; }
        public function getWikilog() { return $this->mWikilog; }
        public function getItem() { return $this->mItem; }
        public function getThread() { return $this->mThread; }
@@ -632,6 +658,8 @@
                } elseif ( $this->mWikilog !== null ) {
                        $join_wlp = true;
                        $q_conds['wlp_parent'] = 
$this->mWikilog->getArticleId();
+               } elseif ( $this->mNamespace ) {
+                       $q_conds['c.page_namespace'] = $this->mNamespace;
                }
 
                # Filter by author.
@@ -678,6 +706,8 @@
                        $query['item'] = 
$this->mItem->mTitle->getPrefixedDBKey();
                } elseif ( $this->mWikilog ) {
                        $query['wikilog'] = $this->mWikilog->getPrefixedDBKey();
+               } elseif ( $this->mNamespace ) {
+                       $query['wikilog'] = Title::makeTitle( 
$this->mNamespace, "*" )->getPrefixedDBKey();
                }
 
                if ( $this->mModStatus != self::MS_ALL ) {



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to