r23289 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23288‎ | r23289 | r23290 >
Date:10:49, 23 June 2007
Author:robchurch
Status:old
Tags:
Comment:
* Missing messages, again
* Remove files from the four reports just ported plus all the other bits, leaving behind a redirect mechanism
It might be nice if report page titles could be varied according to namespace...
Modified paths:
  • /branches/robchurch/reports/includes/AutoLoader.php (modified) (history)
  • /branches/robchurch/reports/includes/QueryPage.php (modified) (history)
  • /branches/robchurch/reports/includes/SpecialPage.php (modified) (history)
  • /branches/robchurch/reports/includes/SpecialRedirect.php (added) (history)
  • /branches/robchurch/reports/includes/SpecialUncategorizedcategories.php (deleted) (history)
  • /branches/robchurch/reports/includes/SpecialUncategorizedimages.php (deleted) (history)
  • /branches/robchurch/reports/includes/SpecialUncategorizedpages.php (deleted) (history)
  • /branches/robchurch/reports/includes/SpecialUncategorizedtemplates.php (deleted) (history)
  • /branches/robchurch/reports/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: branches/robchurch/reports/includes/SpecialUncategorizedpages.php
@@ -1,57 +0,0 @@
2 -<?php
3 -/**
4 - *
5 - * @addtogroup SpecialPage
6 - */
7 -
8 -/**
9 - * A special page looking for page without any category.
10 - * @addtogroup SpecialPage
11 - */
12 -class UncategorizedPagesPage extends PageQueryPage {
13 - var $requestedNamespace = NS_MAIN;
14 -
15 - function getName() {
16 - return "Uncategorizedpages";
17 - }
18 -
19 - function sortDescending() {
20 - return false;
21 - }
22 -
23 - function isExpensive() {
24 - return true;
25 - }
26 - function isSyndicated() { return false; }
27 -
28 - function getSQL() {
29 - $dbr = wfGetDB( DB_SLAVE );
30 - list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
31 - $name = $dbr->addQuotes( $this->getName() );
32 -
33 - return
34 - "
35 - SELECT
36 - $name as type,
37 - page_namespace AS namespace,
38 - page_title AS title,
39 - page_title AS value
40 - FROM $page
41 - LEFT JOIN $categorylinks ON page_id=cl_from
42 - WHERE cl_from IS NULL AND page_namespace={$this->requestedNamespace} AND page_is_redirect=0
43 - ";
44 - }
45 -}
46 -
47 -/**
48 - * constructor
49 - */
50 -function wfSpecialUncategorizedpages() {
51 - list( $limit, $offset ) = wfCheckLimits();
52 -
53 - $lpp = new UncategorizedPagesPage();
54 -
55 - return $lpp->doQuery( $offset, $limit );
56 -}
57 -
58 -?>
Index: branches/robchurch/reports/includes/SpecialUncategorizedtemplates.php
@@ -1,31 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Special page lists all uncategorised pages in the
6 - * template namespace
7 - *
8 - * @addtogroup SpecialPage
9 - * @author Rob Church <robchur@gmail.com>
10 - */
11 -class UncategorizedTemplatesPage extends UncategorizedPagesPage {
12 -
13 - var $requestedNamespace = NS_TEMPLATE;
14 -
15 - public function getName() {
16 - return 'Uncategorizedtemplates';
17 - }
18 -
19 -}
20 -
21 -/**
22 - * Main execution point
23 - *
24 - * @param mixed $par Parameter passed to the page
25 - */
26 -function wfSpecialUncategorizedtemplates() {
27 - list( $limit, $offset ) = wfCheckLimits();
28 - $utp = new UncategorizedTemplatesPage();
29 - $utp->doQuery( $offset, $limit );
30 -}
31 -
32 -?>
Index: branches/robchurch/reports/includes/SpecialUncategorizedimages.php
@@ -1,47 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Special page lists images which haven't been categorised
6 - *
7 - * @addtogroup SpecialPage
8 - * @author Rob Church <robchur@gmail.com>
9 - */
10 -
11 -class UncategorizedImagesPage extends ImageQueryPage {
12 -
13 - function getName() {
14 - return 'Uncategorizedimages';
15 - }
16 -
17 - function sortDescending() {
18 - return false;
19 - }
20 -
21 - function isExpensive() {
22 - return true;
23 - }
24 -
25 - function isSyndicated() {
26 - return false;
27 - }
28 -
29 - function getSQL() {
30 - $dbr = wfGetDB( DB_SLAVE );
31 - list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
32 - $ns = NS_IMAGE;
33 -
34 - return "SELECT 'Uncategorizedimages' AS type, page_namespace AS namespace,
35 - page_title AS title, page_title AS value
36 - FROM {$page} LEFT JOIN {$categorylinks} ON page_id = cl_from
37 - WHERE cl_from IS NULL AND page_namespace = {$ns} AND page_is_redirect = 0";
38 - }
39 -
40 -}
41 -
42 -function wfSpecialUncategorizedimages() {
43 - $uip = new UncategorizedImagesPage();
44 - list( $limit, $offset ) = wfCheckLimits();
45 - return $uip->doQuery( $offset, $limit );
46 -}
47 -
48 -?>
Index: branches/robchurch/reports/includes/SpecialUncategorizedcategories.php
@@ -1,37 +0,0 @@
2 -<?php
3 -/**
4 - *
5 - * @addtogroup SpecialPage
6 - */
7 -
8 -/**
9 - *
10 - */
11 -require_once( "SpecialUncategorizedpages.php" );
12 -
13 -/**
14 - * implements Special:Uncategorizedcategories
15 - * @addtogroup SpecialPage
16 - */
17 -class UncategorizedCategoriesPage extends UncategorizedPagesPage {
18 - function UncategorizedCategoriesPage() {
19 - $this->requestedNamespace = NS_CATEGORY;
20 - }
21 -
22 - function getName() {
23 - return "Uncategorizedcategories";
24 - }
25 -}
26 -
27 -/**
28 - * constructor
29 - */
30 -function wfSpecialUncategorizedcategories() {
31 - list( $limit, $offset ) = wfCheckLimits();
32 -
33 - $lpp = new UncategorizedCategoriesPage();
34 -
35 - return $lpp->doQuery( $offset, $limit );
36 -}
37 -
38 -?>
Index: branches/robchurch/reports/includes/SpecialRedirect.php
@@ -0,0 +1,49 @@
 2+<?php
 3+
 4+/**
 5+ * Special page which redirects the user to a
 6+ * different special page, appending a set
 7+ * request string
 8+ *
 9+ * @addtogroup SpecialPage
 10+ * @author Rob Church <robchur@gmail.com>
 11+ */
 12+class SpecialRedirect extends UnlistedSpecialPage {
 13+
 14+ /**
 15+ * Target
 16+ */
 17+ private $target = null;
 18+
 19+ /**
 20+ * Request string components
 21+ */
 22+ private $request = array();
 23+
 24+ /**
 25+ * Constructor
 26+ *
 27+ * @param string $name
 28+ * @param array $request
 29+ */
 30+ public function __construct( $target, $request ) {
 31+ parent::__construct( $target );
 32+ $this->target = SpecialPage::getTitleFor( $target );
 33+ $this->request = $request;
 34+ }
 35+
 36+ /**
 37+ * Main execution function
 38+ */
 39+ public function execute( $par = false ) {
 40+ global $wgOut;
 41+ $q = array();
 42+ foreach( $this->request as $name => $value )
 43+ $q[] = $name . '=' . $value;
 44+ $q = implode( '&', $q );
 45+ $wgOut->redirect( $this->target->getFullUrl( $q ) );
 46+ }
 47+
 48+}
 49+
 50+?>
\ No newline at end of file
Property changes on: branches/robchurch/reports/includes/SpecialRedirect.php
___________________________________________________________________
Added: svn:eol-style
151 + native
Index: branches/robchurch/reports/includes/AutoLoader.php
@@ -202,6 +202,7 @@
203203 'SpecialPage' => 'includes/SpecialPage.php',
204204 'UnlistedSpecialPage' => 'includes/SpecialPage.php',
205205 'IncludableSpecialPage' => 'includes/SpecialPage.php',
 206+ 'SpecialRedirect' => 'includes/SpecialRedirect.php',
206207 'SpecialSpecialPages' => 'includes/SpecialSpecialpages.php',
207208 'PopularPagesPage' => 'includes/SpecialPopularpages.php',
208209 'PreferencesForm' => 'includes/SpecialPreferences.php',
@@ -210,9 +211,6 @@
211212 'RevisionDeleteForm' => 'includes/SpecialRevisiondelete.php',
212213 'RevisionDeleter' => 'includes/SpecialRevisiondelete.php',
213214 'SpecialSearch' => 'includes/SpecialSearch.php',
214 - 'UncategorizedCategoriesPage' => 'includes/SpecialUncategorizedcategories.php',
215 - 'UncategorizedPagesPage' => 'includes/SpecialUncategorizedpages.php',
216 - 'UncategorizedTemplatesPage' => 'includes/SpecialUncategorizedtemplates.php',
217215 'PageArchive' => 'includes/SpecialUndelete.php',
218216 'UndeleteForm' => 'includes/SpecialUndelete.php',
219217 'DBUnlockForm' => 'includes/SpecialUnlockdb.php',
Index: branches/robchurch/reports/includes/QueryPage.php
@@ -29,12 +29,6 @@
3030 array( 'MostrevisionsPage', 'Mostrevisions' ),
3131 array( 'FewestrevisionsPage', 'Fewestrevisions' ),
3232 array( 'NewPagesPage', 'Newpages' ),
33 - #
34 - array( 'UncategorizedCategoriesPage', 'Uncategorizedcategories' ),
35 - array( 'UncategorizedPagesPage', 'Uncategorizedpages' ),
36 - array( 'UncategorizedImagesPage', 'Uncategorizedimages' ),
37 - array( 'UncategorizedTemplatesPage', 'Uncategorizedtemplates' ),
38 - #
3933 array( 'UnusedCategoriesPage', 'Unusedcategories' ),
4034 array( 'UnusedimagesPage', 'Unusedimages' ),
4135 array( 'WantedCategoriesPage', 'Wantedcategories' ),
Index: branches/robchurch/reports/includes/SpecialPage.php
@@ -92,9 +92,9 @@
9393 'Randompage' => array( 'SpecialPage', 'Randompage' ),
9494 'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ),
9595 'Uncategorizedpages' => 'UncategorisedPagesReport',
96 - 'Uncategorizedcategories' => array( 'SpecialPage', 'Uncategorizedcategories' ),
97 - 'Uncategorizedimages' => array( 'SpecialPage', 'Uncategorizedimages' ),
98 - 'Uncategorizedtemplates' => array( 'SpecialPage', 'Uncategorizedtemplates' ),
 96+ 'Uncategorizedcategories' => array( 'SpecialRedirect', 'Uncategorizedpages', array( 'namespace' => NS_CATEGORY ) ),
 97+ 'Uncategorizedimages' => array( 'SpecialRedirect', 'Uncategorizedpages', array( 'namespace' => NS_IMAGE ) ),
 98+ 'Uncategorizedtemplates' => array( 'SpecialRedirect', 'Uncategorizedpages', array( 'namespace' => NS_TEMPLATE ) ),
