Ricordisamoa has uploaded a new change for review.
https://gerrit.wikimedia.org/r/233346
Change subject: File: new methods isCurrent() and getComment(), deprecate
isOld() and getDescription()
......................................................................
File: new methods isCurrent() and getComment(), deprecate isOld() and
getDescription()
Change-Id: I7b78e62efe16f1e6ce8f514598d77dec90974161
---
M includes/filerepo/file/ArchivedFile.php
M includes/filerepo/file/File.php
M includes/filerepo/file/ForeignAPIFile.php
M includes/filerepo/file/LocalFile.php
M includes/filerepo/file/OldLocalFile.php
5 files changed, 36 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/46/233346/1
diff --git a/includes/filerepo/file/ArchivedFile.php
b/includes/filerepo/file/ArchivedFile.php
index 1aec446..ec58ae7 100644
--- a/includes/filerepo/file/ArchivedFile.php
+++ b/includes/filerepo/file/ArchivedFile.php
@@ -512,7 +512,7 @@
*
* @return string
*/
- public function getDescription() {
+ public function getComment() {
$this->load();
if ( $this->isDeleted( File::DELETED_COMMENT ) ) {
return 0;
diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php
index 3677a14..573c05e 100644
--- a/includes/filerepo/file/File.php
+++ b/includes/filerepo/file/File.php
@@ -64,7 +64,7 @@
const DELETE_SOURCE = 1;
- // Audience options for File::getDescription()
+ // Audience options for File::getComment()
const FOR_PUBLIC = 1;
const FOR_THIS_USER = 2;
const RAW = 3;
@@ -1833,13 +1833,24 @@
}
/**
+ * Returns true if the image is the current version
+ * STUB
+ *
+ * @return bool
+ */
+ public function isCurrent() {
+ return true;
+ }
+
+ /**
* Returns true if the image is an old version
* STUB
*
* @return bool
*/
function isOld() {
- return false;
+ wfDeprecated( __METHOD__, '1.26' );
+ return !$this->isCurrent();
}
/**
@@ -2061,11 +2072,28 @@
* passed to the $audience parameter
* @return string
*/
- function getDescription( $audience = self::FOR_PUBLIC, User $user =
null ) {
+ public function getComment( $audience = self::FOR_PUBLIC, User $user =
null ) {
return null;
}
/**
+ * Get description of file revision
+ * STUB
+ *
+ * @param int $audience One of:
+ * File::FOR_PUBLIC to be displayed to all users
+ * File::FOR_THIS_USER to be displayed to the given user
+ * File::RAW get the description regardless of
permissions
+ * @param User $user User object to check for, only if FOR_THIS_USER is
+ * passed to the $audience parameter
+ * @return string
+ */
+ function getDescription( $audience = self::FOR_PUBLIC, User $user =
null ) {
+ wfDeprecated( __METHOD__, '1.26' );
+ return $this->getComment( $audience, $user );
+ }
+
+ /**
* Get the 14-character timestamp of the file upload
*
* @return string|bool TS_MW timestamp or false on failure
diff --git a/includes/filerepo/file/ForeignAPIFile.php
b/includes/filerepo/file/ForeignAPIFile.php
index 3c78290..9c6b159 100644
--- a/includes/filerepo/file/ForeignAPIFile.php
+++ b/includes/filerepo/file/ForeignAPIFile.php
@@ -235,7 +235,7 @@
* @param User $user
* @return null|string
*/
- public function getDescription( $audience = self::FOR_PUBLIC, User
$user = null ) {
+ public function getComment( $audience = self::FOR_PUBLIC, User $user =
null ) {
return isset( $this->mInfo['comment'] ) ? strval(
$this->mInfo['comment'] ) : null;
}
diff --git a/includes/filerepo/file/LocalFile.php
b/includes/filerepo/file/LocalFile.php
index 4070553..794c803 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -1758,7 +1758,7 @@
* @param User $user
* @return string
*/
- function getDescription( $audience = self::FOR_PUBLIC, User $user =
null ) {
+ function getComment( $audience = self::FOR_PUBLIC, User $user = null ) {
$this->load();
if ( $audience == self::FOR_PUBLIC && $this->isDeleted(
self::DELETED_COMMENT ) ) {
return '';
diff --git a/includes/filerepo/file/OldLocalFile.php
b/includes/filerepo/file/OldLocalFile.php
index fd92e11..71cb080 100644
--- a/includes/filerepo/file/OldLocalFile.php
+++ b/includes/filerepo/file/OldLocalFile.php
@@ -163,8 +163,8 @@
/**
* @return bool
*/
- function isOld() {
- return true;
+ function isCurrent() {
+ return false;
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/233346
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b78e62efe16f1e6ce8f514598d77dec90974161
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits