jenkins-bot has submitted this change and it was merged.

Change subject: Add additional information to FileRepo::getInfo
......................................................................


Add additional information to FileRepo::getInfo

The API's meta=filerepoinfo could use some additional information, most
pressingly a way to determine the MW API endpoint of the associated
repo. Since FileRepo already has scriptDirUrl (to which "/api.php" could
be appended), let's just add that.

And for good measure, we may as well include various other bits of
information that people might find useful.

Change-Id: I6d5aa6cf44ef1d9bdfd9b2f36f184e5fdc0900dd
---
M RELEASE-NOTES-1.23
M includes/filerepo/FileRepo.php
2 files changed, 15 insertions(+), 1 deletion(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  Cscott: Looks good to me, but someone else must approve
  MaxSem: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23
index e2c0670..88da8c2 100644
--- a/RELEASE-NOTES-1.23
+++ b/RELEASE-NOTES-1.23
@@ -61,6 +61,8 @@
 === API changes in 1.23 ===
 * (bug 54884) action=parse&prop=categories now indicates hidden and missing
   categories.
+* action=query&meta=filerepoinfo now returns additional information for each
+  repo.
 
 === Languages updated in 1.23===
 
diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php
index 1195d5f..62e6388 100644
--- a/includes/filerepo/FileRepo.php
+++ b/includes/filerepo/FileRepo.php
@@ -1725,12 +1725,24 @@
         * @since 1.22
         */
        public function getInfo() {
-               return array(
+               $ret = array(
                        'name' => $this->getName(),
                        'displayname' => $this->getDisplayName(),
                        'rootUrl' => $this->getRootUrl(),
                        'local' => $this->isLocal(),
                );
+
+               $optionalSettings = array(
+                       'url', 'thumbUrl', 'initialCapital', 'descBaseUrl', 
'scriptDirUrl', 'articleUrl',
+                       'fetchDescription', 'descriptionCacheExpiry', 
'scriptExtension'
+               );
+               foreach ( $optionalSettings as $k ) {
+                       if ( isset( $this->$k ) ) {
+                               $ret[$k] = $this->$k;
+                       }
+               }
+
+               return $ret;
        }
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6d5aa6cf44ef1d9bdfd9b2f36f184e5fdc0900dd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Mwalker <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to