本文整理汇总了PHP中LocalFile::getSha1方法的典型用法代码示例。如果您正苦于以下问题:PHP LocalFile::getSha1方法的具体用法?PHP LocalFile::getSha1怎么用?PHP LocalFile::getSha1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalFile
的用法示例。
在下文中一共展示了LocalFile::getSha1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHashes
/**
* @return array
*/
protected function getHashes()
{
$hashes = array();
list($oldRels, $deleteCurrent) = $this->getOldRels();
if ($deleteCurrent) {
$hashes['.'] = $this->file->getSha1();
}
if (count($oldRels)) {
$dbw = $this->file->repo->getMasterDB();
$res = $dbw->select('oldimage', array('oi_archive_name', 'oi_sha1'), array('oi_archive_name' => array_keys($oldRels)), __METHOD__);
foreach ($res as $row) {
if (rtrim($row->oi_sha1, "") === '') {
// Get the hash from the file
$oldUrl = $this->file->getArchiveVirtualUrl($row->oi_archive_name);
$props = $this->file->repo->getFileProps($oldUrl);
if ($props['fileExists']) {
// Upgrade the oldimage row
$dbw->update('oldimage', array('oi_sha1' => $props['sha1']), array('oi_name' => $this->file->getName(), 'oi_archive_name' => $row->oi_archive_name), __METHOD__);
$hashes[$row->oi_archive_name] = $props['sha1'];
} else {
$hashes[$row->oi_archive_name] = false;
}
} else {
$hashes[$row->oi_archive_name] = $row->oi_sha1;
}
}
}
$missing = array_diff_key($this->srcRels, $hashes);
foreach ($missing as $name => $rel) {
$this->status->error('filedelete-old-unregistered', $name);
}
foreach ($hashes as $name => $hash) {
if (!$hash) {
$this->status->error('filedelete-missing', $this->srcRels[$name]);
unset($hashes[$name]);
}
}
return $hashes;
}