Extension talk:Newest Pages

Please submit bug reports and feature requests for this extension to the extension's maintainer, Rob Church, via email.

Narrow to a given Namespace
Thanks, this is very helpful. Any chance you could add a param to allow the namespace to be specified? I'd like to transclude this page as a kind of "Table of Contents" for a specific namespace.


 * Available as of version 1.3. Rob Church (talk) 23:27, 13 May 2006 (UTC)

Namespace as a Category Page?
I was wondering if the Namespace that can be specified could actually specify a Category Page? skdb 15:04, 29 June 2006 (UTC)

What is the namespace for "Pages"
Thanks a lot - this is wonderful! It works with categories and most namespaces. But I wonder what would be the namespace to write if I want to have pages/articles only. I can select "(Artikel)" (German for articles = pages) in the selectbox but I do not know the word to write as namespace... Thanks a lot! --194.76.29.2 15:37, 17 July 2006 (UTC)


 * I had this same problem and after trial-and-error discovered that to filter for articles in the (Main) namespace the syntax is 71.35.247.211 02:24, 10 August 2006 (UTC)

Section #3 of the README states, "Use - to select the main namespace." 86.134.116.228 08:16, 15 August 2006 (UTC)

Questions

 * How do I link to namespace Main?
 * Special:Newestpages/-
 * This was noted in the README file. robchurch | talk 14:32, 20 November 2006 (UTC)

Index: NewestPages.page.php
 * How do I refine the code, so the namespace Main will appear as default?

=
====================================================== --- NewestPages.page.php	(revision 17805) +++ NewestPages.page.php	(working copy) @@ -66,7 +66,7 @@ 		if( !isset( $this->limit ) ) $this->limit = $this->sanitiseLimit( $req->getInt( 'limit', $wgNewestPagesLimit ) ); if( !isset( $this->namespace ) ) -			$this->namespace = $this->extractNamespace( $req->getVal( 'namespace', -1 ) ); +			$this->namespace = $this->extractNamespace( $req->getVal( 'namespace', NS_MAIN ) ); if( !isset( $this->redirects ) ) $this->redirects = (bool)$req->getInt( 'redirects', 1 ); }

Index: NewestPages.page.php
 * How do I refine the code, so the redirect pages will not appear as default?

