Merge "http: Support HTTP Basic Authentication"
[lhc/web/wiklou.git] / includes / api / ApiDelete.php
index 77911b0..993c23e 100644 (file)
@@ -73,10 +73,11 @@ class ApiDelete extends ApiBase {
                                $user,
                                $params['oldimage'],
                                $reason,
-                               false
+                               false,
+                               $params['tags']
                        );
                } else {
-                       $status = self::delete( $pageObj, $user, $reason );
+                       $status = self::delete( $pageObj, $user, $reason, $params['tags'] );
                }
 
                if ( is_array( $status ) ) {
@@ -96,11 +97,6 @@ class ApiDelete extends ApiBase {
                }
                $this->setWatch( $watch, $titleObj, 'watchdeletion' );
 
-               // Apply change tags to the log entry, if requested
-               if ( count( $params['tags'] ) ) {
-                       ChangeTags::addTags( $params['tags'], null, null, $status->value, null );
-               }
-
                $r = [
                        'title' => $titleObj->getPrefixedText(),
                        'reason' => $reason,
@@ -115,9 +111,10 @@ class ApiDelete extends ApiBase {
         * @param Page|WikiPage $page Page or WikiPage object to work on
         * @param User $user User doing the action
         * @param string|null $reason Reason for the deletion. Autogenerated if null
+        * @param array $tags Tags to tag the deletion with
         * @return Status|array
         */
-       protected static function delete( Page $page, User $user, &$reason = null ) {
+       protected static function delete( Page $page, User $user, &$reason = null, $tags = [] ) {
                $title = $page->getTitle();
 
                // Auto-generate a summary, if necessary
@@ -134,7 +131,7 @@ class ApiDelete extends ApiBase {
                $error = '';
 
                // Luckily, Article.php provides a reusable delete function that does the hard work for us
-               return $page->doDeleteArticleReal( $reason, false, 0, true, $error, $user );
+               return $page->doDeleteArticleReal( $reason, false, 0, true, $error, $user, $tags );
        }
 
        /**
@@ -143,16 +140,17 @@ class ApiDelete extends ApiBase {
         * @param string $oldimage Archive name
         * @param string $reason Reason for the deletion. Autogenerated if null.
         * @param bool $suppress Whether to mark all deleted versions as restricted
+        * @param array $tags Tags to tag the deletion with
         * @return Status|array
         */
        protected static function deleteFile( Page $page, User $user, $oldimage,
-               &$reason = null, $suppress = false
+               &$reason = null, $suppress = false, $tags = []
        ) {
                $title = $page->getTitle();
 
                $file = $page->getFile();
                if ( !$file->exists() || !$file->isLocal() || $file->getRedirected() ) {
-                       return self::delete( $page, $user, $reason );
+                       return self::delete( $page, $user, $reason, $tags );
                }
 
                if ( $oldimage ) {
@@ -169,7 +167,7 @@ class ApiDelete extends ApiBase {
                        $reason = '';
                }
 
-               return FileDeleteForm::doDelete( $title, $file, $oldimage, $reason, $suppress, $user );
+               return FileDeleteForm::doDelete( $title, $file, $oldimage, $reason, $suppress, $user, $tags );
        }
 
        public function mustBePosted() {