本文整理匯總了PHP中DirectoryIterator::getLinkTarget方法的典型用法代碼示例。如果您正苦於以下問題:PHP DirectoryIterator::getLinkTarget方法的具體用法?PHP DirectoryIterator::getLinkTarget怎麽用?PHP DirectoryIterator::getLinkTarget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DirectoryIterator
的用法示例。
在下文中一共展示了DirectoryIterator::getLinkTarget方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _processFile
/**
* Process file
*
* @param int $directoryID
* @param DirectoryIterator $entries
*/
protected final function _processFile($directoryID, DirectoryIterator $entries)
{
$scanID = $this->_scanRow->scanID;
// Load row when exists
$fileRow = $this->_fileTable->fetchRow(array('directoryID' => $directoryID, 'name' => $entries->getFilename()));
// Already scanned
if ($fileRow && $fileRow->lastScanID == $scanID) {
return;
}
$pathname = $entries->getPathname();
// Data
$data = array('modifyDate' => $this->_normalizeDate($entries->getMTime()), 'owner' => $this->_normalizeUser($entries->getOwner()), 'group' => $this->_normalizeGroup($entries->getGroup()), 'permissions' => $entries->getPerms(), 'size' => $entries->getSize(), 'linkTarget' => $entries->isLink() ? $entries->getLinkTarget() : null);
// Content
$contentHash = null;
if (!$entries->isLink() && ($this->_alwaysCheckContent || !$fileRow || $fileRow->modifyDate != $data['modifyDate'] || $fileRow->size != $data['size'])) {
// Non-accessible file
if (!is_readable($pathname)) {
$this->_log(self::LOG_ERROR, "\t{$pathname} cannot be read.");
if ($fileRow) {
$contentHash = $fileRow->contentHash;
}
} else {
$contentHash = md5_file($pathname);
}
}
// Transaction
$this->_db->beginTransaction();
// New row
if ($newRow = !$fileRow) {
fwrite(STDOUT, "\t{$pathname} is new.\n");
$fileRow = $this->_createFileRow(array('directoryID' => $directoryID, 'name' => $entries->getFilename()) + $data);
}
// Store values
$oldValues = $fileRow->toArray();
// Content
if ($fileRow->contentHash != $contentHash) {
$data['contentHash'] = $contentHash;
if ($this->_storagePath) {
$data['storedAs'] = $this->_copyFile($fileRow->fileID, $entries);
}
}
// Update row
$this->_updateFileRow($pathname, $fileRow, $data);
$fileRow->lastScanID = $scanID;
$fileRow->save();
// Scan row update
$this->_scanRow->lastOperationDate = new SeekR_Expression('NOW()');
$this->_scanRow->save();
// Transaction
$this->_db->commit();
}