/** The RevDel_List object, storing the list of items to be deleted/undeleted */
var $list;
- /** New bitfield value, used for form display post-submit */
- var $newBits;
-
/**
* Assorted information about each type, needed by the special page.
* TODO Move some of this to the list class
$qc = $this->getLogQueryCond();
# Show relevant lines from the deletion log
$wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
- LogEventsList::showLogExtract( $wgOut, 'delete', $this->targetObj->getPrefixedText(), '', 25, $qc );
+ LogEventsList::showLogExtract( $wgOut, 'delete',
+ $this->targetObj->getPrefixedText(), '', 25, $qc );
# Show relevant lines from the suppression log
if( $wgUser->isAllowed( 'suppressionlog' ) ) {
$wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" );
- LogEventsList::showLogExtract( $wgOut, 'suppress', $this->targetObj->getPrefixedText(), '', 25, $qc );
+ LogEventsList::showLogExtract( $wgOut, 'suppress',
+ $this->targetObj->getPrefixedText(), '', 25, $qc );
}
}
* Show some useful links in the subtitle
*/
protected function showConvenienceLinks() {
- global $wgOut, $wgUser;
+ global $wgOut, $wgUser, $wgLang;
# Give a link to the logs/hist for this page
if( $this->targetObj ) {
$links = array();
$logtitle = SpecialPage::getTitleFor( 'Log' );
- $links[] = $this->skin->makeKnownLinkObj( $logtitle, wfMsgHtml( 'viewpagelogs' ),
- wfArrayToCGI( array( 'page' => $this->targetObj->getPrefixedUrl() ) ) );
+ $links[] = $this->skin->linkKnown(
+ $logtitle,
+ wfMsgHtml( 'viewpagelogs' ),
+ array(),
+ array( 'page' => $this->targetObj->getPrefixedText() )
+ );
# Give a link to the page history
- $links[] = $this->skin->makeKnownLinkObj( $this->targetObj, wfMsgHtml( 'pagehist' ),
- wfArrayToCGI( array( 'action' => 'history' ) ) );
+ $links[] = $this->skin->linkKnown(
+ $this->targetObj,
+ wfMsgHtml( 'pagehist' ),
+ array(),
+ array( 'action' => 'history' )
+ );
# Link to deleted edits
if( $wgUser->isAllowed('undelete') ) {
$undelete = SpecialPage::getTitleFor( 'Undelete' );
- $links[] = $this->skin->makeKnownLinkObj( $undelete, wfMsgHtml( 'deletedhist' ),
- wfArrayToCGI( array( 'target' => $this->targetObj->getPrefixedDBkey() ) ) );
+ $links[] = $this->skin->linkKnown(
+ $undelete,
+ wfMsgHtml( 'deletedhist' ),
+ array(),
+ array( 'target' => $this->targetObj->getPrefixedDBkey() )
+ );
}
# Logs themselves don't have histories or archived revisions
- $wgOut->setSubtitle( '<p>'.implode($links,' / ').'</p>' );
+ $wgOut->setSubtitle( '<p>' . $wgLang->pipeList( $links ) . '</p>' );
}
}
if ( $this->typeName == 'logging' ) {
$wgOut->addWikiMsg( 'logdelete-selected', $wgLang->formatNum( count($this->ids) ) );
} else {
- $wgOut->addWikiMsg( 'revdelete-selected', $this->targetObj->getPrefixedText(), count( $this->ids ) );
+ $wgOut->addWikiMsg( 'revdelete-selected',
+ $this->targetObj->getPrefixedText(), count( $this->ids ) );
}
$bitfields = 0;
$wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
return;
}
-
- if ( !is_null( $this->newBits ) ) {
- $bitfields = $this->newBits;
- }
$wgOut->addHTML( "</ul>" );
// Explanation text
$wgOut->addHTML(
Xml::openElement( 'form', array( 'method' => 'post',
- 'action' => $this->getTitle()->getLocalUrl( 'action=submit' ),
+ 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ),
'id' => 'mw-revdel-form-revisions' ) ) .
Xml::openElement( 'fieldset' ) .
Xml::element( 'legend', null, wfMsg( 'revdelete-legend' ) ) .
}
/**
- * @param int $bitfields, aggregate bitfield of all the bitfields
- * @returns string HTML
+ * @param $bitfields Interger: aggregate bitfield of all the bitfields
+ * @return String: HTML
*/
protected function buildCheckBoxes( $bitfields ) {
$html = '';
/**
* UI entry point for form submission.
- * @param WebRequest $request
+ * @param $request WebRequest
*/
protected function submit( $request ) {
global $wgUser, $wgOut;
global $wgOut;
$wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
$wgOut->wrapWikiMsg( '<span class="success">$1</span>', $this->typeInfo['success'] );
+ $this->list->reloadFromMaster();
$this->showForm();
}
/**
* Put together a rev_deleted bitfield from the submitted checkboxes
- * @param WebRequest $request
- * @return int
+ * @param $request WebRequest
+ * @return Integer
*/
protected function extractBitfield( $request ) {
$bitfield = 0;
if( $bitfield == Revision::DELETED_RESTRICTED ) {
return Status::newFatal( 'revdelete-only-restricted' );
}
- $this->newBits = $bitfield;
return $this->getList()->setVisibility( array(
'value' => $bitfield,
'comment' => $reason ) );
* Checks for a change in the bitfield for a certain option and updates the
* provided array accordingly.
*
- * @param String $desc Description to add to the array if the option was
+ * @param $desc String: description to add to the array if the option was
* enabled / disabled.
- * @param int $field The bitmask describing the single option.
- * @param int $diff The xor of the old and new bitfields.
- * @param array $arr The array to update.
+ * @param $field Integer: the bitmask describing the single option.
+ * @param $diff Integer: the xor of the old and new bitfields.
+ * @param $new Integer: the new bitfield
+ * @param $arr Array: the array to update.
*/
protected static function checkItem( $desc, $field, $diff, $new, &$arr ) {
if( $diff & $field ) {
* a single string, which can be one of "applied restrictions to sysops",
* "removed restrictions from sysops", or null.
*
- * @param int $n The new bitfield.
- * @param int $o The old bitfield.
+ * @param $n Integer: the new bitfield.
+ * @param $o Integer: the old bitfield.
* @return An array as described above.
*/
protected static function getChanges( $n, $o ) {
* message will be of the form "[hid {content, edit summary, username}];
* [unhid {...}][applied restrictions to sysops] for $count revisions: $comment".
*
- * @param int $count The number of effected revisions.
- * @param int $nbitfield The new bitfield for the revision.
- * @param int $obitfield The old bitfield for the revision.
- * @param bool $isForLog
+ * @param $count Integer: The number of effected revisions.
+ * @param $nbitfield Integer: The new bitfield for the revision.
+ * @param $obitfield Integer: The old bitfield for the revision.
+ * @param $isForLog Boolean
*/
public static function getLogMessage( $count, $nbitfield, $obitfield, $isForLog = false ) {
global $wgLang;
$opType = 'modify';
}
- if ( $item->isCurrent() && $opType == 'hide' ) {
+ if ( $item->isHideCurrentOp( $newBits ) ) {
// Cannot hide current version text
$status->error( 'revdelete-hide-current', $item->formatDate(), $item->formatTime() );
$status->failCount++;
return $status;
}
+ /**
+ * Reload the list data from the master DB. This can be done after setVisibility()
+ * to allow $item->getHTML() to show the new data.
+ */
+ function reloadFromMaster() {
+ $dbw = wfGetDB( DB_MASTER );
+ $this->res = $this->doQuery( $dbw );
+ }
+
/**
* Record a log entry on the action
* @param $params Associative array of parameters:
$logParams = $this->getLogParams( $params );
// Actually add the deletion log entry
$log = new LogPage( $logType );
- $logid = $log->addEntry( $this->getLogAction(), $params['title'], $params['comment'], $logParams );
+ $logid = $log->addEntry( $this->getLogAction(), $params['title'],
+ $params['comment'], $logParams );
// Allow for easy searching of deletion log items for revision/log items
$log->addRelations( $field, $params['ids'], $logid );
}
}
/**
- * Get the date, formatted with $wgLang
+ * Get the time, formatted with $wgLang
*/
public function formatTime() {
global $wgLang;
}
/**
- * Returns true if the item is "current" and can't be deleted for that reason
+ * Returns true if the item is "current", and the operation to set the given
+ * bits can't be executed for that reason
* STUB
*/
- public function isCurrent() {
+ public function isHideCurrentOp( $newBits ) {
return false;
}
),
array(
'rc_this_oldid' => $this->revision->getId(), // condition
- 'rc_timestamp' => $dbw->timestamp( $this->revision->getTimestamp() ), // non-unique index
+ // non-unique timestamp index
+ 'rc_timestamp' => $dbw->timestamp( $this->revision->getTimestamp() ),
),
__METHOD__
);
return $this->revision->isDeleted( Revision::DELETED_TEXT );
}
- public function isCurrent() {
- return $this->list->getCurrent() == $this->getId();
+ public function isHideCurrentOp( $newBits ) {
+ return ( $newBits & Revision::DELETED_TEXT )
+ && $this->list->getCurrent() == $this->getId();
}
/**
if ( $this->isDeleted() && !$this->canView() ) {
return $date;
}
- return $this->special->skin->makeLinkObj( $this->list->title, $date,
- 'oldid='.$this->revision->getId() . '&unhide=1' );
+ return $this->special->skin->link(
+ $this->list->title,
+ $date,
+ array(),
+ array(
+ 'oldid' => $this->revision->getId(),
+ 'unhide' => 1
+ )
+ );
}
/**
return wfMsgHtml('diff');
} else {
return
- $this->special->skin->makeKnownLinkObj(
+ $this->special->skin->link(
$this->list->title,
wfMsgHtml('diff'),
- 'diff=' . $this->revision->getId() . '&oldid=prev&unhide=1'
+ array(),
+ array(
+ 'diff' => $this->revision->getId(),
+ 'oldid' => 'prev',
+ 'unhide' => 1
+ ),
+ array(
+ 'known',
+ 'noclasses'
+ )
);
}
}
$title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
$logtitle = SpecialPage::getTitleFor( 'Log' );
- $loglink = $this->special->skin->link( $logtitle, wfMsgHtml( 'log' ), array(),
- array( 'page' => $title->getPrefixedUrl() ) );
+ $loglink = $this->special->skin->link(
+ $logtitle,
+ wfMsgHtml( 'log' ),
+ array(),
+ array( 'page' => $title->getPrefixedText() )
+ );
// Action text
if( !$this->canView() ) {
$action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';