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


PHP ResourceStorage::hashFileIdentifier方法代码示例

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


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

示例1: getHashedIdentifier

	/**
	 * Get hashed identifier
	 *
	 * @return string
	 */
	public function getHashedIdentifier() {
		return $this->storage->hashFileIdentifier($this->identifier);
	}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例2: updateIdentifierHashesForStorage

 /**
  * Creates file identifier hashes for a single storage.
  *
  * @param ResourceStorage $storage The storage to update
  * @return array The executed database queries
  */
 protected function updateIdentifierHashesForStorage(ResourceStorage $storage)
 {
     $queries = array();
     if (!ExtensionManagementUtility::isLoaded('dbal')) {
         // if DBAL is not loaded, we're using MySQL and can thus use their
         // SHA1() function
         if ($storage->usesCaseSensitiveIdentifiers()) {
             $updateCall = 'SHA1(identifier)';
         } else {
             $updateCall = 'SHA1(LOWER(identifier))';
         }
         $queries[] = $query = sprintf('UPDATE sys_file SET identifier_hash = %s WHERE storage=%d', $updateCall, $storage->getUid());
         $this->db->sql_query($query);
         // folder hashes cannot be done with one call: so do it manually
         $files = $this->db->exec_SELECTgetRows('uid, storage, identifier', 'sys_file', sprintf('storage=%d AND folder_hash=""', $storage->getUid()));
         foreach ($files as $file) {
             $folderHash = $storage->hashFileIdentifier($storage->getFolderIdentifierFromFileIdentifier($file['identifier']));
             $queries[] = $query = $this->db->UPDATEquery('sys_file', 'uid=' . $file['uid'], array('folder_hash' => $folderHash));
             $this->db->sql_query($query);
         }
     } else {
         // manually hash the identifiers when using DBAL
         $files = $this->db->exec_SELECTgetRows('uid, storage, identifier', 'sys_file', sprintf('storage=%d AND identifier_hash=""', $storage->getUid()));
         foreach ($files as $file) {
             $hash = $storage->hashFileIdentifier($file['identifier']);
             $folderHash = $storage->hashFileIdentifier($storage->getFolderIdentifierFromFileIdentifier($file['identifier']));
             $queries[] = $query = $this->db->UPDATEquery('sys_file', 'uid=' . $file['uid'], array('identifier_hash' => $hash, 'folder_hash' => $folderHash));
             $this->db->sql_query($query);
         }
     }
     return $queries;
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:38,代码来源:FileIdentifierHashUpdate.php


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