Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101038


Change subject: Fix inconsistency in ArchivedFile::getUser
......................................................................

Fix inconsistency in ArchivedFile::getUser

It was returning user id, where the interface is to take an
argument, and by default return the user text.

This caused weird errors in certain places.

Change-Id: Icae281de67cfaafe52f1fb1fa4c7556aff7cd306
Follow-up: 8bd386e3680808d1ae1166140ef6917f0498ef3a
---
M includes/filerepo/file/ArchivedFile.php
1 file changed, 10 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/38/101038/1

diff --git a/includes/filerepo/file/ArchivedFile.php 
b/includes/filerepo/file/ArchivedFile.php
index 0d86c70..1454b05 100644
--- a/includes/filerepo/file/ArchivedFile.php
+++ b/includes/filerepo/file/ArchivedFile.php
@@ -451,25 +451,31 @@
        }
 
        /**
-        * Return the user ID of the uploader.
+        * Returns ID or name of user who uploaded the file
         *
-        * @return int
+        * @note Prior to MediaWiki 1.23, this method always
+        *   returned the user id, and was inconsistent with
+        *   the rest of the file classes.
+        * @param string $type 'text' or 'id'
+        * @return int|string
         */
-       public function getUser() {
+       public function getUser( $type = 'text' ) {
                $this->load();
                if ( $this->isDeleted( File::DELETED_USER ) ) {
                        return 0;
                } else {
-                       return $this->user;
+                       return parent::getUser( $type );
                }
        }
 
        /**
         * Return the user name of the uploader.
         *
+        * @deprecated 1.23 Use getUser( 'text' ) instead.
         * @return string
         */
        public function getUserText() {
+               wfDeprecated( __METHOD__, '1.23' );
                $this->load();
                if ( $this->isDeleted( File::DELETED_USER ) ) {
                        return 0;

-- 
To view, visit https://gerrit.wikimedia.org/r/101038
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icae281de67cfaafe52f1fb1fa4c7556aff7cd306
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <bawolff...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to