[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/filerepo/ -> ForeignAPIRepo.php (summary)

Foreign repository accessible through api.php requests. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 591 lines (16 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

ForeignAPIRepo:: (21 methods):
  __construct()
  getApiUrl()
  newFile()
  fileExistsBatch()
  getFileProps()
  fetchImageQuery()
  getImageInfo()
  findBySha1()
  getThumbUrl()
  getThumbError()
  getThumbUrlFromCache()
  getZoneUrl()
  getZonePath()
  canCacheThumbs()
  getUserAgent()
  getInfo()
  httpGet()
  getIIProps()
  httpGetCached()
  enumFiles()
  assertWritableRepo()


Class: ForeignAPIRepo  - X-Ref

A foreign repository with a remote MediaWiki with an API thingy

Example config:

$wgForeignFileRepos[] = array(
'class'                  => 'ForeignAPIRepo',
'name'                   => 'shared',
'apibase'                => 'http://en.wikipedia.org/w/api.php',
'fetchDescription'       => true, // Optional
'descriptionCacheExpiry' => 3600,
);

__construct( $info )   X-Ref

param: array|null $info

getApiUrl()   X-Ref

return: string

newFile( $title, $time = false )   X-Ref
Per docs in FileRepo, this needs to return false if we don't support versioned
files. Well, we don't.

param: Title $title
param: string|bool $time
return: File

fileExistsBatch( array $files )   X-Ref

param: array $files
return: array

getFileProps( $virtualUrl )   X-Ref

param: string $virtualUrl
return: bool

fetchImageQuery( $query )   X-Ref

param: array $query
return: string

getImageInfo( $data )   X-Ref

param: array $data
return: bool|array

findBySha1( $hash )   X-Ref

param: string $hash
return: array

getThumbUrl( $name, $width = -1, $height = -1, &$result = null, $otherParams = '' )   X-Ref

param: string $name
param: int $width
param: int $height
param: array $result Out parameter that will be changed by the function.
param: string $otherParams
return: bool

getThumbError( $name, $width = -1, $height = -1, $otherParams = '', $lang = null )   X-Ref

param: string $name
param: int $width
param: int $height
param: string $otherParams
param: string $lang Language code for language of error
return: bool|MediaTransformError

getThumbUrlFromCache( $name, $width, $height, $params = "" )   X-Ref
Return the imageurl from cache if possible

If the url has been requested today, get it from cache
Otherwise retrieve remote thumb url, check for local file.

param: string $name Is a dbkey form of a title
param: int $width
param: int $height
param: string $params Other rendering parameters (page number, etc)
return: bool|string

getZoneUrl( $zone, $ext = null )   X-Ref

param: string $zone
param: string|null $ext Optional file extension
return: string

getZonePath( $zone )   X-Ref
Get the local directory corresponding to one of the basic zones

param: string $zone
return: bool|null|string

canCacheThumbs()   X-Ref
Are we locally caching the thumbnails?

return: bool

getUserAgent()   X-Ref
The user agent the ForeignAPIRepo will use.

return: string

getInfo()   X-Ref
Get information about the repo - overrides/extends the parent
class's information.

return: array

httpGet( $url, $timeout = 'default', $options = array()   X-Ref
Like a Http:get request, but with custom User-Agent.

param: string $url
param: string $timeout
param: array $options
return: bool|string

getIIProps()   X-Ref

return: string

httpGetCached( $target, $query, $cacheTTL = 3600 )   X-Ref
HTTP GET request to a mediawiki API (with caching)

param: string $target Used in cache key creation, mostly
param: array $query The query parameters for the API request
param: int $cacheTTL Time to live for the memcached caching
return: null

enumFiles( $callback )   X-Ref

param: callable $callback

assertWritableRepo()   X-Ref




Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1