9999 'Unusedcategories' => array( 'SpecialPage', 'Unusedcategories' ),
100100 'Unusedimages' => array( 'SpecialPage', 'Unusedimages' ),
101101 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages' ),
Index: branches/robchurch/reports/languages/messages/MessagesEn.php
@@ -1593,7 +1593,9 @@
15941594 'rclsub' => '(to pages linked from "$1")',
15951595 'newpages' => 'New pages',
15961596 'newpages-summary' => '', # only translate this message to other languages if you have to change it
 1597+'newpages-legend' => 'Find new pages',
15971598 'newpages-username' => 'Username:',
 1599+'newpages-no-results' => 'There are no new pages matching the selected criteria.',
15981600 'ancientpages' => 'Oldest pages',
15991601 'ancientpages-summary' => '', # only translate this message to other languages if you have to change it
16001602 'intl' => 'Interlanguage links',
@@ -2842,6 +2844,12 @@
28432845 'imgmultigotopost' => '', # only translate this message to other languages if you have to change it
28442846 'imgmultiparseerror' => 'The image file appears to be corrupted or incorrect, so {{SITENAME}} cannot retrieve a list of pages.',
28452847
 2848+# General-purpose pager links
 2849+'paging-next' => 'next',
 2850+'paging-prev' => 'previous',
 2851+'paging-first' => 'first',
 2852+'paging-last' => 'last',
 2853+
28462854 # Table pager
28472855 'ascending_abbrev' => 'asc',
28482856 'descending_abbrev' => 'desc',

Status & tagging log