function wfSpecialRevisiondelete( $par = null ) {
global $wgOut, $wgRequest, $wgUser;
+
+ if ( wfReadOnly() ) {
+ $wgOut->readOnlyPage();
+ return;
+ }
+
# Handle our many different possible input types
$target = $wgRequest->getText( 'target' );
$oldid = $wgRequest->getArray( 'oldid' );
# Only one target set at a time please!
$i = (bool)$file + (bool)$oldid + (bool)$logid + (bool)$artimestamp + (bool)$fileid + (bool)$img;
if( $i !== 1 ) {
- $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
+ $wgOut->showErrorPage( 'revdelete-toomanytargets-title', 'revdelete-toomanytargets-text' );
return;
}
# Logs must have a type given
if( $logid && !strpos($page->getDBKey(),'/') ) {
- $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
+ $wgOut->showErrorPage( 'revdelete-nologtype-title', 'revdelete-nologtype-text' );
return;
}
# Either submit or create our form
if( $wgUser->isAllowed('undelete') ) {
$undelete = SpecialPage::getTitleFor( 'Undelete' );
$links[] = $this->skin->makeKnownLinkObj( $undelete, wfMsgHtml( 'deletedhist' ),
- wfArrayToCGI( array( 'target' => $this->page->getPrefixedUrl() ) ) );
+ wfArrayToCGI( array( 'target' => $this->page->getPrefixedDBkey() ) ) );
}
# Logs themselves don't have histories or archived revisions
$wgOut->setSubtitle( '<p>'.implode($links,' / ').'</p>' );
$wgOut->addWikiMsg( 'revdelete-selected', $this->page->getPrefixedText(), $count );
$bitfields = 0;
- $wgOut->addHtml( "<ul>" );
+ $wgOut->addHTML( "<ul>" );
$where = $revObjs = array();
$dbr = wfGetDB( DB_SLAVE );
foreach( $this->revisions as $revid ) {
$where[] = intval($revid);
}
- $whereClause = 'rev_id IN(' . implode(',',$where) . ')';
$result = $dbr->select( array('revision','page'), '*',
- array( 'rev_page' => $this->page->getArticleID(),
- $whereClause, 'rev_page = page_id' ),
+ array(
+ 'rev_page' => $this->page->getArticleID(),
+ 'rev_id' => $where,
+ 'rev_page = page_id' ),
__METHOD__ );
while( $row = $dbr->fetchObject( $result ) ) {
$revObjs[$row->rev_id] = new Revision( $row );
$UserAllowed = false;
}
$revisions++;
- $wgOut->addHtml( $this->historyLine( $revObjs[$revid] ) );
+ $wgOut->addHTML( $this->historyLine( $revObjs[$revid] ) );
$bitfields |= $revObjs[$revid]->mDeleted;
}
// The archives...
foreach( $this->archrevs as $timestamp ) {
$where[] = $dbr->addQuotes( $timestamp );
}
- $whereClause = 'ar_timestamp IN(' . implode(',',$where) . ')';
$result = $dbr->select( 'archive', '*',
- array( 'ar_namespace' => $this->page->getNamespace(),
+ array(
+ 'ar_namespace' => $this->page->getNamespace(),
'ar_title' => $this->page->getDBKey(),
- $whereClause ),
+ 'ar_timestamp' => $where ),
__METHOD__ );
while( $row = $dbr->fetchObject( $result ) ) {
$revObjs[$row->ar_timestamp] = new Revision( array(
$UserAllowed = false;
}
$revisions++;
- $wgOut->addHtml( $this->historyLine( $revObjs[$timestamp] ) );
+ $wgOut->addHTML( $this->historyLine( $revObjs[$timestamp] ) );
$bitfields |= $revObjs[$timestamp]->mDeleted;
}
}
return;
}
- $wgOut->addHtml( "</ul>" );
+ $wgOut->addHTML( "</ul>" );
$wgOut->addWikiMsg( 'revdelete-text' );
$hidden[] = Xml::hidden( 'artimestamp[]', $rev->getTimestamp() );
}
$special = SpecialPage::getTitleFor( 'Revisiondelete' );
- $wgOut->addHtml(
+ $wgOut->addHTML(
Xml::openElement( 'form', array( 'method' => 'post', 'action' => $special->getLocalUrl( 'action=submit' ),
'id' => 'mw-revdel-form-revisions' ) ) .
Xml::openElement( 'fieldset' ) .
// FIXME: all items checked for just one rev are checked, even if not set for the others
foreach( $this->checks as $item ) {
list( $message, $name, $field ) = $item;
- $wgOut->addHtml( Xml::tags( 'div', null, Xml::checkLabel( wfMsg( $message ), $name, $name, $bitfields & $field ) ) );
+ $wgOut->addHTML( Xml::tags( 'div', null, Xml::checkLabel( wfMsg( $message ), $name, $name, $bitfields & $field ) ) );
}
foreach( $items as $item ) {
- $wgOut->addHtml( Xml::tags( 'p', null, $item ) );
+ $wgOut->addHTML( Xml::tags( 'p', null, $item ) );
}
foreach( $hidden as $item ) {
- $wgOut->addHtml( $item );
+ $wgOut->addHTML( $item );
}
- $wgOut->addHtml(
+ $wgOut->addHTML(
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' ) . "\n"
);
$wgLang->formatNum($count) );
$bitfields = 0;
- $wgOut->addHtml( "<ul>" );
+ $wgOut->addHTML( "<ul>" );
$where = $filesObjs = array();
$dbr = wfGetDB( DB_SLAVE );
if( $this->deleteKey=='oldimage' ) {
// Run through and pull all our data in one query
foreach( $this->ofiles as $timestamp ) {
- $where[] = $dbr->addQuotes( $timestamp.'!'.$this->page->getDbKey() );
+ $where[] = $dbr->addQuotes( $timestamp.'!'.$this->page->getDBKey() );
}
- $whereClause = 'oi_archive_name IN(' . implode(',',$where) . ')';
$result = $dbr->select( 'oldimage', '*',
- array( 'oi_name' => $this->page->getDbKey(),
- $whereClause ),
+ array(
+ 'oi_name' => $this->page->getDBKey(),
+ 'oi_archive_name' => $where ),
__METHOD__ );
while( $row = $dbr->fetchObject( $result ) ) {
$filesObjs[$row->oi_archive_name] = RepoGroup::singleton()->getLocalRepo()->newFileFromRow( $row );
}
// Check through our images
foreach( $this->ofiles as $timestamp ) {
- $archivename = $timestamp.'!'.$this->page->getDbKey();
+ $archivename = $timestamp.'!'.$this->page->getDBKey();
if( !isset($filesObjs[$archivename]) ) {
continue;
} else if( !$filesObjs[$archivename]->userCan(File::DELETED_RESTRICTED) ) {
}
$revisions++;
// Inject history info
- $wgOut->addHtml( $this->fileLine( $filesObjs[$archivename] ) );
+ $wgOut->addHTML( $this->fileLine( $filesObjs[$archivename] ) );
$bitfields |= $filesObjs[$archivename]->deleted;
}
// Archived files...
foreach( $this->afiles as $id ) {
$where[] = intval($id);
}
- $whereClause = 'fa_id IN(' . implode(',',$where) . ')';
$result = $dbr->select( 'filearchive', '*',
- array( 'fa_name' => $this->page->getDbKey(),
- $whereClause ),
+ array(
+ 'fa_name' => $this->page->getDBKey(),
+ 'fa_id' => $where ),
__METHOD__ );
while( $row = $dbr->fetchObject( $result ) ) {
$filesObjs[$row->fa_id] = ArchivedFile::newFromRow( $row );
}
$revisions++;
// Inject history info
- $wgOut->addHtml( $this->archivedfileLine( $filesObjs[$fileid] ) );
+ $wgOut->addHTML( $this->archivedfileLine( $filesObjs[$fileid] ) );
$bitfields |= $filesObjs[$fileid]->deleted;
}
}
return;
}
- $wgOut->addHtml( "</ul>" );
+ $wgOut->addHTML( "</ul>" );
$wgOut->addWikiMsg('revdelete-text' );
//Normal sysops can always see what they did, but can't always change it
$hidden[] = Xml::hidden( 'fileid[]', $fileid );
}
$special = SpecialPage::getTitleFor( 'Revisiondelete' );
- $wgOut->addHtml(
+ $wgOut->addHTML(
Xml::openElement( 'form', array( 'method' => 'post', 'action' => $special->getLocalUrl( 'action=submit' ),
'id' => 'mw-revdel-form-filerevisions' ) ) .
Xml::fieldset( wfMsg( 'revdelete-legend' ) )
// FIXME: all items checked for just one file are checked, even if not set for the others
foreach( $this->checks as $item ) {
list( $message, $name, $field ) = $item;
- $wgOut->addHtml( Xml::tags( 'div', null, Xml::checkLabel( wfMsg( $message ), $name, $name, $bitfields & $field ) ) );
+ $wgOut->addHTML( Xml::tags( 'div', null, Xml::checkLabel( wfMsg( $message ), $name, $name, $bitfields & $field ) ) );
}
foreach( $items as $item ) {
- $wgOut->addHtml( "<p>$item</p>" );
+ $wgOut->addHTML( "<p>$item</p>" );
}
foreach( $hidden as $item ) {
- $wgOut->addHtml( $item );
+ $wgOut->addHTML( $item );
}
- $wgOut->addHtml(
+ $wgOut->addHTML(
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' ) . "\n"
);
$wgOut->addWikiMsg( 'logdelete-selected', $wgLang->formatNum( count($this->events) ) );
$bitfields = 0;
- $wgOut->addHtml( "<ul>" );
+ $wgOut->addHTML( "<ul>" );
$where = $logRows = array();
$dbr = wfGetDB( DB_SLAVE );
$where[] = intval($logid);
}
list($log,$logtype) = explode( '/',$this->page->getDBKey(), 2 );
- $whereClause = "log_type = '$logtype' AND log_id IN(" . implode(',',$where) . ")";
$result = $dbr->select( 'logging', '*',
- array( $whereClause ),
+ array(
+ 'log_type' => $logtype,
+ 'log_id' => $where ),
__METHOD__ );
while( $row = $dbr->fetchObject( $result ) ) {
$logRows[$row->log_id] = $row;
$UserAllowed = false;
}
$logItems++;
- $wgOut->addHtml( $this->logLine( $logRows[$logid] ) );
+ $wgOut->addHTML( $this->logLine( $logRows[$logid] ) );
$bitfields |= $logRows[$logid]->log_deleted;
}
if( !$logItems ) {
- $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
+ $wgOut->showErrorPage( 'revdelete-nologid-title', 'revdelete-nologid-text' );
return;
}
- $wgOut->addHtml( "</ul>" );
+ $wgOut->addHTML( "</ul>" );
$wgOut->addWikiMsg( 'revdelete-text' );
// Normal sysops can always see what they did, but can't always change it
}
$special = SpecialPage::getTitleFor( 'Revisiondelete' );
- $wgOut->addHtml(
+ $wgOut->addHTML(
Xml::openElement( 'form', array( 'method' => 'post', 'action' => $special->getLocalUrl( 'action=submit' ),
'id' => 'mw-revdel-form-logs' ) ) .
Xml::fieldset( wfMsg( 'revdelete-legend' ) )
// FIXME: all items checked for just on event are checked, even if not set for the others
foreach( $this->checks as $item ) {
list( $message, $name, $field ) = $item;
- $wgOut->addHtml( Xml::tags( 'div', null, Xml::checkLabel( wfMsg( $message ), $name, $name, $bitfields & $field ) ) );
+ $wgOut->addHTML( Xml::tags( 'div', null, Xml::checkLabel( wfMsg( $message ), $name, $name, $bitfields & $field ) ) );
}
foreach( $items as $item ) {
- $wgOut->addHtml( "<p>$item</p>" );
+ $wgOut->addHTML( "<p>$item</p>" );
}
foreach( $hidden as $item ) {
- $wgOut->addHtml( $item );
+ $wgOut->addHTML( $item );
}
- $wgOut->addHtml(
+ $wgOut->addHTML(
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' ) . "\n"
);
* @returns string
*/
private function archivedfileLine( $file ) {
- global $wgLang, $wgTitle;
+ global $wgLang;
$target = $this->page->getPrefixedText();
$date = $wgLang->timeanddate( $file->getTimestamp(), true );
foreach( $items as $revid ) {
$where[] = intval($revid);
}
- $whereClause = 'rev_id IN(' . implode(',',$where) . ')';
$result = $this->dbw->select( 'revision', '*',
- array( 'rev_page' => $title->getArticleID(),
- $whereClause ),
+ array(
+ 'rev_page' => $title->getArticleID(),
+ 'rev_id' => $where ),
__METHOD__ );
while( $row = $this->dbw->fetchObject( $result ) ) {
$revObjs[$row->rev_id] = new Revision( $row );
foreach( $items as $timestamp ) {
$where[] = $this->dbw->addQuotes( $timestamp );
}
- $whereClause = 'ar_timestamp IN(' . implode(',',$where) . ')';
$result = $this->dbw->select( 'archive', '*',
- array( 'ar_namespace' => $title->getNamespace(),
+ array(
+ 'ar_namespace' => $title->getNamespace(),
'ar_title' => $title->getDBKey(),
- $whereClause ),
+ 'ar_timestamp' => $where ),
__METHOD__ );
while( $row = $this->dbw->fetchObject( $result ) ) {
$revObjs[$row->ar_timestamp] = new Revision( array(
$set = array();
// Run through and pull all our data in one query
foreach( $items as $timestamp ) {
- $where[] = $this->dbw->addQuotes( $timestamp.'!'.$title->getDbKey() );
+ $where[] = $this->dbw->addQuotes( $timestamp.'!'.$title->getDBKey() );
}
- $whereClause = 'oi_archive_name IN(' . implode(',',$where) . ')';
$result = $this->dbw->select( 'oldimage', '*',
- array( 'oi_name' => $title->getDbKey(),
- $whereClause ),
+ array(
+ 'oi_name' => $title->getDBKey(),
+ 'oi_archive_name' => $where ),
__METHOD__ );
while( $row = $this->dbw->fetchObject( $result ) ) {
$filesObjs[$row->oi_archive_name] = RepoGroup::singleton()->getLocalRepo()->newFileFromRow( $row );
}
// To work!
foreach( $items as $timestamp ) {
- $archivename = $timestamp.'!'.$title->getDbKey();
+ $archivename = $timestamp.'!'.$title->getDBKey();
if( !isset($filesObjs[$archivename]) ) {
$success = false;
continue; // Must exist
foreach( $items as $id ) {
$where[] = intval($id);
}
- $whereClause = 'fa_id IN(' . implode(',',$where) . ')';
$result = $this->dbw->select( 'filearchive', '*',
- array( 'fa_name' => $title->getDbKey(),
- $whereClause ),
+ array( 'fa_name' => $title->getDBKey(),
+ 'fa_id' => $where ),
__METHOD__ );
while( $row = $this->dbw->fetchObject( $result ) ) {
$filesObjs[$row->fa_id] = ArchivedFile::newFromRow( $row );
$where[] = intval($logid);
}
list($log,$logtype) = explode( '/',$title->getDBKey(), 2 );
- $whereClause = "log_type ='$logtype' AND log_id IN(" . implode(',',$where) . ")";
$result = $this->dbw->select( 'logging', '*',
- array( $whereClause ),
+ array(
+ 'log_type' => $logtype,
+ 'log_id' => $where ),
__METHOD__ );
while( $row = $this->dbw->fetchObject( $result ) ) {
$logRows[$row->log_id] = $row;