本文整理匯總了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;
}