Merge "Add missing uploadstash.us_props for PostgreSQL"
[lhc/web/wiklou.git] / includes / specials / SpecialWithoutinterwiki.php
1 <?php
2 /**
3 * Implements Special:Withoutinterwiki
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 * @file
21 * @ingroup SpecialPage
22 * @author Rob Church <robchur@gmail.com>
23 */
24
25 /**
26 * Special page lists pages without language links
27 *
28 * @ingroup SpecialPage
29 */
30 class WithoutInterwikiPage extends PageQueryPage {
31 private $prefix = '';
32
33 function __construct( $name = 'Withoutinterwiki' ) {
34 parent::__construct( $name );
35 }
36
37 function execute( $par ) {
38 $this->prefix = Title::capitalize(
39 $this->getRequest()->getVal( 'prefix', $par ), NS_MAIN );
40 parent::execute( $par );
41 }
42
43 function getPageHeader() {
44 global $wgScript;
45
46 # Do not show useless input form if special page is cached
47 if ( $this->isCached() ) {
48 return '';
49 }
50
51 $prefix = $this->prefix;
52 $t = $this->getPageTitle();
53
54 return Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . "\n" .
55 Html::openElement( 'fieldset' ) . "\n" .
56 Html::element( 'legend', null, $this->msg( 'withoutinterwiki-legend' )->text() ) . "\n" .
57 Html::hidden( 'title', $t->getPrefixedText() ) . "\n" .
58 Xml::inputLabel( $this->msg( 'allpagesprefix' )->text(), 'prefix', 'wiprefix', 20, $prefix ) . "\n" .
59 Xml::submitButton( $this->msg( 'withoutinterwiki-submit' )->text() ) . "\n" .
60 Html::closeElement( 'fieldset' ) . "\n" .
61 Html::closeElement( 'form' );
62 }
63
64 function sortDescending() {
65 return false;
66 }
67
68 function getOrderFields() {
69 return array( 'page_namespace', 'page_title' );
70 }
71
72 function isExpensive() {
73 return true;
74 }
75
76 function isSyndicated() {
77 return false;
78 }
79
80 function getQueryInfo() {
81 $query = array(
82 'tables' => array( 'page', 'langlinks' ),
83 'fields' => array( 'namespace' => 'page_namespace',
84 'title' => 'page_title',
85 'value' => 'page_title' ),
86 'conds' => array( 'll_title IS NULL',
87 'page_namespace' => MWNamespace::getContentNamespaces(),
88 'page_is_redirect' => 0 ),
89 'join_conds' => array( 'langlinks' => array(
90 'LEFT JOIN', 'll_from = page_id' ) )
91 );
92 if ( $this->prefix ) {
93 $dbr = wfGetDB( DB_SLAVE );
94 $query['conds'][] = 'page_title ' . $dbr->buildLike( $this->prefix, $dbr->anyString() );
95 }
96 return $query;
97 }
98
99 protected function getGroupName() {
100 return 'maintenance';
101 }
102 }