=
====================================================== --- NewestPages.page.php	(revision 17805) +++ NewestPages.page.php	(working copy) @@ -68,7 +68,7 @@ 		if( !isset( $this->namespace ) ) $this->namespace = $this->extractNamespace( $req->getVal( 'namespace', -1 ) ); if( !isset( $this->redirects ) ) -			$this->redirects = (bool)$req->getInt( 'redirects', 1 ); +			$this->redirects = (bool)$req->getInt( 'redirects', 0 ); } 	function sanitiseLimit( $limit ) {


 * How can I filter and show new articles within a category?
 * This isn't supported in this extension at the present time. It might be added as a feature in a subsequent release, as it's a popular request. robchurch | talk 14:35, 20 November 2006 (UTC)


 * I've answered the remaining questions above. Please note that I reviewed this discussion page by chance; wherever possible, I prefer extension questions like this to be emailed to me; an address is provided in the README file for that purpose. Thanks. robchurch | talk 14:35, 20 November 2006 (UTC)

showing certain categorie
Hi I was wondering if it is possible just to show the main categorie on the front main page instead of it going to the all categorie... ty Nevermind I figured it out... Thanks for this extensions...!!

Couldn't you have said what you figured out?--195.13.55.197 22:30, 7 October 2008 (UTC)

Error message with wfLoadExtensionMessages
Im getting the error: Fatal error: Call to undefined function wfLoadExtensionMessages in /var/www/wiki/extensions/newestPages/NewestPages.page.php on line 26

After research I found one page that states that wfLoadExtensionMessages is only available in version 1.11 and above. (Extension:Cite/Cite.php). Therefore this extension won't work on 1.6 and above. Is this correct? (We still at 1.9 :


 * Due to a bunch of incompetent messing around with the code for this extension, and the removal of perfectly reasonable backwards-compatibility code, several people are experiencing problems; I've just responded to another email from an exasperated user attempting to install the extension.


 * If you're running a pre-1.11 wiki, I'd suggest using the version as of r23533, which can be considered the last version "released" by Rob Church. A tarball of these files can also be found at http://www.anubite.co.uk/newestpages-1.6.x.tar.gz.


 * I'd update the page, but some clever idiot would just undo it. -- Rob Church

Specify offset of first "Newest Page" displayed
Here's a patch that allows one to specify not only the number of pages to display, but also the index of the first page: Index: NewestPages.page.php

=
====================================================== --- NewestPages.page.php       (revision 42072) +++ NewestPages.page.php       (working copy) @@ -13,6 +13,7 @@ class NewestPages extends IncludableSpecialPage {

var $limit = NULL; +      var $offset = "0"; var $namespace = NULL; var $redirects = NULL;

@@ -46,13 +47,14 @@               $page = $dbr->tableName( 'page' ); $nsf = $this->getNsFragment; $redir = $this->redirects ? '' : ' AND page_is_redirect = 0'; -              $res = $dbr->query( "SELECT page_namespace, page_title, page_is_redirect FROM $page WHERE {$nsf}{$redir} ORDER BY page_id DESC LIMIT 0,{$this->limit}" ); +              $res = $dbr->query( "SELECT page_namespace, page_title, page_is_redirect FROM $page WHERE {$nsf}{$redir} ORDER BY page_id DESC LIMIT {$this->offset},{$this->limit}" ); $count = $dbr->numRows( $res ); if( $count > 0 ) { # Make list if( !$this->mIncluding ) $wgOut->addWikiText( wfMsg( 'newestpages-showing', $count ) ); -                      $wgOut->addHtml( "" ); +                      $start = 1 + (int)$this->offset; +                      $wgOut->addHtml( "" ); while( $row = $dbr->fetchObject( $res ) ) $wgOut->addHtml( $this->makeListItem( $row ) ); $wgOut->addHTML( "" ); @@ -81,7 +83,11 @@                       $bits = explode( '/', $par ); foreach( $bits as $bit ) { if( is_numeric( $bit ) ) { -                                      $this->limit = $this->sanitiseLimit( $bit ); +                                      if ( !isset( $this->limit ) ) { +                                              $this->limit = $this->sanitiseLimit( $bit ); +                                      } else { +                                              $this->offset = $this->sanitiseLimit( $bit ); +                                      }                                } else { $this->namespace = $this->extractNamespace( $bit ); }

This way, you can easily create a multi-column table of newest pages, like so:

Gets slow using conditions on a bigger wiki
Not that my wiki is big but I have ~17000 articles and the page with the include takes pretty long to load as soon as I start to add conditions to the query :/ Just FYI --Subfader 02:10, 6 February 2009 (UTC)

Bug: Incompatible with postgres 8.3
when using the debian package mediawiki-extensions 1.4 containing Newest Pages 1.7 with MediaWiki 	1.12.0 PHP 	5.2.6-1+lenny2 (apache2handler) PostgreSQL 	PostgreSQL 8.3.6 on i486-pc-linux-gnu, compiled by GCC gcc-4.3.real (Debian 4.3.3-3) 4.3.3 i get this error: Interner Fehler

A database error has occurred Query: SELECT page_namespace, page_title, page_is_redirect FROM page WHERE page_namespace != 8 ORDER BY page_id DESC LIMIT 0,50 Function: Error: 1 FEHLER: Syntax LIMIT x,y wird nicht unterstützt HINT: Verwenden Sie die getrennten Klauseln LIMIT und OFFSET.

Backtrace:

note that no pages where created before
 * 1) 0 /usr/share/mediawiki/includes/Database.php(799): DatabasePostgres->reportQueryError('FEHLER: Syntax...', 1, 'SELECT page_nam...', '', false)
 * 2) 1 /usr/share/mediawiki-extensions/NewestPages.page.php(49): Database->query('SELECT page_nam...')
 * 3) 2 /usr/share/mediawiki/includes/SpecialPage.php(464): NewestPages->execute(NULL)
 * 4) 3 /usr/share/mediawiki/includes/Wiki.php(193): SpecialPage::executePath(Object(Title))
 * 5) 4 /usr/share/mediawiki/includes/Wiki.php(45): MediaWiki->initializeSpecialCases(Object(Title), Object(OutputPage), Object(WebRequest))
 * 6) 5 /usr/share/mediawiki/index.php(90): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
 * 7) 6 {main}