本文整理汇总了PHP中TYPO3\CMS\Core\Resource\Folder::hasFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::hasFile方法的具体用法?PHP Folder::hasFile怎么用?PHP Folder::hasFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Resource\Folder
的用法示例。
在下文中一共展示了Folder::hasFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRelations
/**
* At the end of the import process all file and DB relations should be set properly (that is relations
* to imported records are all re-created so imported records are correctly related again)
* Relations in flexform fields are processed in setFlexFormRelations() after this function
*
* @return void
* @see setFlexFormRelations()
*/
public function setRelations()
{
$updateData = array();
// import_newId contains a register of all records that was in the import memorys "records" key
foreach ($this->import_newId as $nId => $dat) {
$table = $dat['table'];
$uid = $dat['uid'];
// original UID - NOT the new one!
// If the record has been written and received a new id, then proceed:
if (is_array($this->import_mapId[$table]) && isset($this->import_mapId[$table][$uid])) {
$thisNewUid = BackendUtility::wsMapId($table, $this->import_mapId[$table][$uid]);
if (is_array($this->dat['records'][$table . ':' . $uid]['rels'])) {
$thisNewPageUid = 0;
if ($this->legacyImport) {
if ($table != 'pages') {
$oldPid = $this->dat['records'][$table . ':' . $uid]['data']['pid'];
$thisNewPageUid = BackendUtility::wsMapId($table, $this->import_mapId['pages'][$oldPid]);
} else {
$thisNewPageUid = $thisNewUid;
}
}
// Traverse relation fields of each record
foreach ($this->dat['records'][$table . ':' . $uid]['rels'] as $field => $config) {
// uid_local of sys_file_reference needs no update because the correct reference uid was already written
// @see ImportExport::fixUidLocalInSysFileReferenceRecords()
if ($table === 'sys_file_reference' && $field === 'uid_local') {
continue;
}
switch ((string) $config['type']) {
case 'db':
if (is_array($config['itemArray']) && !empty($config['itemArray'])) {
$itemConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
$valArray = $this->setRelations_db($config['itemArray'], $itemConfig);
$updateData[$table][$thisNewUid][$field] = implode(',', $valArray);
}
break;
case 'file':
if (is_array($config['newValueFiles']) && !empty($config['newValueFiles'])) {
$valArr = array();
foreach ($config['newValueFiles'] as $fI) {
$valArr[] = $this->import_addFileNameToBeCopied($fI);
}
if ($this->legacyImport && $this->legacyImportFolder === null && isset($this->legacyImportMigrationTables[$table][$field])) {
// Do nothing - the legacy import folder is missing
} elseif ($this->legacyImport && $this->legacyImportFolder !== null && isset($this->legacyImportMigrationTables[$table][$field])) {
$refIds = array();
foreach ($valArr as $tempFile) {
$fileName = $this->alternativeFileName[$tempFile];
$fileObject = null;
try {
// check, if there is alreay the same file in the folder
if ($this->legacyImportFolder->hasFile($fileName)) {
$fileStorage = $this->legacyImportFolder->getStorage();
$file = $fileStorage->getFile($this->legacyImportFolder->getIdentifier() . $fileName);
if ($file->getSha1() === sha1_file($tempFile)) {
$fileObject = $file;
}
}
} catch (Exception $e) {
}
if ($fileObject === null) {
try {
$fileObject = $this->legacyImportFolder->addFile($tempFile, $fileName, DuplicationBehavior::RENAME);
} catch (Exception $e) {
$this->error('Error: no file could be added to the storage for file name' . $this->alternativeFileName[$tempFile]);
}
}
if ($fileObject !== null) {
$refId = StringUtility::getUniqueId('NEW');
$refIds[] = $refId;
$updateData['sys_file_reference'][$refId] = array('uid_local' => $fileObject->getUid(), 'uid_foreign' => $thisNewUid, 'tablenames' => $table, 'fieldname' => $field, 'pid' => $thisNewPageUid, 'table_local' => 'sys_file');
}
}
$updateData[$table][$thisNewUid][$field] = implode(',', $refIds);
if (!empty($this->legacyImportMigrationTables[$table][$field])) {
$this->legacyImportMigrationRecords[$table][$thisNewUid][$field] = $refIds;
}
} else {
$updateData[$table][$thisNewUid][$field] = implode(',', $valArr);
}
}
break;
}
}
} else {
$this->error('Error: no record was found in data array!');
}
} else {
$this->error('Error: this records is NOT created it seems! (' . $table . ':' . $uid . ')');
}
}
if (!empty($updateData)) {
//.........这里部分代码省略.........