当前位置: 首页>>代码示例>>PHP>>正文


PHP FileBackend::__construct方法代码示例

本文整理汇总了PHP中FileBackend::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP FileBackend::__construct方法的具体用法?PHP FileBackend::__construct怎么用?PHP FileBackend::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileBackend的用法示例。


在下文中一共展示了FileBackend::__construct方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Construct a proxy backend that consists of several internal backends.
  * Additional $config params include:
  *     'backends'    : Array of backend config and multi-backend settings.
  *                     Each value is the config used in the constructor of a
  *                     FileBackendStore class, but with these additional settings:
  *                         'class'         : The name of the backend class
  *                         'isMultiMaster' : This must be set for one backend.
  *     'syncChecks'  : Integer bitfield of internal backend sync checks to perform.
  *                     Possible bits include self::CHECK_SIZE and self::CHECK_TIME.
  *                     The checks are done before allowing any file operations.
  * @param $config Array
  */
 public function __construct(array $config)
 {
     parent::__construct($config);
     $namesUsed = array();
     // Construct backends here rather than via registration
     // to keep these backends hidden from outside the proxy.
     foreach ($config['backends'] as $index => $config) {
         $name = $config['name'];
         if (isset($namesUsed[$name])) {
             // don't break FileOp predicates
             throw new MWException("Two or more backends defined with the name {$name}.");
         }
         $namesUsed[$name] = 1;
         if (!isset($config['class'])) {
             throw new MWException('No class given for a backend config.');
         }
         $class = $config['class'];
         $this->backends[$index] = new $class($config);
         if (!empty($config['isMultiMaster'])) {
             if ($this->masterIndex >= 0) {
                 throw new MWException('More than one master backend defined.');
             }
             $this->masterIndex = $index;
         }
     }
     if ($this->masterIndex < 0) {
         // need backends and must have a master
         throw new MWException('No master backend defined.');
     }
     $this->syncChecks = isset($config['syncChecks']) ? $config['syncChecks'] : self::CHECK_SIZE;
 }
开发者ID:amjadtbssm,项目名称:spring-website,代码行数:44,代码来源:FileBackendMultiWrite.php

