本文整理汇总了PHP中TYPO3\CMS\Core\Resource\ResourceStorage::usesCaseSensitiveIdentifiers方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceStorage::usesCaseSensitiveIdentifiers方法的具体用法?PHP ResourceStorage::usesCaseSensitiveIdentifiers怎么用?PHP ResourceStorage::usesCaseSensitiveIdentifiers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Resource\ResourceStorage
的用法示例。
在下文中一共展示了ResourceStorage::usesCaseSensitiveIdentifiers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}