summaryrefslogtreecommitdiff
path: root/includes/revisiondelete
diff options
context:
space:
mode:
Diffstat (limited to 'includes/revisiondelete')
-rw-r--r--includes/revisiondelete/RevDelArchiveList.php2
-rw-r--r--includes/revisiondelete/RevDelArchivedFileList.php2
-rw-r--r--includes/revisiondelete/RevDelFileList.php2
-rw-r--r--includes/revisiondelete/RevDelList.php28
-rw-r--r--includes/revisiondelete/RevDelLogItem.php10
-rw-r--r--includes/revisiondelete/RevDelLogList.php8
-rw-r--r--includes/revisiondelete/RevDelRevisionList.php4
-rw-r--r--includes/revisiondelete/RevisionDeleteUser.php4
-rw-r--r--includes/revisiondelete/RevisionDeleter.php3
9 files changed, 31 insertions, 32 deletions
diff --git a/includes/revisiondelete/RevDelArchiveList.php b/includes/revisiondelete/RevDelArchiveList.php
index e7aed737..6ae0afce 100644
--- a/includes/revisiondelete/RevDelArchiveList.php
+++ b/includes/revisiondelete/RevDelArchiveList.php
@@ -32,7 +32,7 @@ class RevDelArchiveList extends RevDelRevisionList {
}
/**
- * @param DatabaseBase $db
+ * @param IDatabase $db
* @return mixed
*/
public function doQuery( $db ) {
diff --git a/includes/revisiondelete/RevDelArchivedFileList.php b/includes/revisiondelete/RevDelArchivedFileList.php
index aec51b17..f2b99aed 100644
--- a/includes/revisiondelete/RevDelArchivedFileList.php
+++ b/includes/revisiondelete/RevDelArchivedFileList.php
@@ -32,7 +32,7 @@ class RevDelArchivedFileList extends RevDelFileList {
}
/**
- * @param DatabaseBase $db
+ * @param IDatabase $db
* @return mixed
*/
public function doQuery( $db ) {
diff --git a/includes/revisiondelete/RevDelFileList.php b/includes/revisiondelete/RevDelFileList.php
index 57e15d81..2295eaa1 100644
--- a/includes/revisiondelete/RevDelFileList.php
+++ b/includes/revisiondelete/RevDelFileList.php
@@ -49,7 +49,7 @@ class RevDelFileList extends RevDelList {
}
/**
- * @param DatabaseBase $db
+ * @param IDatabase $db
* @return mixed
*/
public function doQuery( $db ) {
diff --git a/includes/revisiondelete/RevDelList.php b/includes/revisiondelete/RevDelList.php
index a0ff6672..840fd772 100644
--- a/includes/revisiondelete/RevDelList.php
+++ b/includes/revisiondelete/RevDelList.php
@@ -247,16 +247,22 @@ abstract class RevDelList extends RevisionListBase {
} else {
$logType = 'delete';
}
- // Add params for effected page and ids
+ // Add params for affected page and ids
$logParams = $this->getLogParams( $params );
// Actually add the deletion log entry
- $log = new LogPage( $logType );
- $logid = $log->addEntry( $this->getLogAction(), $params['title'],
- $params['comment'], $logParams, $this->getUser() );
+ $logEntry = new ManualLogEntry( $logType, $this->getLogAction() );
+ $logEntry->setTarget( $params['title'] );
+ $logEntry->setComment( $params['comment'] );
+ $logEntry->setParameters( $logParams );
+ $logEntry->setPerformer( $this->getUser() );
// Allow for easy searching of deletion log items for revision/log items
- $log->addRelations( $field, $params['ids'], $logid );
- $log->addRelations( 'target_author_id', $params['authorIds'], $logid );
- $log->addRelations( 'target_author_ip', $params['authorIPs'], $logid );
+ $logEntry->setRelations( array(
+ $field => $params['ids'],
+ 'target_author_id' => $params['authorIds'],
+ 'target_author_ip' => $params['authorIPs'],
+ ) );
+ $logId = $logEntry->insert();
+ $logEntry->publish( $logId );
}
/**
@@ -274,10 +280,10 @@ abstract class RevDelList extends RevisionListBase {
*/
public function getLogParams( $params ) {
return array(
- $this->getType(),
- implode( ',', $params['ids'] ),
- "ofield={$params['oldBits']}",
- "nfield={$params['newBits']}"
+ '4::type' => $this->getType(),
+ '5::ids' => $params['ids'],
+ '6::ofield' => $params['oldBits'],
+ '7::nfield' => $params['newBits'],
);
}
diff --git a/includes/revisiondelete/RevDelLogItem.php b/includes/revisiondelete/RevDelLogItem.php
index 5c8b8c9d..49adf204 100644
--- a/includes/revisiondelete/RevDelLogItem.php
+++ b/includes/revisiondelete/RevDelLogItem.php
@@ -124,15 +124,7 @@ class RevDelLogItem extends RevDelItem {
: array();
if ( LogEventsList::userCan( $this->row, LogPage::DELETED_ACTION, $user ) ) {
- ApiQueryLogEvents::addLogParams(
- $result,
- $ret,
- $logEntry->getParameters(),
- $logEntry->getType(),
- $logEntry->getSubtype(),
- $logEntry->getTimestamp(),
- $logEntry->isLegacy()
- );
+ $ret['params'] = LogFormatter::newFromEntry( $logEntry )->formatParametersForApi();
}
if ( LogEventsList::userCan( $this->row, LogPage::DELETED_USER, $user ) ) {
$ret += array(
diff --git a/includes/revisiondelete/RevDelLogList.php b/includes/revisiondelete/RevDelLogList.php
index ad040425..d8bd2f7e 100644
--- a/includes/revisiondelete/RevDelLogList.php
+++ b/includes/revisiondelete/RevDelLogList.php
@@ -55,7 +55,7 @@ class RevDelLogList extends RevDelList {
}
/**
- * @param DatabaseBase $db
+ * @param IDatabase $db
* @return mixed
*/
public function doQuery( $db ) {
@@ -95,9 +95,9 @@ class RevDelLogList extends RevDelList {
public function getLogParams( $params ) {
return array(
- implode( ',', $params['ids'] ),
- "ofield={$params['oldBits']}",
- "nfield={$params['newBits']}"
+ '4::ids' => $params['ids'],
+ '5::ofield' => $params['oldBits'],
+ '6::nfield' => $params['newBits'],
);
}
}
diff --git a/includes/revisiondelete/RevDelRevisionList.php b/includes/revisiondelete/RevDelRevisionList.php
index 25450725..4a0fff87 100644
--- a/includes/revisiondelete/RevDelRevisionList.php
+++ b/includes/revisiondelete/RevDelRevisionList.php
@@ -54,7 +54,7 @@ class RevDelRevisionList extends RevDelList {
}
/**
- * @param DatabaseBase $db
+ * @param IDatabase $db
* @return mixed
*/
public function doQuery( $db ) {
@@ -137,7 +137,7 @@ class RevDelRevisionList extends RevDelList {
public function doPostCommitUpdates() {
$this->title->purgeSquid();
// Extensions that require referencing previous revisions may need this
- wfRunHooks( 'ArticleRevisionVisibilitySet', array( &$this->title ) );
+ Hooks::run( 'ArticleRevisionVisibilitySet', array( $this->title, $this->ids ) );
return Status::newGood();
}
}
diff --git a/includes/revisiondelete/RevisionDeleteUser.php b/includes/revisiondelete/RevisionDeleteUser.php
index 55c46c5e..79802d66 100644
--- a/includes/revisiondelete/RevisionDeleteUser.php
+++ b/includes/revisiondelete/RevisionDeleteUser.php
@@ -36,14 +36,14 @@ class RevisionDeleteUser {
* @param string $name Username
* @param int $userId User id
* @param string $op Operator '|' or '&'
- * @param null|DatabaseBase $dbw If you happen to have one lying around
+ * @param null|IDatabase $dbw If you happen to have one lying around
* @return bool
*/
private static function setUsernameBitfields( $name, $userId, $op, $dbw ) {
if ( !$userId || ( $op !== '|' && $op !== '&' ) ) {
return false; // sanity check
}
- if ( !$dbw instanceof DatabaseBase ) {
+ if ( !$dbw instanceof IDatabase ) {
$dbw = wfGetDB( DB_MASTER );
}
diff --git a/includes/revisiondelete/RevisionDeleter.php b/includes/revisiondelete/RevisionDeleter.php
index d4f81678..ba1f0f69 100644
--- a/includes/revisiondelete/RevisionDeleter.php
+++ b/includes/revisiondelete/RevisionDeleter.php
@@ -78,6 +78,7 @@ class RevisionDeleter {
* @param Title $title
* @param array $ids
* @return RevDelList
+ * @throws MWException
*/
public static function createList( $typeName, IContextSource $context, Title $title, array $ids ) {
$typeName = self::getCanonicalTypeName( $typeName );
@@ -115,7 +116,7 @@ class RevisionDeleter {
* "revdelete-restricted", "revdelete-unrestricted" indicating (un)suppression
* or null to indicate nothing in particular.
* You can turn the keys in $arr[0] and $arr[1] into message keys by
- * appending -hid and and -unhid to the keys respectively.
+ * appending -hid and -unhid to the keys respectively.
*
* @param int $n The new bitfield.
* @param int $o The old bitfield.