From 82182d83ff4cc22bf6796af0f530ae52aeb86543 Mon Sep 17 00:00:00 2001
From: Andrew Garrett
Date: Mon, 22 Jan 2007 05:01:37 +0000
Subject: [PATCH] New special page, Special:Protectedpages, which shows all
protected pages and their protection status (full protection status is not
pulled out due to performance considerations, so it just shows "full
protected" or "semi protected".
---
includes/SpecialPage.php | 1 +
includes/SpecialProtectedpages.php | 80 ++++++++++++++++++++++++++++++
languages/messages/MessagesEn.php | 8 +++
3 files changed, 89 insertions(+)
create mode 100644 includes/SpecialProtectedpages.php
diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php
index 37e9a8d544..ce57a5b4db 100644
--- a/includes/SpecialPage.php
+++ b/includes/SpecialPage.php
@@ -107,6 +107,7 @@ class SpecialPage
'Newpages' => array( 'IncludableSpecialPage', 'Newpages' ),
'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ),
'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ),
+ 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ),
'Allpages' => array( 'IncludableSpecialPage', 'Allpages' ),
'Prefixindex' => array( 'IncludableSpecialPage', 'Prefixindex' ) ,
'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ),
diff --git a/includes/SpecialProtectedpages.php b/includes/SpecialProtectedpages.php
new file mode 100644
index 0000000000..a3674c0c8a
--- /dev/null
+++ b/includes/SpecialProtectedpages.php
@@ -0,0 +1,80 @@
+' . wfMsg('protectedpagestext') . '
';
+ }
+
+ /**
+ * LEFT JOIN is expensive
+ *
+ * @return true
+ */
+ function isExpensive( ) {
+ return 1;
+ }
+
+ function isSyndicated() { return false; }
+
+ /**
+ * @return false
+ */
+ function sortDescending() {
+ return false;
+ }
+
+ /**
+ * @return string an sqlquery
+ */
+ function getSQL() {
+ $dbr =& wfGetDB( DB_SLAVE );
+ list( $page, $page_restrictions ) = $dbr->tableNamesN( 'page', 'page_restrictions' );
+ return "SELECT DISTINCT page_id, 'Protectedpages' as type, page_namespace AS namespace, page_title as title, " .
+ "page_title AS value, pr_level " .
+ "FROM $page LEFT JOIN $page_restrictions ON page_id = pr_page WHERE pr_level IS NOT NULL ";
+ }
+
+ /**
+ * Make link to the page, and add the protection levels.
+ *
+ * @param $skin Skin to be used
+ * @param $result Result row
+ * @return string
+ */
+ function formatResult( $skin, $result ) {
+ global $wgLang;
+ $title = Title::makeTitleSafe( $result->namespace, $result->title );
+ $link = $skin->makeLinkObj( $title );
+
+ $protType = wfMsg( 'restriction-level-' . $result->pr_level );
+
+ return wfSpecialList( $link, $protType );
+ }
+}
+
+/**
+ * Constructor
+ */
+function wfSpecialProtectedpages() {
+
+ list( $limit, $offset ) = wfCheckLimits();
+
+ $depp = new ProtectedPagesPage();
+
+ return $depp->doQuery( $offset, $limit );
+}
+
+?>
diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php
index 9e18d0e99e..4f8b70d1e5 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -378,6 +378,7 @@ $specialPageAliases = array(
'Newpages' => array( 'Newpages' ),
'Ancientpages' => array( 'Ancientpages' ),
'Deadendpages' => array( 'Deadendpages' ),
+ 'Protectedpages' => array( 'Protectedpages' ),
'Allpages' => array( 'Allpages' ),
'Prefixindex' => array( 'Prefixindex' ) ,
'Ipblocklist' => array( 'Ipblocklist' ),
@@ -1515,6 +1516,9 @@ The [http://meta.wikimedia.org/wiki/Help:Job_queue job queue] length is '''$7'''
'deadendpages' => 'Dead-end pages',
'deadendpages-summary' => '',
'deadendpagestext' => 'The following pages do not link to other pages in this wiki.',
+'protectedpages' => 'Protected pages',
+'protectedpages-summary' => '',
+'protectedpagestext' => 'The following pages are protected from moving or editing',
'listusers' => 'User list',
'listusers-summary' => '',
'specialpages' => 'Special pages',
@@ -1761,6 +1765,10 @@ page protection levels. Here are the current settings for the page $1 'Edit',
'restriction-move' => 'Move',
+# restriction levels
+'restriction-level-sysop' => 'full protected',
+'restriction-level-autoconfirmed' => 'semi protected',
+
# Undelete
'undelete' => 'View deleted pages',
--
2.20.1