* - zones Associative array of zone names that each map to an array with:
* container : backend container name the zone is in
* directory : root path within container for the zone
- * Zones default to using <repo name>-<zone> as the
- * container name and the container root as the zone directory.
- * - url Base public URL
+ * url : base URL to the root of the zone
+ * Zones default to using <repo name>-<zone name> as the container name
+ * and default to using the container root as the zone's root directory.
+ * Nesting of zone locations within other zones should be avoided.
+ * - url Public zone URL. The 'zones' settings take precedence.
* - hashLevels The number of directory levels for hash-based division of files
* - thumbScriptUrl The URL for thumb.php (optional, not recommended)
* - transformVia404 Whether to skip media file transformation on parse and rely on a 404
* @param $info array|null
* @throws MWException
*/
- function __construct( array $info = null ) {
+ public function __construct( array $info = null ) {
// Verify required settings presence
if(
$info === null
: array();
// Give defaults for the basic zones...
foreach ( array( 'public', 'thumb', 'temp', 'deleted' ) as $zone ) {
- if ( !isset( $this->zones[$zone] ) ) {
- $this->zones[$zone] = array(
- 'container' => "{$this->name}-{$zone}",
- 'directory' => '' // container root
- );
+ if ( !isset( $this->zones[$zone]['container'] ) ) {
+ $this->zones[$zone]['container'] = "{$this->name}-{$zone}";
+ }
+ if ( !isset( $this->zones[$zone]['directory'] ) ) {
+ $this->zones[$zone]['directory'] = '';
}
}
}
* @return String or false
*/
public function getZoneUrl( $zone ) {
+ if ( isset( $this->zones[$zone]['url'] )
+ && in_array( $zone, array( 'public', 'temp', 'thumb' ) ) )
+ {
+ return $this->zones[$zone]['url']; // custom URL
+ }
switch ( $zone ) {
case 'public':
return $this->url;
/**
* Get the public root URL of the repository
*
+ * @deprecated since 1.20
* @return string
*/
public function getRootUrl() {
- return $this->url;
+ return $this->getZoneUrl( 'public' );
}
/**