예제 #1
0
 function __construct($info)
 {
     parent::__construct($info);
     global $wgUploadDirectory;
     // http://commons.wikimedia.org/w/api.php
     $this->mApiBase = isset($info['apibase']) ? $info['apibase'] : null;
     $this->directory = isset($info['directory']) ? $info['directory'] : $wgUploadDirectory;
     if (isset($info['apiThumbCacheExpiry'])) {
         $this->apiThumbCacheExpiry = $info['apiThumbCacheExpiry'];
     }
     if (isset($info['fileCacheExpiry'])) {
         $this->fileCacheExpiry = $info['fileCacheExpiry'];
     }
     if (!$this->scriptDirUrl) {
         // hack for description fetches
         $this->scriptDirUrl = dirname($this->mApiBase);
     }
     // If we can cache thumbs we can guess sane defaults for these
     if ($this->canCacheThumbs() && !$this->url) {
         global $wgLocalFileRepo;
         $this->url = $wgLocalFileRepo['url'];
     }
     if ($this->canCacheThumbs() && !$this->thumbUrl) {
         $this->thumbUrl = $this->url . '/thumb';
     }
     if (isset($info['thumbDir'])) {
         $this->thumbDir = $info['thumbDir'];
     } else {
         $this->thumbDir = "{$this->directory}/thumb";
     }
 }
예제 #2
0
 function __construct($info)
 {
     parent::__construct($info);
     // Required settings
     $this->directory = isset($info['directory']) ? $info['directory'] : "http://s3.amazonaws.com/" . $info['wgUploadS3Bucket'] . "/" . $info['wgUploadDirectory'];
     $this->AWS_ACCESS_KEY = $info['AWS_ACCESS_KEY'];
     $this->AWS_SECRET_KEY = $info['AWS_SECRET_KEY'];
     $this->AWS_S3_BUCKET = $info['AWS_S3_BUCKET'];
     $this->cloudFrontUrl = $info['cloudFrontUrl'];
     $this->cloudFrontDirectory = $this->cloudFrontUrl . ($this->directory ? $this->directory : $info['wgUploadDirectory']);
     $this->AWS_S3_SSL = isset($info['AWS_S3_SSL']) ? $info['AWS_S3_SSL'] : true;
     // Optional settings
     $this->AWS_S3_PUBLIC = isset($info['AWS_S3_PUBLIC']) ? $info['AWS_S3_PUBLIC'] : false;
     $this->url = isset($info['url']) ? $info['url'] : ($this->AWS_S3_SSL ? "https://" : "http://") . "s3.amazonaws.com/" . $this->AWS_S3_BUCKET . "/" . $this->directory;
     $this->hashLevels = isset($info['hashLevels']) ? $info['hashLevels'] : 2;
     $this->deletedHashLevels = isset($info['deletedHashLevels']) ? $info['deletedHashLevels'] : $this->hashLevels;
     $this->deletedDir = isset($info['deletedDir']) ? $info['deletedDir'] : false;
     $this->fileMode = isset($info['fileMode']) ? $info['fileMode'] : 0644;
     if (isset($info['thumbDir'])) {
         $this->thumbDir = $info['thumbDir'];
     } else {
         $this->thumbDir = "{$this->directory}/thumb";
     }
     if (isset($info['thumbUrl'])) {
         $this->thumbUrl = $info['thumbUrl'];
     } else {
         $this->thumbUrl = "{$this->url}/thumb";
     }
     $this->urlbase = $info['urlbase'];
 }
예제 #3
0
 function __construct(array $info = null)
 {
     parent::__construct($info);
     $this->hasSha1Storage = isset($info['storageLayout']) && $info['storageLayout'] === 'sha1';
     if ($this->hasSha1Storage()) {
         $this->backend = new FileBackendDBRepoWrapper(array('backend' => $this->backend, 'repoName' => $this->name, 'dbHandleFactory' => $this->getDBFactory()));
     }
 }
예제 #4
0
 function __construct($info)
 {
     parent::__construct($info);
     $this->mApiBase = $info['apibase'];
     // http://commons.wikimedia.org/w/api.php
     if (!$this->scriptDirUrl) {
         // hack for description fetches
         $this->scriptDirUrl = dirname($this->mApiBase);
     }
 }
