* Fixed bug in revdelete where all list Items where assumed to be of the same type (no longer holds since r87804). This was causing "Undefined property: stdClass::$rev_timestamp" errors for deleted revs.
* Cleaned up RevisionDeleter::getRelationType()
* Minor cleanups to SpecialRevisionDelete
'Replacer' => 'includes/StringUtils.php',
'RequestContext' => 'includes/RequestContext.php',
'ReverseChronologicalPager' => 'includes/Pager.php',
+ 'Rev_Item' => 'includes/RevisionList.php',
+ 'Rev_List' => 'includes/RevisionList.php',
'Revision' => 'includes/Revision.php',
+ 'RevisionList' => 'includes/RevisionList.php',
'RSSFeed' => 'includes/Feed.php',
'Sanitizer' => 'includes/Sanitizer.php',
'SiteConfiguration' => 'includes/SiteConfiguration.php',
--- /dev/null
+<?php
+/**
+ * List for revision table items for a single page
+ */
+abstract class Rev_List {
+ /**
+ * @var Title
+ */
+ var $title;
+ /**
+ * @var RequestContext
+ */
+ var $context;
+
+ var $ids, $res, $current;
+
+ function __construct( RequestContext $context, Title $title, array $ids ) {
+ $this->context = $context;
+ $this->title = $title;
+ $this->ids = $ids;
+ }
+
+ /**
+ * Get the internal type name of this list. Equal to the table name.
+ * Override this function.
+ */
+ public function getType() {
+ return null;
+ }
+
+ /**
+ * Initialise the current iteration pointer
+ */
+ protected function initCurrent() {
+ $row = $this->res->current();
+ if ( $row ) {
+ $this->current = $this->newItem( $row );
+ } else {
+ $this->current = false;
+ }
+ }
+
+ /**
+ * Start iteration. This must be called before current() or next().
+ * @return First list item
+ */
+ public function reset() {
+ if ( !$this->res ) {
+ $this->res = $this->doQuery( wfGetDB( DB_SLAVE ) );
+ } else {
+ $this->res->rewind();
+ }
+ $this->initCurrent();
+ return $this->current;
+ }
+
+ /**
+ * Get the current list item, or false if we are at the end
+ */
+ public function current() {
+ return $this->current;
+ }
+
+ /**
+ * Move the iteration pointer to the next list item, and return it.
+ */
+ public function next() {
+ $this->res->next();
+ $this->initCurrent();
+ return $this->current;
+ }
+
+ /**
+ * Get the number of items in the list.
+ */
+ public function length() {
+ if( !$this->res ) {
+ return 0;
+ } else {
+ return $this->res->numRows();
+ }
+ }
+
+ /**
+ * Do the DB query to iterate through the objects.
+ * @param $db DatabaseBase object to use for the query
+ */
+ abstract public function doQuery( $db );
+
+ /**
+ * Create an item object from a DB result row
+ * @param $row stdclass
+ */
+ abstract public function newItem( $row );
+
+ /**
+ * Get the language of the user doing the action
+ *
+ * @return Language object
+ */
+ public function getLang() {
+ return $this->context->getLang();
+ }
+
+ /**
+ * Get the user doing the action
+ *
+ * @return User object
+ */
+ public function getUser() {
+ return $this->context->getUser();
+ }
+}
+
+/**
+ * Abstract base class for revision items
+ */
+abstract class Rev_Item {
+ /** The parent Rev_List */
+ var $list;
+
+ /** The DB result row */
+ var $row;
+
+ /**
+ * @param $list Rev_List
+ * @param $row DB result row
+ */
+ public function __construct( $list, $row ) {
+ $this->list = $list;
+ $this->row = $row;
+ }
+
+ /**
+ * Get the DB field name associated with the ID list.
+ * Override this function.
+ */
+ public function getIdField() {
+ return null;
+ }
+
+ /**
+ * Get the DB field name storing timestamps.
+ * Override this function.
+ */
+ public function getTimestampField() {
+ return false;
+ }
+
+ /**
+ * Get the DB field name storing user ids.
+ * Override this function.
+ */
+ public function getAuthorIdField() {
+ return false;
+ }
+
+ /**
+ * Get the DB field name storing user names.
+ * Override this function.
+ */
+ public function getAuthorNameField() {
+ return false;
+ }
+
+ /**
+ * Get the ID, as it would appear in the ids URL parameter
+ */
+ public function getId() {
+ $field = $this->getIdField();
+ return $this->row->$field;
+ }
+
+ /**
+ * Get the date, formatted with $wgLang
+ */
+ public function formatDate() {
+ global $wgLang;
+ return $wgLang->date( $this->getTimestamp() );
+ }
+
+ /**
+ * Get the time, formatted with $wgLang
+ */
+ public function formatTime() {
+ global $wgLang;
+ return $wgLang->time( $this->getTimestamp() );
+ }
+
+ /**
+ * Get the timestamp in MW 14-char form
+ */
+ public function getTimestamp() {
+ $field = $this->getTimestampField();
+ return wfTimestamp( TS_MW, $this->row->$field );
+ }
+
+ /**
+ * Get the author user ID
+ */
+ public function getAuthorId() {
+ $field = $this->getAuthorIdField();
+ return intval( $this->row->$field );
+ }
+
+ /**
+ * Get the author user name
+ */
+ public function getAuthorName() {
+ $field = $this->getAuthorNameField();
+ return strval( $this->row->$field );
+ }
+
+ /**
+ * Returns true if the current user can view the item
+ */
+ abstract public function canView();
+
+ /**
+ * Returns true if the current user can view the item text/file
+ */
+ abstract public function canViewContent();
+
+ /**
+ * Get the HTML of the list item. Should be include <li></li> tags.
+ * This is used to show the list in HTML form, by the special page.
+ */
+ abstract public function getHTML();
+}
+
+class RevisionList extends Rev_List {
+ public function getType() {
+ return 'revision';
+ }
+
+ /**
+ * @param $db DatabaseBase
+ * @return mixed
+ */
+ public function doQuery( $db ) {
+ $ids = array_map( 'intval', $this->ids );
+ return $db->select( array('revision','page'), '*',
+ array(
+ 'rev_page' => $this->title->getArticleID(),
+ 'rev_id' => array_map( 'intval', $this->ids ),
+ 'rev_page = page_id'
+ ),
+ __METHOD__,
+ array( 'ORDER BY' => 'rev_id DESC' )
+ );
+ }
+
+ public function newItem( $row ) {
+ return new RevisionItem( $this, $row );
+ }
+}
+
+/**
+ * Item class for a live revision table row
+ */
+class RevisionItem extends Rev_Item {
+ var $revision, $context;
+
+ public function __construct( $list, $row ) {
+ parent::__construct( $list, $row );
+ $this->revision = new Revision( $row );
+ $this->context = $list->context;
+ }
+
+ public function getIdField() {
+ return 'rev_id';
+ }
+
+ public function getTimestampField() {
+ return 'rev_timestamp';
+ }
+
+ public function getAuthorIdField() {
+ return 'rev_user';
+ }
+
+ public function getAuthorNameField() {
+ return 'rev_user_text';
+ }
+
+ public function canView() {
+ return $this->revision->userCan( Revision::DELETED_RESTRICTED );
+ }
+
+ public function canViewContent() {
+ return $this->revision->userCan( Revision::DELETED_TEXT );
+ }
+
+ public function isDeleted() {
+ return $this->revision->isDeleted( Revision::DELETED_TEXT );
+ }
+
+ /**
+ * Get the HTML link to the revision text.
+ * Overridden by RevDel_ArchiveItem.
+ */
+ protected function getRevisionLink() {
+ $date = $this->list->getLang()->timeanddate( $this->revision->getTimestamp(), true );
+ if ( $this->isDeleted() && !$this->canViewContent() ) {
+ return $date;
+ }
+ return Linker::link(
+ $this->list->title,
+ $date,
+ array(),
+ array(
+ 'oldid' => $this->revision->getId(),
+ 'unhide' => 1
+ )
+ );
+ }
+
+ /**
+ * Get the HTML link to the diff.
+ * Overridden by RevDel_ArchiveItem
+ */
+ protected function getDiffLink() {
+ if ( $this->isDeleted() && !$this->canViewContent() ) {
+ return wfMsgHtml('diff');
+ } else {
+ return
+ Linker::link(
+ $this->list->title,
+ wfMsgHtml('diff'),
+ array(),
+ array(
+ 'diff' => $this->revision->getId(),
+ 'oldid' => 'prev',
+ 'unhide' => 1
+ ),
+ array(
+ 'known',
+ 'noclasses'
+ )
+ );
+ }
+ }
+
+ public function getHTML() {
+ $difflink = $this->getDiffLink();
+ $revlink = $this->getRevisionLink();
+ $userlink = Linker::revUserLink( $this->revision );
+ $comment = Linker::revComment( $this->revision );
+ if ( $this->isDeleted() ) {
+ $revlink = "<span class=\"history-deleted\">$revlink</span>";
+ }
+ return "<li>($difflink) $revlink $userlink $comment</li>";
+ }
+}
*/
class RevDel_RevisionList extends RevDel_List {
var $currentRevId;
- var $type = 'revision';
- var $idField = 'rev_id';
- var $dateField = 'rev_timestamp';
- var $authorIdField = 'rev_user';
- var $authorNameField = 'rev_user_text';
+
+ public function getType() {
+ return 'revision';
+ }
+
+ public static function getRelationType() {
+ return 'rev_id';
+ }
/**
* @param $db DatabaseBase
$this->revision = new Revision( $row );
}
+ public function getIdField() {
+ return 'rev_id';
+ }
+
+ public function getTimestampField() {
+ return 'rev_timestamp';
+ }
+
+ public function getAuthorIdField() {
+ return 'rev_user';
+ }
+
+ public function getAuthorNameField() {
+ return 'rev_user_text';
+ }
+
public function canView() {
return $this->revision->userCan( Revision::DELETED_RESTRICTED );
}
* Overridden by RevDel_ArchiveItem.
*/
protected function getRevisionLink() {
- $date = $this->getLang()->timeanddate( $this->revision->getTimestamp(), true );
+ $date = $this->list->getLang()->timeanddate( $this->revision->getTimestamp(), true );
if ( $this->isDeleted() && !$this->canViewContent() ) {
return $date;
}
* List for archive table items, i.e. revisions deleted via action=delete
*/
class RevDel_ArchiveList extends RevDel_RevisionList {
- var $type = 'archive';
- var $idField = 'ar_timestamp';
- var $dateField = 'ar_timestamp';
- var $authorIdField = 'ar_user';
- var $authorNameField = 'ar_user_text';
+ public function getType() {
+ return 'archive';
+ }
+
+ public static function getRelationType() {
+ return 'ar_timestamp';
+ }
/**
* @param $db DatabaseBase
array( 'page' => $this->list->title->getArticleId() ) );
}
+ public function getIdField() {
+ return 'ar_timestamp';
+ }
+
+ public function getTimestampField() {
+ return 'ar_timestamp';
+ }
+
+ public function getAuthorIdField() {
+ return 'ar_user';
+ }
+
+ public function getAuthorNameField() {
+ return 'ar_user_text';
+ }
+
public function getId() {
# Convert DB timestamp to MW timestamp
return $this->revision->getTimestamp();
$dbw = wfGetDB( DB_MASTER );
$dbw->update( 'archive',
array( 'ar_deleted' => $bits ),
- array( 'ar_namespace' => $this->list->title->getNamespace(),
- 'ar_title' => $this->list->title->getDBkey(),
+ array(
+ 'ar_namespace' => $this->list->title->getNamespace(),
+ 'ar_title' => $this->list->title->getDBkey(),
// use timestamp for index
- 'ar_timestamp' => $this->row->ar_timestamp,
- 'ar_rev_id' => $this->row->ar_rev_id,
- 'ar_deleted' => $this->getBits()
+ 'ar_timestamp' => $this->row->ar_timestamp,
+ 'ar_rev_id' => $this->row->ar_rev_id,
+ 'ar_deleted' => $this->getBits()
),
__METHOD__ );
return (bool)$dbw->affectedRows();
protected function getRevisionLink() {
$undelete = SpecialPage::getTitleFor( 'Undelete' );
- $date = $this->getLang()->timeanddate( $this->revision->getTimestamp(), true );
+ $date = $this->list->getLang()->timeanddate( $this->revision->getTimestamp(), true );
if ( $this->isDeleted() && !$this->canViewContent() ) {
return $date;
}
array( 'page' => $this->list->title->getArticleId() ) );
}
+ public function getIdField() {
+ return 'ar_rev_id';
+ }
+
public function getId() {
return $this->revision->getId();
}
* List for oldimage table items
*/
class RevDel_FileList extends RevDel_List {
- var $type = 'oldimage';
- var $idField = 'oi_archive_name';
- var $dateField = 'oi_timestamp';
- var $authorIdField = 'oi_user';
- var $authorNameField = 'oi_user_text';
+ public function getType() {
+ return 'oldimage';
+ }
+
+ public static function getRelationType() {
+ return 'oi_archive_name';
+ }
+
var $storeBatch, $deleteBatch, $cleanupBatch;
/**
$this->file = RepoGroup::singleton()->getLocalRepo()->newFileFromRow( $row );
}
+ public function getIdField() {
+ return 'oi_archive_name';
+ }
+
+ public function getTimestampField() {
+ return 'oi_timestamp';
+ }
+
+ public function getAuthorIdField() {
+ return 'oi_user';
+ }
+
+ public function getAuthorNameField() {
+ return 'oi_user_text';
+ }
+
public function getId() {
$parts = explode( '!', $this->row->oi_archive_name );
return $parts[0];
* Overridden by RevDel_ArchivedFileItem.
*/
protected function getLink() {
- $date = $this->getLang()->timeanddate( $this->file->getTimestamp(), true );
+ $date = $this->list->getLang()->timeanddate( $this->file->getTimestamp(), true );
if ( $this->isDeleted() ) {
# Hidden files...
if ( !$this->canViewContent() ) {
array(
'target' => $this->list->title->getPrefixedText(),
'file' => $this->file->getArchiveName(),
- 'token' => $this->getUser()->editToken( $this->file->getArchiveName() )
+ 'token' => $this->list->getUser()->editToken(
+ $this->file->getArchiveName() )
)
);
}
$data =
wfMsg(
'widthheight',
- $this->getLang()->formatNum( $this->file->getWidth() ),
- $this->getLang()->formatNum( $this->file->getHeight() )
+ $this->list->getLang()->formatNum( $this->file->getWidth() ),
+ $this->list->getLang()->formatNum( $this->file->getHeight() )
) .
' (' .
- wfMsgExt( 'nbytes', 'parsemag', $this->getLang()->formatNum( $this->file->getSize() ) ) .
+ wfMsgExt( 'nbytes', 'parsemag', $this->list->getLang()->formatNum( $this->file->getSize() ) ) .
')';
return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
* List for filearchive table items
*/
class RevDel_ArchivedFileList extends RevDel_FileList {
- var $type = 'filearchive';
- var $idField = 'fa_id';
- var $dateField = 'fa_timestamp';
- var $authorIdField = 'fa_user';
- var $authorNameField = 'fa_user_text';
+ public function getType() {
+ return 'filearchive';
+ }
+
+ public static function getRelationType() {
+ return 'fa_id';
+ }
/**
* @param $db DatabaseBase
$this->file = ArchivedFile::newFromRow( $row );
}
+ public function getIdField() {
+ return 'fa_id';
+ }
+
+ public function getTimestampField() {
+ return 'fa_timestamp';
+ }
+
+ public function getAuthorIdField() {
+ return 'fa_user';
+ }
+
+ public function getAuthorNameField() {
+ return 'fa_user_text';
+ }
+
public function getId() {
return $this->row->fa_id;
}
}
protected function getLink() {
- $date = $this->getLang()->timeanddate( $this->file->getTimestamp(), true );
+ $date = $this->list->getLang()->timeanddate( $this->file->getTimestamp(), true );
$undelete = SpecialPage::getTitleFor( 'Undelete' );
$key = $this->file->getKey();
# Hidden files...
array(
'target' => $this->list->title->getPrefixedText(),
'file' => $key,
- 'token' => $this->getUser()->editToken( $key )
+ 'token' => $this->list->getUser()->editToken( $key )
)
);
}
* List for logging table items
*/
class RevDel_LogList extends RevDel_List {
- var $type = 'logging';
- var $idField = 'log_id';
- var $dateField = 'log_timestamp';
- var $authorIdField = 'log_user';
- var $authorNameField = 'log_user_text';
+ public function getType() {
+ return 'logging';
+ }
+
+ public static function getRelationType() {
+ return 'log_id';
+ }
/**
* @param $db DatabaseBase
* Item class for a logging table row
*/
class RevDel_LogItem extends RevDel_Item {
+ public function getIdField() {
+ return 'log_id';
+ }
+
+ public function getTimestampField() {
+ return 'log_timestamp';
+ }
+
+ public function getAuthorIdField() {
+ return 'log_user';
+ }
+
+ public function getAuthorNameField() {
+ return 'log_user_text';
+ }
+
public function canView() {
return LogEventsList::userCan( $this->row, Revision::DELETED_RESTRICTED );
}
}
public function getHTML() {
- $date = htmlspecialchars( $this->getLang()->timeanddate( $this->row->log_timestamp ) );
+ $date = htmlspecialchars( $this->list->getLang()->timeanddate( $this->row->log_timestamp ) );
$paramArray = LogPage::extractParams( $this->row->log_params );
$title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
$userLink = '<span class="history-deleted">' . $userLink . '</span>';
}
// Comment
- $comment = $this->getLang()->getDirMark() . Linker::commentBlock( $this->row->log_comment );
+ $comment = $this->list->getLang()->getDirMark() . Linker::commentBlock( $this->row->log_comment );
if( LogEventsList::isDeleted($this->row,LogPage::DELETED_COMMENT) ) {
$comment = '<span class="history-deleted">' . $comment . '</span>';
}
* relevant rows, to return RevDel_Item subclasses wrapping them, and
* to wrap bulk update operations.
*/
-abstract class RevDel_List {
-
- /**
- * @var Title
- */
- var $title;
-
- var $special, $ids, $res, $current;
- var $type = null; // override this
- var $idField = null; // override this
- var $dateField = false; // override this
- var $authorIdField = false; // override this
- var $authorNameField = false; // override this
-
+abstract class RevDel_List extends Rev_List {
/**
- * @param $special The parent SpecialPage
- * @param $title The target title
- * @param $ids Array of IDs
+ * Get the DB field name associated with the ID list.
+ * This used to populate the log_search table for finding log entries.
+ * Override this function.
*/
- public function __construct( $special, $title, $ids ) {
- $this->special = $special;
- $this->title = $title;
- $this->ids = $ids;
+ public static function getRelationType() {
+ return null;
}
- /**
- * Get the internal type name of this list. Equal to the table name.
- */
- public function getType() {
- return $this->type;
- }
-
- /**
- * Get the DB field name associated with the ID list
- */
- public function getIdField() {
- return $this->idField;
- }
-
- /**
- * Get the DB field name storing timestamps
- */
- public function getTimestampField() {
- return $this->dateField;
- }
-
- /**
- * Get the DB field name storing user ids
- */
- public function getAuthorIdField() {
- return $this->authorIdField;
- }
-
- /**
- * Get the DB field name storing user names
- */
- public function getAuthorNameField() {
- return $this->authorNameField;
- }
/**
* Set the visibility for the revisions in this list. Logging and
* transactions are done here.
);
}
- /**
- * Initialise the current iteration pointer
- */
- protected function initCurrent() {
- $row = $this->res->current();
- if ( $row ) {
- $this->current = $this->newItem( $row );
- } else {
- $this->current = false;
- }
- }
-
- /**
- * Start iteration. This must be called before current() or next().
- * @return First list item
- */
- public function reset() {
- if ( !$this->res ) {
- $this->res = $this->doQuery( wfGetDB( DB_SLAVE ) );
- } else {
- $this->res->rewind();
- }
- $this->initCurrent();
- return $this->current;
- }
-
- /**
- * Get the current list item, or false if we are at the end
- */
- public function current() {
- return $this->current;
- }
-
- /**
- * Move the iteration pointer to the next list item, and return it.
- */
- public function next() {
- $this->res->next();
- $this->initCurrent();
- return $this->current;
- }
-
- /**
- * Get the number of items in the list.
- */
- public function length() {
- if( !$this->res ) {
- return 0;
- } else {
- return $this->res->numRows();
- }
- }
-
/**
* Clear any data structures needed for doPreCommitUpdates() and doPostCommitUpdates()
* STUB
return Status::newGood();
}
- /**
- * Get the user doing the action
- *
- * @return User object
- */
- public function getUser() {
- return $this->special->getUser();
- }
-
- /**
- * Get the language of the user doing the action
- *
- * @return Language object
- */
- public function getLang() {
- return $this->special->getLang();
- }
-
- /**
- * Create an item object from a DB result row
- * @param $row stdclass
- */
- abstract public function newItem( $row );
-
- /**
- * Do the DB query to iterate through the objects.
- * @param $db DatabaseBase object to use for the query
- */
- abstract public function doQuery( $db );
-
/**
* Get the integer value of the flag used for suppression
*/
/**
* Abstract base class for deletable items
*/
-abstract class RevDel_Item {
- /** The parent SpecialPage */
- var $special;
-
- /** The parent RevDel_List */
- var $list;
-
- /** The DB result row */
- var $row;
-
- /**
- * @param $list RevDel_List
- * @param $row DB result row
- */
- public function __construct( $list, $row ) {
- $this->special = $list->special;
- $this->list = $list;
- $this->row = $row;
- }
-
- /**
- * Get the ID, as it would appear in the ids URL parameter
- */
- public function getId() {
- $field = $this->list->getIdField();
- return $this->row->$field;
- }
-
- /**
- * Get the date, formatted with $wgLang
- */
- public function formatDate() {
- global $wgLang;
- return $wgLang->date( $this->getTimestamp() );
- }
-
- /**
- * Get the time, formatted with $wgLang
- */
- public function formatTime() {
- global $wgLang;
- return $wgLang->time( $this->getTimestamp() );
- }
-
- /**
- * Get the timestamp in MW 14-char form
- */
- public function getTimestamp() {
- $field = $this->list->getTimestampField();
- return wfTimestamp( TS_MW, $this->row->$field );
- }
-
- /**
- * Get the author user ID
- */
- public function getAuthorId() {
- $field = $this->list->getAuthorIdField();
- return intval( $this->row->$field );
- }
-
- /**
- * Get the author user name
- */
- public function getAuthorName() {
- $field = $this->list->getAuthorNameField();
- return strval( $this->row->$field );
- }
-
+abstract class RevDel_Item extends Rev_Item {
/**
* Returns true if the item is "current", and the operation to set the given
* bits can't be executed for that reason
return false;
}
- /**
- * Get the user doing the action
- *
- * @return User object
- */
- public function getUser() {
- return $this->special->getUser();
- }
-
- /**
- * Get the language of the user doing the action
- *
- * @return Language object
- */
- public function getLang() {
- return $this->special->getLang();
- }
-
- /**
- * Returns true if the current user can view the item
- */
- abstract public function canView();
-
- /**
- * Returns true if the current user can view the item text/file
- */
- abstract public function canViewContent();
-
/**
* Get the current deletion bitfield value
*/
abstract public function getBits();
- /**
- * Get the HTML of the list item. Should be include <li></li> tags.
- * This is used to show the list in HTML form, by the special page.
- */
- abstract public function getHTML();
-
/**
* Set the visibility of the item. This should do any necessary DB queries.
*
}
if ( isset( SpecialRevisionDelete::$allowedTypes[$typeName] ) ) {
$class = SpecialRevisionDelete::$allowedTypes[$typeName]['list-class'];
- $list = new $class( null, null, null );
- return $list->getIdField();
+ return call_user_func( array( $class, 'getRelationType' ) );
} else {
return null;
}
*/
static $allowedTypes = array(
'revision' => array(
- 'check-label' => 'revdelete-hide-text',
+ 'check-label' => 'revdelete-hide-text',
'deletion-bits' => Revision::DELETED_TEXT,
- 'success' => 'revdelete-success',
- 'failure' => 'revdelete-failure',
- 'list-class' => 'RevDel_RevisionList',
+ 'success' => 'revdelete-success',
+ 'failure' => 'revdelete-failure',
+ 'list-class' => 'RevDel_RevisionList',
),
'archive' => array(
- 'check-label' => 'revdelete-hide-text',
+ 'check-label' => 'revdelete-hide-text',
'deletion-bits' => Revision::DELETED_TEXT,
- 'success' => 'revdelete-success',
- 'failure' => 'revdelete-failure',
- 'list-class' => 'RevDel_ArchiveList',
+ 'success' => 'revdelete-success',
+ 'failure' => 'revdelete-failure',
+ 'list-class' => 'RevDel_ArchiveList',
),
'oldimage'=> array(
- 'check-label' => 'revdelete-hide-image',
+ 'check-label' => 'revdelete-hide-image',
'deletion-bits' => File::DELETED_FILE,
- 'success' => 'revdelete-success',
- 'failure' => 'revdelete-failure',
- 'list-class' => 'RevDel_FileList',
+ 'success' => 'revdelete-success',
+ 'failure' => 'revdelete-failure',
+ 'list-class' => 'RevDel_FileList',
),
'filearchive' => array(
- 'check-label' => 'revdelete-hide-image',
+ 'check-label' => 'revdelete-hide-image',
'deletion-bits' => File::DELETED_FILE,
- 'success' => 'revdelete-success',
- 'failure' => 'revdelete-failure',
- 'list-class' => 'RevDel_ArchivedFileList',
+ 'success' => 'revdelete-success',
+ 'failure' => 'revdelete-failure',
+ 'list-class' => 'RevDel_ArchivedFileList',
),
'logging' => array(
- 'check-label' => 'revdelete-hide-name',
+ 'check-label' => 'revdelete-hide-name',
'deletion-bits' => LogPage::DELETED_ACTION,
- 'success' => 'logdelete-success',
- 'failure' => 'logdelete-failure',
- 'list-class' => 'RevDel_LogList',
+ 'success' => 'logdelete-success',
+ 'failure' => 'logdelete-failure',
+ 'list-class' => 'RevDel_LogList',
),
);
protected function getLogQueryCond() {
$conds = array();
// Revision delete logs for these item
- $conds['log_type'] = array('delete','suppress');
+ $conds['log_type'] = array( 'delete', 'suppress' );
$conds['log_action'] = $this->getList()->getLogAction();
$conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName );
$conds['ls_value'] = $this->ids;
protected function getList() {
if ( is_null( $this->list ) ) {
$class = $this->typeInfo['list-class'];
- $this->list = new $class( $this, $this->targetObj, $this->ids );
+ $this->list = new $class( $this->getContext(), $this->targetObj, $this->ids );
}
return $this->list;
}
*/
protected function submit() {
# Check edit token on submission
- if( $this->submitClicked && !$this->getUser()->matchEditToken( $this->getRequest()->getVal('wpEditToken') ) ) {
+ $token = $this->getRequest()->getVal('wpEditToken');
+ if( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
$this->getOutput()->addWikiMsg( 'sessionfailure' );
return false;
}