Skip to content

Instantly share code, notes, and snippets.

@nxpthx
Created December 14, 2013 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nxpthx/7956956 to your computer and use it in GitHub Desktop.
Save nxpthx/7956956 to your computer and use it in GitHub Desktop.
Fix the Error about files needed to be indexed...
diff --git a/typo3/sysext/core/Classes/Resource/Driver/AbstractDriver.php b/typo3/sysext/core/Classes/Resource/Driver/AbstractDriver.php
index 5e0af58..4b145f5 100644
--- a/typo3/sysext/core/Classes/Resource/Driver/AbstractDriver.php
+++ b/typo3/sysext/core/Classes/Resource/Driver/AbstractDriver.php
@@ -304,10 +304,9 @@ abstract class AbstractDriver {
* @param string $localFilePath
* @param Folder $targetFolder
* @param string $fileName The name to add the file under
- * @param \TYPO3\CMS\Core\Resource\AbstractFile $updateFileObject Optional file object to update (instead of creating a new object). With this parameter, this function can be used to "populate" a dummy file object with a real file underneath.
- * @return FileInterface
+ * @return void
*/
- abstract public function addFile($localFilePath, Folder $targetFolder, $fileName, \TYPO3\CMS\Core\Resource\AbstractFile $updateFileObject = NULL);
+ abstract public function addFile($localFilePath, Folder $targetFolder, $fileName);
/**
* Checks if a resource exists - does not care for the type (file or folder).
diff --git a/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php b/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php
index bb98ba7..b458bad 100644
--- a/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php
+++ b/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php
@@ -659,13 +659,10 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver {
* @param string $localFilePath
* @param Folder $targetFolder
* @param string $fileName The name to add the file under
- * @param \TYPO3\CMS\Core\Resource\AbstractFile $updateFileObject File object to update (instead of creating a new object). With this parameter, this function can be used to "populate" a dummy file object with a real file underneath.
- * @todo \TYPO3\CMS\Core\Resource\File $updateFileObject should be \TYPO3\CMS\Core\Resource\FileInterface, but indexer logic is only in \TYPO3\CMS\Core\Resource\File
- * @return FileInterface
* @throws \RuntimeException
* @throws \InvalidArgumentException
*/
- public function addFile($localFilePath, Folder $targetFolder, $fileName, \TYPO3\CMS\Core\Resource\AbstractFile $updateFileObject = NULL) {
+ public function addFile($localFilePath, Folder $targetFolder, $fileName) {
$localFilePath = $this->canonicalizeAndCheckFilePath($localFilePath);
// as for the "virtual storage" for backwards-compatibility, this check always fails, as the file probably lies under PATH_site
// thus, it is not checked here
@@ -686,14 +683,8 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver {
clearstatcache();
// Change the permissions of the file
GeneralUtility::fixPermissions($targetPath);
- $fileInfo = $this->getFileInfoByIdentifier($relativeTargetPath);
- if ($updateFileObject) {
- $updateFileObject->updateProperties($fileInfo);
- return $updateFileObject;
- } else {
- $fileObject = $this->getFileObject($fileInfo);
- return $fileObject;
- }
+
+ return $relativeTargetPath;
}
/**
diff --git a/typo3/sysext/core/Classes/Resource/ProcessedFile.php b/typo3/sysext/core/Classes/Resource/ProcessedFile.php
index cbca775..c6502e2 100644
--- a/typo3/sysext/core/Classes/Resource/ProcessedFile.php
+++ b/typo3/sysext/core/Classes/Resource/ProcessedFile.php
@@ -194,9 +194,9 @@ class ProcessedFile extends AbstractFile {
$addedFile = $this->storage->updateProcessedFile($filePath, $this);
// Update some related properties
- $this->identifier = $addedFile->getIdentifier();
+ $this->identifier = $addedFile;
$this->originalFileSha1 = $this->originalFile->getSha1();
- $this->updateProperties($addedFile->getProperties());
+ //$this->updateProperties($addedFile->getProperties());
$this->deleted = FALSE;
$this->updated = TRUE;
}
diff --git a/typo3/sysext/core/Classes/Resource/ResourceStorage.php b/typo3/sysext/core/Classes/Resource/ResourceStorage.php
index 4c2ed77..3fad07d 100644
--- a/typo3/sysext/core/Classes/Resource/ResourceStorage.php
+++ b/typo3/sysext/core/Classes/Resource/ResourceStorage.php
@@ -1105,7 +1105,8 @@ class ResourceStorage {
// so just use the name as is in that case
$this->emitPreFileAddSignal($targetFileName, $targetFolder);
- $file = $this->driver->addFile($localFilePath, $targetFolder, $targetFileName);
+ $identifier = $this->driver->addFile($localFilePath, $targetFolder, $targetFileName);
+ $file = $this->getFile($identifier);
$this->emitPostFileAddSignal($file, $targetFolder);
@@ -1126,9 +1127,6 @@ class ResourceStorage {
throw new \InvalidArgumentException('File "' . $localFilePath . '" does not exist.', 1319552745);
}
$file = $this->driver->addFile($localFilePath, $this->getProcessingFolder(), $processedFile->getName());
- if ($file instanceof File) {
- $file->setIndexable(FALSE);
- }
return $file;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment