Skip to content

Instantly share code, notes, and snippets.

@andrerom
Created September 28, 2014 21:17
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 andrerom/17053187dbfea0a89806 to your computer and use it in GitHub Desktop.
Save andrerom/17053187dbfea0a89806 to your computer and use it in GitHub Desktop.
EZP-23390 - Legacy IO loads whole file to get mime type with FS cluster handler
diff --git a/kernel/classes/clusterfilehandlers/ezfsfilehandler.php b/kernel/classes/clusterfilehandlers/ezfsfilehandler.php
index 1689b96..25a153c 100644
--- a/kernel/classes/clusterfilehandlers/ezfsfilehandler.php
+++ b/kernel/classes/clusterfilehandlers/ezfsfilehandler.php
@@ -117,7 +117,16 @@ class eZFSFileHandler implements eZClusterFileHandlerInterface
eZDebugSetting::writeDebug( 'kernel-clustering', ' clearstatcache called on ' . $this->filePath, __METHOD__ );
}
- $this->metaData = file_exists( $this->filePath ) ? stat( $this->filePath ) : false;
+ if ( file_exists( $this->filePath ) )
+ {
+ $this->metaData = stat( $this->filePath );
+ $fileInfo = new finfo( FILEINFO_MIME_TYPE );
+ $this->metaData['datatype'] = $fileInfo->file( $this->filePath );
+ }
+ else
+ {
+ $this->metaData = false;
+ }
eZDebug::accumulatorStop( 'dbfile' );
}
}
@andrerom
Copy link
Author

Patch needs to be applied in ezpublish_legacy folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment