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


PHP LocalRepo::getMasterDb方法代码示例

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


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

示例1: fetchFileMetadata

	/**
	 * Helper function: do the actual database query to fetch file metadata.
	 *
	 * @param string $key key
	 * @param $readFromDB: constant (default: DB_SLAVE)
	 * @return boolean
	 */
	protected function fetchFileMetadata( $key, $readFromDB = DB_SLAVE ) {
		// populate $fileMetadata[$key]
		$dbr = null;
		if ( $readFromDB === DB_MASTER ) {
			// sometimes reading from the master is necessary, if there's replication lag.
			$dbr = $this->repo->getMasterDb();
		} else {
			$dbr = $this->repo->getSlaveDb();
		}

		$row = $dbr->selectRow(
			'uploadstash',
			'*',
			array( 'us_key' => $key ),
			__METHOD__
		);

		if ( !is_object( $row ) ) {
			// key wasn't present in the database. this will happen sometimes.
			return false;
		}

		$this->fileMetadata[$key] = (array)$row;

		return true;
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:33,代码来源:UploadStash.php

示例2: getChunkStatus

 /**
  * Get the chunk db state and populate update relevant local values
  */
 private function getChunkStatus()
 {
     // get Master db to avoid race conditions.
     // Otherwise, if chunk upload time < replag there will be spurious errors
     $dbw = $this->repo->getMasterDb();
     $row = $dbw->selectRow('uploadstash', array('us_chunk_inx', 'us_size', 'us_path'), array('us_key' => $this->mFileKey), __METHOD__);
     // Handle result:
     if ($row) {
         $this->mChunkIndex = $row->us_chunk_inx;
         $this->mOffset = $row->us_size;
         $this->mVirtualTempPath = $row->us_path;
     }
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:16,代码来源:UploadFromChunks.php

示例3: removeFileNoAuth

 /**
  * Remove a file (see removeFile), but doesn't check ownership first.
  *
  * @return boolean: success
  */
 public function removeFileNoAuth($key)
 {
     wfDebug(__METHOD__ . " clearing row {$key}\n");
     $dbw = $this->repo->getMasterDb();
     // this gets its own transaction since it's called serially by the cleanupUploadStash maintenance script
     $dbw->begin();
     $dbw->delete('uploadstash', array('us_key' => $key), __METHOD__);
     $dbw->commit();
     // TODO: look into UnregisteredLocalFile and find out why the rv here is sometimes wrong (false when file was removed)
     // for now, ignore.
     $this->files[$key]->remove();
     unset($this->files[$key]);
     unset($this->fileMetadata[$key]);
     return true;
 }
开发者ID:natalieschauser,项目名称:csp_media_wiki,代码行数:20,代码来源:UploadStash.php


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