Index: trunk/extensions/ProofreadPage/SpecialNakedPages.php |
— | — | @@ -1,110 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * |
5 | | - * This program is free software; you can redistribute it and/or modify |
6 | | - * it under the terms of the GNU General Public License as published by |
7 | | - * the Free Software Foundation; either version 2 of the License, or |
8 | | - * (at your option) any later version. |
9 | | - * |
10 | | - * This program is distributed in the hope that it will be useful, |
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | | - * GNU General Public License for more details. |
14 | | - * |
15 | | - * You should have received a copy of the GNU General Public License along |
16 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
17 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
18 | | - * http://www.gnu.org/copyleft/gpl.html |
19 | | - */ |
20 | | - |
21 | | - /* |
22 | | - * Special page that lists the texts that have no transclusions |
23 | | - * Pages in MediaWiki:Proofreadpage_notnaked_category are excluded. |
24 | | - * |
25 | | - */ |
26 | | - |
27 | | -class PagesWithoutScans extends SpecialPage { |
28 | | - |
29 | | - function __construct() { |
30 | | - parent::__construct( 'PagesWithoutScans' ); |
31 | | - } |
32 | | - |
33 | | - function execute( $parameters ) { |
34 | | - global $wgOut, $wgRequest, $wgDisableTextSearch; |
35 | | - $this->setHeaders(); |
36 | | - list( $limit, $offset ) = wfCheckLimits(); |
37 | | - $cnl = new PagesWithoutScansQuery( ); |
38 | | - $cnl->doQuery( $offset, $limit ); |
39 | | - } |
40 | | -} |
41 | | - |
42 | | - |
43 | | -class PagesWithoutScansQuery extends QueryPage { |
44 | | - |
45 | | - function __construct( ) { |
46 | | - wfLoadExtensionMessages( 'ProofreadPage' ); |
47 | | - $this->page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
48 | | - $this->cat = wfMsgForContent( 'proofreadpage_notnaked_category' ); |
49 | | - } |
50 | | - |
51 | | - function getName() { |
52 | | - return 'PagesWithoutScans'; |
53 | | - } |
54 | | - |
55 | | - function isExpensive() { |
56 | | - return true; |
57 | | - } |
58 | | - |
59 | | - function isSyndicated() { |
60 | | - return false; |
61 | | - } |
62 | | - |
63 | | - function getSQL() { |
64 | | - global $wgContentNamespaces; |
65 | | - |
66 | | - $dbr = wfGetDB( DB_SLAVE ); |
67 | | - $page = $dbr->tableName( 'page' ); |
68 | | - $templatelinks = $dbr->tableName( 'templatelinks' ); |
69 | | - $categorylinks = $dbr->tableName( 'categorylinks' ); |
70 | | - $forceindex = $dbr->useIndexClause("page_len"); |
71 | | - $page_ns_index = MWNamespace::getCanonicalIndex( strtolower( $this->page_namespace ) ); |
72 | | - $cat = $dbr->strencode( str_replace( ' ' , '_' , $this->cat ) ); |
73 | | - $clause = "page_namespace=" . NS_MAIN . " AND page_is_redirect=0 AND page_id NOT IN ( SELECT DISTINCT tl_from FROM $templatelinks LEFT JOIN $page ON page_id=tl_from WHERE tl_namespace=$page_ns_index AND page_namespace=" . NS_MAIN . " ) AND page_id NOT IN ( SELECT DISTINCT cl_from FROM $categorylinks WHERE cl_to='$cat' )"; |
74 | | - |
75 | | - return |
76 | | - "SELECT page_namespace as namespace, |
77 | | - page_title as title, |
78 | | - page_len AS value |
79 | | - FROM $page $forceindex |
80 | | - WHERE $clause"; |
81 | | - } |
82 | | - |
83 | | - function sortDescending() { |
84 | | - return true; |
85 | | - } |
86 | | - |
87 | | - function formatResult( $skin, $result ) { |
88 | | - global $wgLang, $wgContLang; |
89 | | - $dm = $wgContLang->getDirMark(); |
90 | | - |
91 | | - $title = Title::makeTitleSafe( $result->namespace, $result->title ); |
92 | | - if ( !$title ) { |
93 | | - return '<!-- Invalid title ' . htmlspecialchars( "{$result->namespace}:{$result->title}" ). '-->'; |
94 | | - } |
95 | | - $hlink = $skin->linkKnown( |
96 | | - $title, |
97 | | - wfMsgHtml( 'hist' ), |
98 | | - array(), |
99 | | - array( 'action' => 'history' ) |
100 | | - ); |
101 | | - $plink = $this->isCached() |
102 | | - ? $skin->link( $title ) |
103 | | - : $skin->linkKnown( $title ); |
104 | | - $size = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ), $wgLang->formatNum( htmlspecialchars( $result->value ) ) ); |
105 | | - |
106 | | - return $title->exists() |
107 | | - ? "({$hlink}) {$dm}{$plink} {$dm}[{$size}]" |
108 | | - : "<s>({$hlink}) {$dm}{$plink} {$dm}[{$size}]</s>"; |
109 | | - } |
110 | | -} |
111 | | - |
Index: trunk/extensions/ProofreadPage/SpecialPagesWithoutScans.php |
— | — | @@ -0,0 +1,110 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * |
| 5 | + * This program is free software; you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU General Public License as published by |
| 7 | + * the Free Software Foundation; either version 2 of the License, or |
| 8 | + * (at your option) any later version. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + * GNU General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License along |
| 16 | + * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | + * http://www.gnu.org/copyleft/gpl.html |
| 19 | + */ |
| 20 | + |
| 21 | + /* |
| 22 | + * Special page that lists the texts that have no transclusions |
| 23 | + * Pages in MediaWiki:Proofreadpage_notnaked_category are excluded. |
| 24 | + * |
| 25 | + */ |
| 26 | + |
| 27 | +class PagesWithoutScans extends SpecialPage { |
| 28 | + |
| 29 | + function __construct() { |
| 30 | + parent::__construct( 'PagesWithoutScans' ); |
| 31 | + } |
| 32 | + |
| 33 | + function execute( $parameters ) { |
| 34 | + global $wgOut, $wgRequest, $wgDisableTextSearch; |
| 35 | + $this->setHeaders(); |
| 36 | + list( $limit, $offset ) = wfCheckLimits(); |
| 37 | + $cnl = new PagesWithoutScansQuery( ); |
| 38 | + $cnl->doQuery( $offset, $limit ); |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | + |
| 43 | +class PagesWithoutScansQuery extends QueryPage { |
| 44 | + |
| 45 | + function __construct( ) { |
| 46 | + wfLoadExtensionMessages( 'ProofreadPage' ); |
| 47 | + $this->page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
| 48 | + $this->cat = wfMsgForContent( 'proofreadpage_notnaked_category' ); |
| 49 | + } |
| 50 | + |
| 51 | + function getName() { |
| 52 | + return 'PagesWithoutScans'; |
| 53 | + } |
| 54 | + |
| 55 | + function isExpensive() { |
| 56 | + return true; |
| 57 | + } |
| 58 | + |
| 59 | + function isSyndicated() { |
| 60 | + return false; |
| 61 | + } |
| 62 | + |
| 63 | + function getSQL() { |
| 64 | + global $wgContentNamespaces; |
| 65 | + |
| 66 | + $dbr = wfGetDB( DB_SLAVE ); |
| 67 | + $page = $dbr->tableName( 'page' ); |
| 68 | + $templatelinks = $dbr->tableName( 'templatelinks' ); |
| 69 | + $categorylinks = $dbr->tableName( 'categorylinks' ); |
| 70 | + $forceindex = $dbr->useIndexClause("page_len"); |
| 71 | + $page_ns_index = MWNamespace::getCanonicalIndex( strtolower( $this->page_namespace ) ); |
| 72 | + $cat = $dbr->strencode( str_replace( ' ' , '_' , $this->cat ) ); |
| 73 | + $clause = "page_namespace=" . NS_MAIN . " AND page_is_redirect=0 AND page_id NOT IN ( SELECT DISTINCT tl_from FROM $templatelinks LEFT JOIN $page ON page_id=tl_from WHERE tl_namespace=$page_ns_index AND page_namespace=" . NS_MAIN . " ) AND page_id NOT IN ( SELECT DISTINCT cl_from FROM $categorylinks WHERE cl_to='$cat' )"; |
| 74 | + |
| 75 | + return |
| 76 | + "SELECT page_namespace as namespace, |
| 77 | + page_title as title, |
| 78 | + page_len AS value |
| 79 | + FROM $page $forceindex |
| 80 | + WHERE $clause"; |
| 81 | + } |
| 82 | + |
| 83 | + function sortDescending() { |
| 84 | + return true; |
| 85 | + } |
| 86 | + |
| 87 | + function formatResult( $skin, $result ) { |
| 88 | + global $wgLang, $wgContLang; |
| 89 | + $dm = $wgContLang->getDirMark(); |
| 90 | + |
| 91 | + $title = Title::makeTitleSafe( $result->namespace, $result->title ); |
| 92 | + if ( !$title ) { |
| 93 | + return '<!-- Invalid title ' . htmlspecialchars( "{$result->namespace}:{$result->title}" ). '-->'; |
| 94 | + } |
| 95 | + $hlink = $skin->linkKnown( |
| 96 | + $title, |
| 97 | + wfMsgHtml( 'hist' ), |
| 98 | + array(), |
| 99 | + array( 'action' => 'history' ) |
| 100 | + ); |
| 101 | + $plink = $this->isCached() |
| 102 | + ? $skin->link( $title ) |
| 103 | + : $skin->linkKnown( $title ); |
| 104 | + $size = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ), $wgLang->formatNum( htmlspecialchars( $result->value ) ) ); |
| 105 | + |
| 106 | + return $title->exists() |
| 107 | + ? "({$hlink}) {$dm}{$plink} {$dm}[{$size}]" |
| 108 | + : "<s>({$hlink}) {$dm}{$plink} {$dm}[{$size}]</s>"; |
| 109 | + } |
| 110 | +} |
| 111 | + |
Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | $wgSpecialPageGroups['IndexPages'] = 'pages'; |
46 | 46 | |
47 | 47 | # special page |
48 | | -$wgAutoloadClasses['PagesWithoutScans'] = dirname( __FILE__ ) . '/SpecialNakedPages.php'; |
| 48 | +$wgAutoloadClasses['PagesWithoutScans'] = dirname( __FILE__ ) . '/SpecialPagesWithoutScans.php'; |
49 | 49 | $wgSpecialPages['PagesWithoutScans'] = 'PagesWithoutScans'; |
50 | 50 | $wgSpecialPageGroups['PagesWithoutScans'] = 'maintenance'; |
51 | 51 | |