summaryrefslogtreecommitdiff
path: root/includes/api/ApiQueryFileRepoInfo.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-20 09:00:55 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-20 09:00:55 +0100
commita2190ac74dd4d7080b12bab90e552d7aa81209ef (patch)
tree8b31f38de9882d18df54cf8d9e0de74167a094eb /includes/api/ApiQueryFileRepoInfo.php
parent15e69f7b20b6596b9148030acce5b59993b95a45 (diff)
parent257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff)
Merge branch 'mw-1.26'
Diffstat (limited to 'includes/api/ApiQueryFileRepoInfo.php')
-rw-r--r--includes/api/ApiQueryFileRepoInfo.php24
1 files changed, 20 insertions, 4 deletions
diff --git a/includes/api/ApiQueryFileRepoInfo.php b/includes/api/ApiQueryFileRepoInfo.php
index 9ad7e27e..12b9893d 100644
--- a/includes/api/ApiQueryFileRepoInfo.php
+++ b/includes/api/ApiQueryFileRepoInfo.php
@@ -41,18 +41,26 @@ class ApiQueryFileRepoInfo extends ApiQueryBase {
}
public function execute() {
+ $conf = $this->getConfig();
+
$params = $this->extractRequestParams();
$props = array_flip( $params['prop'] );
$repos = array();
$repoGroup = $this->getInitialisedRepoGroup();
+ $foreignTargets = $conf->get( 'ForeignUploadTargets' );
+
+ $repoGroup->forEachForeignRepo( function ( $repo ) use ( &$repos, $props, $foreignTargets ) {
+ $repoProps = $repo->getInfo();
+ $repoProps['canUpload'] = in_array( $repoProps['name'], $foreignTargets );
- $repoGroup->forEachForeignRepo( function ( $repo ) use ( &$repos, $props ) {
- $repos[] = array_intersect_key( $repo->getInfo(), $props );
+ $repos[] = array_intersect_key( $repoProps, $props );
} );
- $repos[] = array_intersect_key( $repoGroup->getLocalRepo()->getInfo(), $props );
+ $localInfo = $repoGroup->getLocalRepo()->getInfo();
+ $localInfo['canUpload'] = $conf->get( 'EnableUploads' );
+ $repos[] = array_intersect_key( $localInfo, $props );
$result = $this->getResult();
ApiResult::setIndexedTagName( $repos, 'repo' );
@@ -85,10 +93,14 @@ class ApiQueryFileRepoInfo extends ApiQueryBase {
$props = array_merge( $props, array_keys( $repo->getInfo() ) );
} );
- return array_values( array_unique( array_merge(
+ $propValues = array_values( array_unique( array_merge(
$props,
array_keys( $repoGroup->getLocalRepo()->getInfo() )
) ) );
+
+ $propValues[] = 'canUpload';
+
+ return $propValues;
}
protected function getExamplesMessages() {
@@ -97,4 +109,8 @@ class ApiQueryFileRepoInfo extends ApiQueryBase {
=> 'apihelp-query+filerepoinfo-example-simple',
);
}
+
+ public function getHelpUrls() {
+ return 'https://www.mediawiki.org/wiki/API:Filerepoinfo';
+ }
}