示例2: __construct

 /**
  * @see FileBackend::__construct()
  *
  * @param $config Array
  */
 public function __construct(array $config)
 {
     parent::__construct($config);
     $this->memCache = new EmptyBagOStuff();
     // disabled by default
     $this->cheapCache = new ProcessCacheLRU(300);
     $this->expensiveCache = new ProcessCacheLRU(5);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:13,代码来源:FileBackendStore.php

示例3: __construct

 /**
  * @see FileBackend::__construct()
  *
  * @param $config Array
  */
 public function __construct(array $config)
 {
     parent::__construct($config);
     $this->memCache = new EmptyBagOStuff();
     // disabled by default
     $this->cheapCache = new ProcessCacheLRU(self::CACHE_CHEAP_SIZE);
     $this->expensiveCache = new ProcessCacheLRU(self::CACHE_EXPENSIVE_SIZE);
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:13,代码来源:FileBackendStore.php

示例4: __construct

 /**
  * @see FileBackend::__construct()
  * Additional $config params include:
  *   - wanCache     : WANObjectCache object to use for persistent caching.
  *   - mimeCallback : Callback that takes (storage path, content, file system path) and
  *                    returns the MIME type of the file or 'unknown/unknown'. The file
  *                    system path parameter should be used if the content one is null.
  *
  * @param array $config
  */
 public function __construct(array $config)
 {
     parent::__construct($config);
     $this->mimeCallback = isset($config['mimeCallback']) ? $config['mimeCallback'] : null;
     $this->memCache = WANObjectCache::newEmpty();
     // disabled by default
     $this->cheapCache = new ProcessCacheLRU(self::CACHE_CHEAP_SIZE);
     $this->expensiveCache = new ProcessCacheLRU(self::CACHE_EXPENSIVE_SIZE);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:19,代码来源:FileBackendStore.php

示例5: __construct

 public function __construct(array $config)
 {
     $config['name'] = $config['backend']->getName();
     $config['wikiId'] = $config['backend']->getWikiId();
     parent::__construct($config);
     $this->backend = $config['backend'];
     $this->repoName = $config['repoName'];
     $this->dbHandleFunc = $config['dbHandleFactory'];
     $this->resolvedPathCache = new ProcessCacheLRU(100);
 }
开发者ID:nanasess,项目名称:mediawiki,代码行数:10,代码来源:FileBackendDBRepoWrapper.php

示例6: __construct

	/**
	 * @see FileBackend::__construct()
	 * Additional $config params include:
	 *    azureHost      : Windows Azure server URL
	 *    azureAccount   : Windows Azure user used by MediaWiki
	 *    azureKey       : Authentication key for the above user (used to get sessions)
	 *    //azureContainer : Identifier of the container. (Optional. If not provided wikiId will be used as container name)
     *    containerPaths : Map of container names to Azure container names
	 */
	public function __construct( array $config ) {
		parent::__construct( $config );
		$this->storageClient = new Microsoft_WindowsAzure_Storage_Blob(
				$config['azureHost'],
				$config['azureAccount'],
				$config['azureKey']
		);

		$this->containerPaths = (array)$config['containerPaths'];
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:19,代码来源:WindowsAzureFileBackend.php

示例7: __construct

 /**
  * @see FileBackend::__construct()
  * Additional $config params include:
  *   - wanCache     : WANOBjectCache object to use for persistent caching.
  *   - mimeCallback : Callback that takes (storage path, content, file system path) and
  *                    returns the MIME type of the file or 'unknown/unknown'. The file
  *                    system path parameter should be used if the content one is null.
  *
  * @param array $config
  */
 public function __construct(array $config)
 {
     parent::__construct($config);
     $this->mimeCallback = isset($config['mimeCallback']) ? $config['mimeCallback'] : function ($storagePath, $content, $fsPath) {
         // @todo handle the case of extension-less files using the contents
         return StreamFile::contentTypeFromPath($storagePath) ?: 'unknown/unknown';
     };
     $this->memCache = WANObjectCache::newEmpty();
     // disabled by default
     $this->cheapCache = new ProcessCacheLRU(self::CACHE_CHEAP_SIZE);
     $this->expensiveCache = new ProcessCacheLRU(self::CACHE_EXPENSIVE_SIZE);
 }
开发者ID:GoProjectOwner,项目名称:mediawiki,代码行数:22,代码来源:FileBackendStore.php

示例8: __construct

	/**
	 * Construct a proxy backend that consists of several internal backends.
	 * Locking, journaling, and read-only checks are handled by the proxy backend.
	 *
	 * Additional $config params include:
	 *   - backends       : Array of backend config and multi-backend settings.
	 *                      Each value is the config used in the constructor of a
	 *                      FileBackendStore class, but with these additional settings:
	 *                        - class         : The name of the backend class
	 *                        - isMultiMaster : This must be set for one backend.
	 *                        - template:     : If given a backend name, this will use
	 *                                          the config of that backend as a template.
	 *                                          Values specified here take precedence.
	 *   - syncChecks     : Integer bitfield of internal backend sync checks to perform.
	 *                      Possible bits include the FileBackendMultiWrite::CHECK_* constants.
	 *                      There are constants for SIZE, TIME, and SHA1.
	 *                      The checks are done before allowing any file operations.
	 *   - autoResync     : Automatically resync the clone backends to the master backend
	 *                      when pre-operation sync checks fail. This should only be used
	 *                      if the master backend is stable and not missing any files.
	 *                      Use "conservative" to limit resyncing to copying newer master
	 *                      backend files over older (or non-existing) clone backend files.
	 *                      Cases that cannot be handled will result in operation abortion.
	 *   - noPushQuickOps : (hack) Only apply doQuickOperations() to the master backend.
	 *   - noPushDirConts : (hack) Only apply directory functions to the master backend.
	 *
	 * @param Array $config
	 * @throws MWException
	 */
	public function __construct( array $config ) {
		parent::__construct( $config );
		$this->syncChecks = isset( $config['syncChecks'] )
			? $config['syncChecks']
			: self::CHECK_SIZE;
		$this->autoResync = isset( $config['autoResync'] )
			? $config['autoResync']
			: false;
		$this->noPushQuickOps = isset( $config['noPushQuickOps'] )
			? $config['noPushQuickOps']
			: false;
		$this->noPushDirConts = isset( $config['noPushDirConts'] )
			? $config['noPushDirConts']
			: array();
		// Construct backends here rather than via registration
		// to keep these backends hidden from outside the proxy.
		$namesUsed = array();
		foreach ( $config['backends'] as $index => $config ) {
			if ( isset( $config['template'] ) ) {
				// Config is just a modified version of a registered backend's.
				// This should only be used when that config is used only by this backend.
				$config = $config + FileBackendGroup::singleton()->config( $config['template'] );
			}
			$name = $config['name'];
			if ( isset( $namesUsed[$name] ) ) { // don't break FileOp predicates
				throw new MWException( "Two or more backends defined with the name $name." );
			}
			$namesUsed[$name] = 1;
			// Alter certain sub-backend settings for sanity
			unset( $config['readOnly'] ); // use proxy backend setting
			unset( $config['fileJournal'] ); // use proxy backend journal
			$config['wikiId'] = $this->wikiId; // use the proxy backend wiki ID
			$config['lockManager'] = 'nullLockManager'; // lock under proxy backend
			if ( !empty( $config['isMultiMaster'] ) ) {
				if ( $this->masterIndex >= 0 ) {
					throw new MWException( 'More than one master backend defined.' );
				}
				$this->masterIndex = $index; // this is the "master"
				$config['fileJournal'] = $this->fileJournal; // log under proxy backend
			}
			// Create sub-backend object
			if ( !isset( $config['class'] ) ) {
				throw new MWException( 'No class given for a backend config.' );
			}
			$class = $config['class'];
			$this->backends[$index] = new $class( $config );
		}
		if ( $this->masterIndex < 0 ) { // need backends and must have a master
			throw new MWException( 'No master backend defined.' );
		}
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:80,代码来源:FileBackendMultiWrite.php

示例9: __construct

 /**
  * Construct a proxy backend that consists of several internal backends.
  * Locking, journaling, and read-only checks are handled by the proxy backend.
  *
  * Additional $config params include:
  *   - backends       : Array of backend config and multi-backend settings.
  *                      Each value is the config used in the constructor of a
  *                      FileBackendStore class, but with these additional settings:
  *                        - class         : The name of the backend class
  *                        - isMultiMaster : This must be set for one backend.
  *                        - readAffinity  : Use this for reads without 'latest' set.
  *   - syncChecks     : Integer bitfield of internal backend sync checks to perform.
  *                      Possible bits include the FileBackendMultiWrite::CHECK_* constants.
  *                      There are constants for SIZE, TIME, and SHA1.
  *                      The checks are done before allowing any file operations.
  *   - autoResync     : Automatically resync the clone backends to the master backend
  *                      when pre-operation sync checks fail. This should only be used
  *                      if the master backend is stable and not missing any files.
  *                      Use "conservative" to limit resyncing to copying newer master
  *                      backend files over older (or non-existing) clone backend files.
  *                      Cases that cannot be handled will result in operation abortion.
  *   - replication    : Set to 'async' to defer file operations on the non-master backends.
  *                      This will apply such updates post-send for web requests. Note that
  *                      any checks from "syncChecks" are still synchronous.
  *
  * @param array $config
  * @throws FileBackendError
  */
 public function __construct(array $config)
 {
     parent::__construct($config);
     $this->syncChecks = isset($config['syncChecks']) ? $config['syncChecks'] : self::CHECK_SIZE;
     $this->autoResync = isset($config['autoResync']) ? $config['autoResync'] : false;
     $this->asyncWrites = isset($config['replication']) && $config['replication'] === 'async';
     // Construct backends here rather than via registration
     // to keep these backends hidden from outside the proxy.
     $namesUsed = [];
     foreach ($config['backends'] as $index => $config) {
         $name = $config['name'];
         if (isset($namesUsed[$name])) {
             // don't break FileOp predicates
             throw new LogicException("Two or more backends defined with the name {$name}.");
         }
         $namesUsed[$name] = 1;
         // Alter certain sub-backend settings for sanity
         unset($config['readOnly']);
         // use proxy backend setting
         unset($config['fileJournal']);
         // use proxy backend journal
         unset($config['lockManager']);
         // lock under proxy backend
         $config['domainId'] = $this->domainId;
         // use the proxy backend wiki ID
         if (!empty($config['isMultiMaster'])) {
             if ($this->masterIndex >= 0) {
                 throw new LogicException('More than one master backend defined.');
             }
             $this->masterIndex = $index;
             // this is the "master"
             $config['fileJournal'] = $this->fileJournal;
             // log under proxy backend
         }
         if (!empty($config['readAffinity'])) {
             $this->readIndex = $index;
             // prefer this for reads
         }
         // Create sub-backend object
         if (!isset($config['class'])) {
             throw new InvalidArgumentException('No class given for a backend config.');
         }
         $class = $config['class'];
         $this->backends[$index] = new $class($config);
     }
     if ($this->masterIndex < 0) {
         // need backends and must have a master
         throw new LogicException('No master backend defined.');
     }
     if ($this->readIndex < 0) {
         $this->readIndex = $this->masterIndex;
         // default
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:82,代码来源:FileBackendMultiWrite.php


注:本文中的FileBackend::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。