-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpecialOneColumnAllPages.php
More file actions
72 lines (68 loc) · 2.28 KB
/
SpecialOneColumnAllPages.php
File metadata and controls
72 lines (68 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is a MediaWiki extension. It is not a valid entry point' );
}
class SpecialOneColumnAllPages extends SpecialPage {
function __construct( ) {
parent::__construct( 'OneColumnAllPages' );
}
function execute( $par ) {
global $wgSpecialPages;
$this->setHeaders();
$viewOutput = $this->getOutput();
$dbr = wfGetDB( DB_REPLICA );
global $wgSitename;
$output = "<big>'''" . wfMessage( 'onecolumnallpages-intro', $wgSitename )->plain()
. "'''</big><br/><br/>";
$namespaces = MWNamespace::getCanonicalNamespaces();
// Support for, e.g., page_id-0 as parameter, with 0 being the namespace
$where = array( '1=1' );
$pars = explode ( '-', $par );
if ( isset( $pars[1] ) ) {
echo $pars[1];
$where = array( 'page_namespace' => $pars[1] );
$par = $pars[0];
}
if ( $par != 'page_id' ) {
$res = $dbr->select( 'page', array ( 'page_title', 'page_namespace' ), $where );
} else {
$res = $dbr->select( 'page', array ( 'page_title', 'page_namespace' ),
$where, __METHOD__, array( 'ORDER BY' => 'page_id ASC' ) );
}
foreach ( $res as $row ) {
if ( $par == 'raw' ) {
$output .= '[{{fullurl:';
} else {
$output .= "[[:";
}
if ( $par == 'viewwikitext' ) {
$output .= 'Special:ViewWikitext/';
}
$pageTitle = '';
if ( $row->page_namespace == 828 ) {
$pageTitle .= 'Module:';
} else {
$pageTitle .= $namespaces[$row->page_namespace];
if ( $namespaces[$row->page_namespace] ) {
$pageTitle .= ':';
}
}
$pageTitle .= $row->page_title;
$output .= $pageTitle;
if ( $par == 'viewwikitext' && isset( $wgSpecialPages['ViewWikitext'] ) ) {
$output .= "|$pageTitle]]<br/>";
}
elseif ( $par == 'raw' ) {
$output .= "|action=raw}} $pageTitle]<br/>";
} else {
$output .= "]]<br/>";
}
}
$viewOutput->addWikiTextAsContent( $output );
return $output;
}
function getRobotPolicy() {
global $wgOneColumnAllPagesRobotPolicy;
return $wgOneColumnAllPagesRobotPolicy;
}
}