mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-06-29 07:59:27 +02:00
Merge pull request #12 from chillu/pulls/check-file-existence
Check file existence in for_file()
This commit is contained in:
commit
fd917f04a1
|
@ -72,9 +72,13 @@ abstract class FileTextExtractor extends Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return FileTextExtractor
|
* @return FileTextExtractor|null
|
||||||
*/
|
*/
|
||||||
static function for_file($path) {
|
static function for_file($path) {
|
||||||
|
if(!file_exists($path) || is_dir($path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$extension = pathinfo($path, PATHINFO_EXTENSION);
|
$extension = pathinfo($path, PATHINFO_EXTENSION);
|
||||||
$mime = self::get_mime($path);
|
$mime = self::get_mime($path);
|
||||||
foreach(self::get_extractor_classes() as $className) {
|
foreach(self::get_extractor_classes() as $className) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user