PHPDocumentor [http://en.wikipedia.org/wiki/PhpDocumentor] documentation tweaking...
[lhc/web/wiklou.git] / includes / QueryPage.php
index e4f5551..d386d12 100644 (file)
@@ -1,42 +1,43 @@
 <?php
 /**
  * Contain a class for special pages
- * @package MediaWiki
  */
 
 /**
- * List of query page classes and their associated special pages, for periodic update purposes
+ * List of query page classes and their associated special pages, 
+ * for periodic updates.
+ *
+ * DO NOT CHANGE THIS LIST without testing that 
+ * maintenance/updateSpecialPages.php still works.
  */
 global $wgQueryPages; // not redundant
 $wgQueryPages = array(
 //         QueryPage subclass           Special page name         Limit (false for none, none for the default)
 //----------------------------------------------------------------------------
-       array( 'AncientPagesPage',              'Ancientpages'                  ),
-       array( 'BrokenRedirectsPage',           'BrokenRedirects'               ),
-       array( 'CategoriesPage',                'Categories'                    ),
-       array( 'DeadendPagesPage',              'Deadendpages'                  ),
-       array( 'DisambiguationsPage',           'Disambiguations'               ),
-       array( 'DoubleRedirectsPage',           'DoubleRedirects'               ),
-       array( 'ListUsersPage',                 'Listusers'                     ),
-       array( 'ListredirectsPage', 'Listredirects' ),
-       array( 'LonelyPagesPage',               'Lonelypages'                   ),
-       array( 'LongPagesPage',                 'Longpages'                     ),
-       array( 'MostcategoriesPage',            'Mostcategories'                ),
-       array( 'MostimagesPage',                'Mostimages'                    ),
-       array( 'MostlinkedCategoriesPage',      'Mostlinkedcategories'          ),
-       array( 'MostlinkedPage',                'Mostlinked'                    ),
-       array( 'MostrevisionsPage',             'Mostrevisions'                 ),
-       array( 'NewPagesPage',                  'Newpages'                      ),
-       array( 'ShortPagesPage',                'Shortpages'                    ),
-       array( 'UncategorizedCategoriesPage',   'Uncategorizedcategories'       ),
-       array( 'UncategorizedPagesPage',        'Uncategorizedpages'            ),
-       array( 'UncategorizedImagesPage', 'Uncategorizedimages' ),
-       array( 'UnusedCategoriesPage',          'Unusedcategories'              ),
-       array( 'UnusedimagesPage',              'Unusedimages'                  ),
-       array( 'WantedCategoriesPage',          'Wantedcategories'              ),
-       array( 'WantedPagesPage',               'Wantedpages'                   ),
-       array( 'UnwatchedPagesPage',            'Unwatchedpages'                ),
-       array( 'UnusedtemplatesPage', 'Unusedtemplates' ),
+       array( 'AncientPagesPage',              'Ancientpages'                  ),
+       array( 'BrokenRedirectsPage',           'BrokenRedirects'               ),
+       array( 'DeadendPagesPage',              'Deadendpages'                  ),
+       array( 'DisambiguationsPage',           'Disambiguations'               ),
+       array( 'DoubleRedirectsPage',           'DoubleRedirects'               ),
+       array( 'ListredirectsPage',             'Listredirects' ),
+       array( 'LonelyPagesPage',               'Lonelypages'                   ),
+       array( 'LongPagesPage',                 'Longpages'                     ),
+       array( 'MostcategoriesPage',            'Mostcategories'                ),
+       array( 'MostimagesPage',                'Mostimages'                    ),
+       array( 'MostlinkedCategoriesPage',      'Mostlinkedcategories'          ),
+       array( 'MostlinkedPage',                'Mostlinked'                    ),
+       array( 'MostrevisionsPage',             'Mostrevisions'                 ),
+       array( 'NewPagesPage',                  'Newpages'                      ),
+       array( 'ShortPagesPage',                'Shortpages'                    ),
+       array( 'UncategorizedCategoriesPage',   'Uncategorizedcategories'       ),
+       array( 'UncategorizedPagesPage',        'Uncategorizedpages'            ),
+       array( 'UncategorizedImagesPage',       'Uncategorizedimages' ),
+       array( 'UnusedCategoriesPage',          'Unusedcategories'              ),
+       array( 'UnusedimagesPage',              'Unusedimages'                  ),
+       array( 'WantedCategoriesPage',          'Wantedcategories'              ),
+       array( 'WantedPagesPage',               'Wantedpages'                   ),
+       array( 'UnwatchedPagesPage',            'Unwatchedpages'                ),
+       array( 'UnusedtemplatesPage',           'Unusedtemplates' ),
 );
 wfRunHooks( 'wgQueryPages', array( &$wgQueryPages ) );
 
@@ -50,7 +51,6 @@ if ( !$wgDisableCounters )
  * we factor out some of the functionality into a superclass, and let
  * subclasses derive from it.
  *
- * @package MediaWiki
  */
 class QueryPage {
        /**
@@ -59,7 +59,7 @@ class QueryPage {
         * @var bool
         */
        var $listoutput = false;
-       
+
        /**
         * The offset and limit in use, as passed to the query() function
         *
@@ -197,8 +197,8 @@ class QueryPage {
         */
        function recache( $limit, $ignoreErrors = true ) {
                $fname = get_class($this) . '::recache';
-               $dbw =& wfGetDB( DB_MASTER );
-               $dbr =& wfGetDB( DB_SLAVE, array( $this->getName(), 'QueryPage::recache', 'vslow' ) );
+               $dbw = wfGetDB( DB_MASTER );
+               $dbr = wfGetDB( DB_SLAVE, array( $this->getName(), 'QueryPage::recache', 'vslow' ) );
                if ( !$dbw || !$dbr ) {
                        return false;
                }
@@ -282,7 +282,7 @@ class QueryPage {
 
                $sname = $this->getName();
                $fname = get_class($this) . '::doQuery';
-               $dbr =& wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_SLAVE );
 
                $wgOut->setSyndicated( $this->isSyndicated() );
 
@@ -312,6 +312,14 @@ class QueryPage {
                                }
        
                                $wgOut->addWikiText( $cacheNotice );
+                               
+                               # If updates on this page have been disabled, let the user know
+                               # that the data set won't be refreshed for now
+                               global $wgDisableQueryPageUpdate;
+                               if( is_array( $wgDisableQueryPageUpdate ) && in_array( $this->getName(), $wgDisableQueryPageUpdate ) ) {
+                                       $wgOut->addWikiText( wfMsg( 'querypage-no-updates' ) );
+                               }
+                               
                        }
 
                }
@@ -327,6 +335,13 @@ class QueryPage {
 
                if($shownavigation) {
                        $wgOut->addHTML( $this->getPageHeader() );
+
+                       # if list is empty, show it
+                       if( $num == 0 ) {
+                               $wgOut->addHTML( '<p>' . wfMsgHTML('specialpage-empty') . '</p>' );
+                               return;
+                       }
+
                        $top = wfShowingResults( $offset, $num);
                        $wgOut->addHTML( "<p>{$top}\n" );
 
@@ -403,7 +418,7 @@ class QueryPage {
                                $this->feedUrl() );
                        $feed->outHeader();
 
-                       $dbr =& wfGetDB( DB_SLAVE );
+                       $dbr = wfGetDB( DB_SLAVE );
                        $sql = $this->getSQL() . $this->getOrder();
                        $sql = $dbr->limitResult( $sql, $limit, 0 );
                        $res = $dbr->query( $sql, 'QueryPage::doFeed' );
@@ -479,7 +494,6 @@ class QueryPage {
  * titles that match some criteria. It formats each result item as a link to
  * that page.
  *
- * @package MediaWiki
  */
 class PageQueryPage extends QueryPage {