Index: trunk/extensions/NewestPages/NewestPages |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | NEWEST PAGES EXTENSION
|
3 | 3 |
|
4 | | - Version 1.1
|
| 4 | + Version 1.2
|
5 | 5 | © 2006 Rob Church
|
6 | 6 |
|
7 | 7 | This is free software licensed under the GNU General Public Licence. Please
|
— | — | @@ -14,7 +14,9 @@ |
15 | 15 | 3. Accessing the special page
|
16 | 16 | 4. Including the special page
|
17 | 17 | 5. Customising the interface text
|
18 | | -6. Change log
|
| 18 | +6. Customising extension behaviour
|
| 19 | +7. Notes
|
| 20 | +8. Change log
|
19 | 21 |
|
20 | 22 | == 1. Introduction ==
|
21 | 23 |
|
— | — | @@ -25,13 +27,13 @@ |
26 | 28 |
|
27 | 29 | == 2. Installing the extension ==
|
28 | 30 |
|
29 | | -To install the Newest Pages extension, first upload/copy the extension file
|
30 | | -NewestPages.php into your MediaWiki extensions directory. Then edit your
|
31 | | -LocalSettings.php file and add the following line:
|
| 31 | +To install the Newest Pages extension, first upload/copy the extension files
|
| 32 | +NewestPages.php and NewestPages.i18n.php into your MediaWiki extensions directory.
|
| 33 | +Then edit your LocalSettings.php file and add the following line:
|
32 | 34 |
|
33 | 35 | require_once( 'extensions/NewestPages.php' );
|
34 | 36 |
|
35 | | -Save the file (uploading if applicable) to complete the installation.
|
| 37 | +Save the file to complete the installation.
|
36 | 38 |
|
37 | 39 | == 3. Accessing the special page ==
|
38 | 40 |
|
— | — | @@ -61,8 +63,19 @@ |
62 | 64 | the MediaWiki namespace. See Special:Allmessages for a list of customisable
|
63 | 65 | interface messages in the wiki.
|
64 | 66 |
|
65 | | -== 6. Notes ==
|
| 67 | +== 6. Customising extension behaviour ==
|
66 | 68 |
|
| 69 | +The default page limit for the extension can be altered using the
|
| 70 | +$wgNewestPagesLimit variable, e.g.
|
| 71 | +
|
| 72 | + $wgNewestPages = 500;
|
| 73 | +
|
| 74 | +sets the default limit to be 500. This should be set after the call
|
| 75 | +to include the extension file. The default remains at 50 pages, and there
|
| 76 | +is an absolute limit of 5000 pages, to avoid crippling the database server(s).
|
| 77 | +
|
| 78 | +== 7. Notes ==
|
| 79 | +
|
67 | 80 | This extension was written in a much more specific form to serve the needs of a
|
68 | 81 | user in the #mediawiki IRC channel. Following a second request for a similar
|
69 | 82 | page, I decided to clean up the code, give the page a more generalised function,
|
— | — | @@ -70,7 +83,7 @@ |
71 | 84 |
|
72 | 85 | Feedback welcomed at <robchur@gmail.com> as usual.
|
73 | 86 |
|
74 | | -== 7. Change log ==
|
| 87 | +== 8. Change log ==
|
75 | 88 |
|
76 | 89 | 15/04/2006
|
77 | 90 | Version 1.0
|
— | — | @@ -78,4 +91,10 @@ |
79 | 92 |
|
80 | 93 | 30/04/2006
|
81 | 94 | Version 1.1
|
82 | | - * Fix issues when using a table prefix |
\ No newline at end of file |
| 95 | + * Fix issues when using a table prefix
|
| 96 | +
|
| 97 | +13/05/2006
|
| 98 | +Version 1.2
|
| 99 | + * Moved internationalisation into a separate file
|
| 100 | + * Add absolute limit of 5000 pages, for performance
|
| 101 | + * Allow the default limit to be customised |
\ No newline at end of file |
Index: trunk/extensions/NewestPages/NewestPages.i18n.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Internationalisation file for the NewestPages extension |
| 6 | + * @package MediaWiki |
| 7 | + * @subpackage Extensions |
| 8 | + * @author Rob Church <robchur@gmail.com> |
| 9 | + * @copyright © 2006 Rob Church |
| 10 | + * @licence GNU General Public Licence 2.0 |
| 11 | + */ |
| 12 | + |
| 13 | +global $wgNewestPagesMessages; |
| 14 | +$wgNewestPagesMessages = array( |
| 15 | + |
| 16 | +'newestpages' => 'Newest pages', |
| 17 | +'newestpages-header' => "'''This page lists the $1 newest pages on the wiki.'''", |
| 18 | +'newestpages-limitlinks' => 'Show up to $1 pages', |
| 19 | +'newestpages-showing' => 'Found $1 pages; listing newest first:', |
| 20 | +'newestpages-none' => 'No entries were found.', |
| 21 | + |
| 22 | +); |
| 23 | + |
| 24 | +?> |
\ No newline at end of file |
Property changes on: trunk/extensions/NewestPages/NewestPages.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Index: trunk/extensions/NewestPages/NewestPages.php |
— | — | @@ -14,17 +14,15 @@ |
15 | 15 | if( defined( 'MEDIAWIKI' ) ) {
|
16 | 16 |
|
17 | 17 | require_once( 'SpecialPage.php' );
|
| 18 | + require_once( 'NewestPages.i18n.php' );
|
18 | 19 | $wgExtensionFunctions[] = 'efNewestPages';
|
19 | 20 | $wgExtensionCredits['specialpage'][] = array( 'name' => 'Newest Pages', 'author' => 'Rob Church', 'url' => 'http://meta.wikimedia.org/wiki/Newest_Pages_%28extension%29' );
|
| 21 | + $wgNewestPagesLimit = 50;
|
20 | 22 |
|
21 | 23 | function efNewestPages() {
|
22 | | - global $wgMessageCache;
|
| 24 | + global $wgMessageCache, $wgNewestPagesMessages;
|
| 25 | + $wgMessageCache->addMessages( $wgNewestPagesMessages );
|
23 | 26 | SpecialPage::addPage( new NewestPages() );
|
24 | | - $wgMessageCache->addMessage( 'newestpages', 'Newest pages' );
|
25 | | - $wgMessageCache->addMessage( 'newestpages-header', "'''This page lists the $1 newest pages on the wiki.'''" );
|
26 | | - $wgMessageCache->addMessage( 'newestpages-limitlinks', 'Show up to $1 pages' );
|
27 | | - $wgMessageCache->addMessage( 'newestpages-showing', 'Found $1 pages; listing newest first:' );
|
28 | | - $wgMessageCache->addMessage( 'newestpages-none', 'No entries were found.' );
|
29 | 27 | }
|
30 | 28 |
|
31 | 29 | class NewestPages extends IncludableSpecialPage {
|
— | — | @@ -63,7 +61,7 @@ |
64 | 62 | }
|
65 | 63 | $dbr->freeResult( $res );
|
66 | 64 | }
|
67 | | -
|
| 65 | +
|
68 | 66 | function setLimit( $par ) {
|
69 | 67 | if( $par ) {
|
70 | 68 | $this->limit = intval( $par );
|
— | — | @@ -75,6 +73,7 @@ |
76 | 74 | $this->limit = 50;
|
77 | 75 | }
|
78 | 76 | }
|
| 77 | + $this->limit = min( $this->limit, 5000 );
|
79 | 78 | }
|
80 | 79 |
|
81 | 80 | function makeListItem( $row ) {
|