*/
function wfSpecialRevisiondelete( $par = null ) {
- global $wgOut, $wgRequest, $wgUser;
+ global $wgOut, $wgRequest;
$target = $wgRequest->getVal( 'target' );
- $oldid = $wgRequest->getInt( 'oldid' );
+ $oldid = $wgRequest->getIntArray( 'oldid' );
- $sk = $wgUser->getSkin();
$page = Title::newFromUrl( $target );
if( is_null( $page ) ) {
return;
}
+ if( is_null( $oldid ) ) {
+ $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
+ return;
+ }
+
$form = new RevisionDeleteForm( $wgRequest );
if( $wgRequest->wasPosted() ) {
$form->submit( $wgRequest );
}
}
+/**
+ * Implements the GUI for Revision Deletion.
+ * @addtogroup SpecialPage
+ */
class RevisionDeleteForm {
/**
* @param Title $page
function show( $request ) {
global $wgOut, $wgUser;
- $first = $this->revisions[0];
-
$wgOut->addWikiText( wfMsg( 'revdelete-selected', $this->page->getPrefixedText() ) );
$wgOut->addHtml( "<ul>" );
foreach( $this->revisions as $revid ) {
$rev = Revision::newFromTitle( $this->page, $revid );
+ if( !isset( $rev ) ) {
+ $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
+ return;
+ }
$wgOut->addHtml( $this->historyLine( $rev ) );
$bitfields[] = $rev->mDeleted; // FIXME
}
$hidden[] = wfHidden( 'oldid[]', $revid );
}
- $special = Title::makeTitle( NS_SPECIAL, 'Revisiondelete' );
+ $special = SpecialPage::getTitleFor( 'Revisiondelete' );
$wgOut->addHtml( wfElement( 'form', array(
'method' => 'post',
- 'action' => $special->getLocalUrl( 'action=submit' ) ) ) );
+ 'action' => $special->getLocalUrl( 'action=submit' ) ),
+ null ) );
$wgOut->addHtml( '<fieldset><legend>' . wfMsgHtml( 'revdelete-legend' ) . '</legend>' );
foreach( $this->checks as $item ) {
function extractBitfield( $request ) {
$bitfield = 0;
foreach( $this->checks as $item ) {
- list( $message, $name, $field ) = $item;
+ list( /* message */ , $name, $field ) = $item;
if( $request->getCheck( $name ) ) {
$bitfield |= $field;
}
function save( $bitfield, $reason ) {
$dbw = wfGetDB( DB_MASTER );
$deleter = new RevisionDeleter( $dbw );
- $ok = $deleter->setVisibility( $this->revisions, $bitfield, $reason );
+ $deleter->setVisibility( $this->revisions, $bitfield, $reason );
}
}
-
+/**
+ * Implements the actions for Revision Deletion.
+ * @addtogroup SpecialPage
+ */
class RevisionDeleter {
function __construct( $db ) {
$this->db = $db;
// To work!
foreach( $items as $revid ) {
$rev = Revision::newFromId( $revid );
+ if( !isset( $rev ) ) {
+ return false;
+ }
$this->updateRevision( $rev, $bitfield );
$this->updateRecentChanges( $rev, $bitfield );
}
}
-?>
+