Esempio n. 1
0
 /**
  * @see FileBackendStore::__construct()
  * Additional $config params include:
  *    swiftAuthUrl       : Swift authentication server URL
  *    swiftUser          : Swift user used by MediaWiki (account:username)
  *    swiftKey           : Swift authentication key for the above user
  *    swiftAuthTTL       : Swift authentication TTL (seconds)
  *    swiftAnonUser      : Swift user used for end-user requests (account:username)
  *    shardViaHashLevels : Map of container names to sharding config with:
  *                         'base'   : base of hash characters, 16 or 36
  *                         'levels' : the number of hash levels (and digits)
  *                         'repeat' : hash subdirectories are prefixed with all the
  *                                    parent hash directory names (e.g. "a/ab/abc")
  *	  swiftTimeout       : number of seconds timeout consistent with php-cloudfiles. Default: 10
  */
 public function __construct(array $config)
 {
     parent::__construct($config);
     // Required settings
     $this->auth = new CF_Authentication($config['swiftUser'], $config['swiftKey'], null, $config['swiftAuthUrl']);
     /* <Wikia> */
     if (!empty($config['debug'])) {
         $this->auth->setDebug($config['debug']);
     }
     $this->swiftTimeout = isset($config['swiftTimeout']) ? intval($config['swiftTimeout']) : 10;
     /* </Wikia> */
     // Optional settings
     $this->authTTL = isset($config['swiftAuthTTL']) ? $config['swiftAuthTTL'] : 120;
     // some sane number
     $this->swiftAnonUser = isset($config['swiftAnonUser']) ? $config['swiftAnonUser'] : '';
     $this->shardViaHashLevels = isset($config['shardViaHashLevels']) ? $config['shardViaHashLevels'] : '';
     /* <Wikia> */
     // caching credentials
     if (!empty($config['cacheAuthInfo']) && $config['cacheAuthInfo'] === true) {
         $this->srvCache = wfGetMainCache();
     }
     $this->srvCache = $this->srvCache ? $this->srvCache : new EmptyBagOStuff();
     /* </Wikia> */
 }