r75943 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75942‎ | r75943 | r75944 >
Date:18:07, 3 November 2010
Author:yaron
Status:deferred
Tags:
Comment:
'ApprovedPages' and 'UnapprovedPages' special pages merged into one new special page, 'ApprovedRevs'
Modified paths:
  • /trunk/extensions/ApprovedRevs/AR_ApprovedPages.php (deleted) (history)
  • /trunk/extensions/ApprovedRevs/AR_UnapprovedPages.php (deleted) (history)
  • /trunk/extensions/ApprovedRevs/SpecialApprovedRevs.php (added) (history)

Diff [purge]

Index: trunk/extensions/ApprovedRevs/AR_ApprovedPages.php
@@ -1,63 +0,0 @@
2 -<?php
3 -/**
4 - * Special page that lists all pages that have an approved revision.
5 - *
6 - * @author Yaron Koren
7 - */
8 -
9 -if ( !defined( 'MEDIAWIKI' ) ) die();
10 -
11 -class ARApprovedPages extends SpecialPage {
12 -
13 - /**
14 - * Constructor
15 - */
16 - function __construct() {
17 - parent::__construct( 'ApprovedPages' );
18 - wfLoadExtensionMessages( 'ApprovedRevs' );
19 - }
20 -
21 - function execute( $query ) {
22 - $this->setHeaders();
23 - list( $limit, $offset ) = wfCheckLimits();
24 - $rep = new ARApprovedPagesPage();
25 - return $rep->doQuery( $offset, $limit );
26 - }
27 -}
28 -
29 -class ARApprovedPagesPage extends QueryPage {
30 - function getName() {
31 - return "ApprovedPages";
32 - }
33 -
34 - function isExpensive() { return false; }
35 -
36 - function isSyndicated() { return false; }
37 -
38 - function getPageHeader() {
39 - $header = Xml::element( 'p', null, wfMsg( 'approvedrevs-approvedpages-docu' ) ) . "<br />\n";
40 - return $header;
41 - }
42 -
43 - function getPageFooter() {
44 - }
45 -
46 - function getSQL() {
47 - $dbr = wfGetDB( DB_SLAVE );
48 - $approved_revs = $dbr->tableName( 'approved_revs' );
49 - $page = $dbr->tableName( 'page' );
50 - return "SELECT 'Page' AS type,
51 - p.page_id AS id
52 - FROM $approved_revs ar JOIN $page p
53 - ON ar.page_id = p.page_id";
54 - }
55 -
56 - function getOrder() {
57 - return ' ORDER BY p.page_namespace, p.page_title ASC';
58 - }
59 -
60 - function formatResult( $skin, $result ) {
61 - $title = Title::newFromId( $result->id );
62 - return $skin->makeLinkObj( $title );
63 - }
64 -}
Index: trunk/extensions/ApprovedRevs/AR_UnapprovedPages.php
@@ -1,64 +0,0 @@
2 -<?php
3 -/**
4 - * Special page that lists all pages that have an approved revision.
5 - *
6 - * @author Yaron Koren
7 - */
8 -
9 -if ( !defined( 'MEDIAWIKI' ) ) die();
10 -
11 -class ARUnapprovedPages extends SpecialPage {
12 -
13 - /**
14 - * Constructor
15 - */
16 - function ARUnapprovedPages() {
17 - parent::__construct( 'UnapprovedPages' );
18 - wfLoadExtensionMessages( 'ApprovedRevs' );
19 - }
20 -
21 - function execute( $query ) {
22 - $this->setHeaders();
23 - list( $limit, $offset ) = wfCheckLimits();
24 - $rep = new ARUnapprovedPagesPage();
25 - return $rep->doQuery( $offset, $limit );
26 - }
27 -}
28 -
29 -class ARUnapprovedPagesPage extends QueryPage {
30 - function getName() {
31 - return "UnapprovedPages";
32 - }
33 -
34 - function isExpensive() { return false; }
35 -
36 - function isSyndicated() { return false; }
37 -
38 - function getPageHeader() {
39 - $header = Xml::element( 'p', null, wfMsg( 'approvedrevs-unapprovedpages-docu' ) ) . "<br />\n";
40 - return $header;
41 - }
42 -
43 - function getPageFooter() {
44 - }
45 -
46 - function getSQL() {
47 - $dbr = wfGetDB( DB_SLAVE );
48 - $approved_revs = $dbr->tableName( 'approved_revs' );
49 - $page = $dbr->tableName( 'page' );
50 - return "SELECT 'Page' AS type,
51 - p.page_id AS id
52 - FROM $approved_revs ar RIGHT OUTER JOIN $page p
53 - ON ar.page_id = p.page_id
54 - WHERE ar.page_id IS NULL";
55 - }
56 -
57 - function getOrder() {
58 - return ' ORDER BY p.page_namespace, p.page_title ASC';
59 - }
60 -
61 - function formatResult( $skin, $result ) {
62 - $title = Title::newFromId( $result->id );
63 - return $skin->makeLinkObj( $title );
64 - }
65 -}
Index: trunk/extensions/ApprovedRevs/SpecialApprovedRevs.php
@@ -0,0 +1,63 @@
 2+<?php
 3+/**
 4+ * Special page that lists all pages that have an approved revision.
 5+ *
 6+ * @author Yaron Koren
 7+ */
 8+
 9+if ( !defined( 'MEDIAWIKI' ) ) die();
 10+
 11+class ARApprovedPages extends SpecialPage {
 12+
 13+ /**
 14+ * Constructor
 15+ */
 16+ function __construct() {
 17+ parent::__construct( 'ApprovedPages' );
 18+ wfLoadExtensionMessages( 'ApprovedRevs' );
 19+ }
 20+
 21+ function execute( $query ) {
 22+ $this->setHeaders();
 23+ list( $limit, $offset ) = wfCheckLimits();
 24+ $rep = new ARApprovedPagesPage();
 25+ return $rep->doQuery( $offset, $limit );
 26+ }
 27+}
 28+
 29+class ARApprovedPagesPage extends QueryPage {
 30+ function getName() {
 31+ return "ApprovedPages";
 32+ }
 33+
 34+ function isExpensive() { return false; }
 35+
 36+ function isSyndicated() { return false; }
 37+
 38+ function getPageHeader() {
 39+ $header = Xml::element( 'p', null, wfMsg( 'approvedrevs-approvedpages-docu' ) ) . "<br />\n";
 40+ return $header;
 41+ }
 42+
 43+ function getPageFooter() {
 44+ }
 45+
 46+ function getSQL() {
 47+ $dbr = wfGetDB( DB_SLAVE );
 48+ $approved_revs = $dbr->tableName( 'approved_revs' );
 49+ $page = $dbr->tableName( 'page' );
 50+ return "SELECT 'Page' AS type,
 51+ p.page_id AS id
 52+ FROM $approved_revs ar JOIN $page p
 53+ ON ar.page_id = p.page_id";
 54+ }
 55+
 56+ function getOrder() {
 57+ return ' ORDER BY p.page_namespace, p.page_title ASC';
 58+ }
 59+
 60+ function formatResult( $skin, $result ) {
 61+ $title = Title::newFromId( $result->id );
 62+ return $skin->makeLinkObj( $title );
 63+ }
 64+}
Property changes on: trunk/extensions/ApprovedRevs/SpecialApprovedRevs.php
___________________________________________________________________
Added: svn:eol-style
165 + native

Status & tagging log