예제 #5
0
 function __construct($info)
 {
     parent::__construct($info);
     // Required settings
     $this->directory = $info['directory'];
     $this->url = $info['url'];
     // Optional settings
     $this->hashLevels = isset($info['hashLevels']) ? $info['hashLevels'] : 2;
     $this->deletedHashLevels = isset($info['deletedHashLevels']) ? $info['deletedHashLevels'] : $this->hashLevels;
     $this->deletedDir = isset($info['deletedDir']) ? $info['deletedDir'] : false;
 }
예제 #6
0
 /**
  * @param $info array
  * @throws MWException
  */
 function __construct(array $info)
 {
     if (!isset($info['backend'])) {
         // B/C settings...
         $directory = $info['directory'];
         $deletedDir = isset($info['deletedDir']) ? $info['deletedDir'] : false;
         $thumbDir = isset($info['thumbDir']) ? $info['thumbDir'] : "{$directory}/thumb";
         $fileMode = isset($info['fileMode']) ? $info['fileMode'] : 0644;
         $repoName = $info['name'];
         // Get the FS backend configuration
         $backend = new FSFileBackend(array('name' => $info['name'] . '-backend', 'lockManager' => 'fsLockManager', 'containerPaths' => array("{$repoName}-public" => "{$directory}", "{$repoName}-temp" => "{$directory}/temp", "{$repoName}-thumb" => $thumbDir, "{$repoName}-deleted" => $deletedDir), 'fileMode' => $fileMode));
         // Update repo config to use this backend
         $info['backend'] = $backend;
     }
     parent::__construct($info);
     if (!$this->backend instanceof FSFileBackend) {
         throw new MWException("FSRepo only supports FSFileBackend.");
     }
 }
예제 #7
0
 function __construct($info)
 {
     parent::__construct($info);
     $this->mApiBase = $info['apibase'];
     // http://commons.wikimedia.org/w/api.php
     if (isset($info['apiThumbCacheExpiry'])) {
         $this->apiThumbCacheExpiry = $info['apiThumbCacheExpiry'];
     }
     if (!$this->scriptDirUrl) {
         // hack for description fetches
         $this->scriptDirUrl = dirname($this->mApiBase);
     }
     // If we can cache thumbs we can guess sane defaults for these
     if ($this->canCacheThumbs() && !$this->url) {
         global $wgLocalFileRepo;
         $this->url = $wgLocalFileRepo['url'];
     }
     if ($this->canCacheThumbs() && !$this->thumbUrl) {
         $this->thumbUrl = $this->url . '/thumb';
     }
 }
예제 #8
0
 function __construct($info)
 {
     parent::__construct($info);
     // Required settings
     $this->directory = $info['directory'];
     $this->url = $info['url'];
     // Optional settings
     $this->hashLevels = isset($info['hashLevels']) ? $info['hashLevels'] : 2;
     $this->deletedHashLevels = isset($info['deletedHashLevels']) ? $info['deletedHashLevels'] : $this->hashLevels;
     $this->deletedDir = isset($info['deletedDir']) ? $info['deletedDir'] : false;
     $this->fileMode = isset($info['fileMode']) ? $info['fileMode'] : 0644;
     if (isset($info['thumbDir'])) {
         $this->thumbDir = $info['thumbDir'];
     } else {
         $this->thumbDir = "{$this->directory}/thumb";
     }
     if (isset($info['thumbUrl'])) {
         $this->thumbUrl = $info['thumbUrl'];
     } else {
         $this->thumbUrl = "{$this->url}/thumb";
     }
 }
	function __construct( $info ) {
		// We don't call parent::_construct because it requires $this->directory,
		// which doesn't exist in Swift.
		FileRepo::__construct( $info );

		// Required settings
		$this->url = $info['url'];

		// Optional settings
		$this->hashLevels = isset( $info['hashLevels'] ) ? $info['hashLevels'] : 2;
		$this->deletedHashLevels = isset( $info['deletedHashLevels'] ) ?
			$info['deletedHashLevels'] : $this->hashLevels;

		// This relationship is also hard-coded in rewrite.py, another part of this
		// extension. If you want to change this here, you might have to change it
		// there, too.
		$this->thumbUrl = "{$this->url}/thumb";

		// we don't have directories
		$this->deletedDir = false;

		// Required settings
		$this->swiftuser = $info['user'];
		$this->swiftkey = $info['key'];
		$this->authurl = $info['authurl'];
		$this->container = $info['container'];
	}