$wgOut->showPermissionsErrorPage( $permission_errors );
return;
}
+
+ # Hack for big sites
+ if( $this->isBigDeletion() ) {
+ $permission_errors = $this->mTitle->getUserPermissionsErrors(
+ 'bigdelete', $wgUser );
+
+ if( count( $permission_errors ) > 0 ) {
+ $wgOut->showPermissionsErrorPage( $permission_errors );
+ return;
+ }
+ }
$wgOut->setPagetitle( wfMsg( 'confirmdelete' ) );
return $this->confirmDelete( '', $reason );
}
+
+ /**
+ * @return bool whether or not the page surpasses $wgDeleteRevisionsLimit revisions
+ */
+ function isBigDeletion() {
+ global $wgDeleteRevisionsLimit;
+ if( $wgDeleteRevisionsLimit ) {
+ $revCount = $this->estimateRevisionCount();
+ return $revCount > $wgDeleteRevisionsLimit;
+ }
+ return false;
+ }
+
+ /**
+ * @return int approximate revision count
+ */
+ function estimateRevisionCount() {
+ $dbr = wfGetDB();
+ // For an exact count...
+ //return $dbr->selectField( 'revision', 'COUNT(*)',
+ // array( 'rev_page' => $this->getId() ), __METHOD__ );
+ return $dbr->estimateRowCount( 'revision', '*',
+ array( 'rev_page' => $this->getId() ), __METHOD__ );
+ }
/**
* Get the last N authors
$wgGroupPermissions['sysop']['block'] = true;
$wgGroupPermissions['sysop']['createaccount'] = true;
$wgGroupPermissions['sysop']['delete'] = true;
+$wgGroupPermissions['sysop']['bigdelete'] = true; // can be separately configured for pages with > $wgDeleteRevisionsLimit revs
$wgGroupPermissions['sysop']['deletedhistory'] = true; // can view deleted history entries, but not see or restore the text
$wgGroupPermissions['sysop']['undelete'] = true;
$wgGroupPermissions['sysop']['editinterface'] = true;
*/
$wgAddGroups = $wgRemoveGroups = array();
+/**
+ * Optional to restrict deletion of pages with higher revision counts
+ * to users with the 'bigdelete' permission. (Default given to sysops.)
+ */
+$wgDeleteRevisionsLimit = 0;
+
# Proxy scanner settings
#