Exemplo n.º 1
0
 public static function getPropertyNames($filter = array())
 {
     $prop = parent::getPropertyNames();
     $prop[] = 'derivatives';
     return $prop;
 }
Exemplo n.º 2
0
 public function getAllowedParams()
 {
     $ret = ['sort' => [ApiBase::PARAM_DFLT => 'name', ApiBase::PARAM_TYPE => ['name', 'timestamp']], 'dir' => [ApiBase::PARAM_DFLT => 'ascending', ApiBase::PARAM_TYPE => ['ascending', 'descending', 'newer', 'older']], 'from' => null, 'to' => null, 'continue' => [ApiBase::PARAM_HELP_MSG => 'api-help-param-continue'], 'start' => [ApiBase::PARAM_TYPE => 'timestamp'], 'end' => [ApiBase::PARAM_TYPE => 'timestamp'], 'prop' => [ApiBase::PARAM_TYPE => ApiQueryImageInfo::getPropertyNames($this->propertyFilter), ApiBase::PARAM_DFLT => 'timestamp|url', ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_HELP_MSG => 'apihelp-query+imageinfo-param-prop', ApiBase::PARAM_HELP_MSG_PER_VALUE => ApiQueryImageInfo::getPropertyMessages($this->propertyFilter)], 'prefix' => null, 'minsize' => [ApiBase::PARAM_TYPE => 'integer'], 'maxsize' => [ApiBase::PARAM_TYPE => 'integer'], 'sha1' => null, 'sha1base36' => null, 'user' => [ApiBase::PARAM_TYPE => 'user'], 'filterbots' => [ApiBase::PARAM_DFLT => 'all', ApiBase::PARAM_TYPE => ['all', 'bots', 'nobots']], 'mime' => [ApiBase::PARAM_ISMULTI => true], 'limit' => [ApiBase::PARAM_DFLT => 10, ApiBase::PARAM_TYPE => 'limit', ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2]];
     if ($this->getConfig()->get('MiserMode')) {
         $ret['mime'][ApiBase::PARAM_HELP_MSG] = 'api-help-param-disabled-in-miser-mode';
     }
     return $ret;
 }
 public function getAllowedParams()
 {
     return array('sort' => array(ApiBase::PARAM_DFLT => 'name', ApiBase::PARAM_TYPE => array('name', 'timestamp')), 'dir' => array(ApiBase::PARAM_DFLT => 'ascending', ApiBase::PARAM_TYPE => array('ascending', 'descending', 'newer', 'older')), 'from' => null, 'to' => null, 'continue' => null, 'start' => array(ApiBase::PARAM_TYPE => 'timestamp'), 'end' => array(ApiBase::PARAM_TYPE => 'timestamp'), 'prop' => array(ApiBase::PARAM_TYPE => ApiQueryImageInfo::getPropertyNames($this->propertyFilter), ApiBase::PARAM_DFLT => 'timestamp|url', ApiBase::PARAM_ISMULTI => true), 'prefix' => null, 'minsize' => array(ApiBase::PARAM_TYPE => 'integer'), 'maxsize' => array(ApiBase::PARAM_TYPE => 'integer'), 'sha1' => null, 'sha1base36' => null, 'user' => array(ApiBase::PARAM_TYPE => 'user'), 'filterbots' => array(ApiBase::PARAM_DFLT => 'all', ApiBase::PARAM_TYPE => array('all', 'bots', 'nobots')), 'mime' => null, 'limit' => array(ApiBase::PARAM_DFLT => 10, ApiBase::PARAM_TYPE => 'limit', ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2));
 }
Exemplo n.º 4
0
 /**
  * Gets image info about the file just uploaded.
  *
  * Also has the effect of setting metadata to be an 'indexed tag name' in returned API result if
  * 'metadata' was requested. Oddly, we have to pass the "result" object down just so it can do that
  * with the appropriate format, presumably.
  *
  * @param $result ApiResult:
  * @return Array: image info
  */
 public function getImageInfo($result)
 {
     $file = $this->getLocalFile();
     // TODO This cries out for refactoring. We really want to say $file->getAllInfo(); here.
     // Perhaps "info" methods should be moved into files, and the API should just wrap them in queries.
     if ($file instanceof UploadStashFile) {
         $imParam = ApiQueryStashImageInfo::getPropertyNames();
         $info = ApiQueryStashImageInfo::getInfo($file, array_flip($imParam), $result);
     } else {
         $imParam = ApiQueryImageInfo::getPropertyNames();
         $info = ApiQueryImageInfo::getInfo($file, array_flip($imParam), $result);
     }
     return $info;
 }
Exemplo n.º 5
0
 /**
  * Gets image info about the file just uploaded.
  *
  * Also has the effect of setting metadata to be an 'indexed tag name' in
  * returned API result if 'metadata' was requested. Oddly, we have to pass
  * the "result" object down just so it can do that with the appropriate
  * format, presumably.
  *
  * @param ApiResult $result
  * @return array Image info
  */
 public function getImageInfo($result)
 {
     $localFile = $this->getLocalFile();
     $stashFile = $this->getStashFile();
     // Calling a different API module depending on whether the file was stashed is less than optimal.
     // In fact, calling API modules here at all is less than optimal. Maybe it should be refactored.
     if ($stashFile) {
         $imParam = ApiQueryStashImageInfo::getPropertyNames();
         $info = ApiQueryStashImageInfo::getInfo($stashFile, array_flip($imParam), $result);
     } else {
         $imParam = ApiQueryImageInfo::getPropertyNames();
         $info = ApiQueryImageInfo::getInfo($localFile, array_flip($imParam), $result);
     }
     return $info;
 }
Exemplo n.º 6
0
 public function getAllowedParams()
 {
     return array('from' => null, 'prefix' => null, 'minsize' => array(ApiBase::PARAM_TYPE => 'integer'), 'maxsize' => array(ApiBase::PARAM_TYPE => 'integer'), 'limit' => array(ApiBase::PARAM_DFLT => 10, ApiBase::PARAM_TYPE => 'limit', ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2), 'dir' => array(ApiBase::PARAM_DFLT => 'ascending', ApiBase::PARAM_TYPE => array('ascending', 'descending')), 'sha1' => null, 'sha1base36' => null, 'prop' => array(ApiBase::PARAM_TYPE => ApiQueryImageInfo::getPropertyNames(), ApiBase::PARAM_DFLT => 'timestamp|url', ApiBase::PARAM_ISMULTI => true));
 }