diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2023-03-21 19:57:23 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2023-03-22 22:21:03 +0100 |
| commit | d6276ca061f76ae1e810a7725402fe38e09c0b2b (patch) | |
| tree | 56c955ffe7c0bc398d5de9d5221acb759959c61f | |
| parent | a99373911922f7b1b5d42cf42d273bc7b0c61c61 (diff) | |
| download | phorkie-d6276ca061f76ae1e810a7725402fe38e09c0b2b.tar.gz phorkie-d6276ca061f76ae1e810a7725402fe38e09c0b2b.zip | |
Remove PEAR support from file type detection
| -rw-r--r-- | src/phorkie/Tool/MIME/Type/PlainDetect.php | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/phorkie/Tool/MIME/Type/PlainDetect.php b/src/phorkie/Tool/MIME/Type/PlainDetect.php index 235046e..b5c730d 100644 --- a/src/phorkie/Tool/MIME/Type/PlainDetect.php +++ b/src/phorkie/Tool/MIME/Type/PlainDetect.php @@ -12,22 +12,18 @@ class Tool_MIME_Type_PlainDetect extends \MIME_Type_PlainDetect public static function getMagicFile() { $rootdir = __DIR__ . '/../../../../../'; - if (file_exists($rootdir . '/lib/PEAR.php')) { - if (!\Phar::running()) { - return $rootdir . '/lib/data/programming.magic'; - } else { - //magic file within a .phar does not work: - // https://bugs.php.net/bug.php?id=67556 - //put it outside - $target = '/tmp/phorkie-programming.magic'; - if (!file_exists($target)) { - copy( - $rootdir . '/lib/data/programming.magic', - $target - ); - } - return $target; + $magicPath = $rootdir . '/lib/cweiske/mime_type_plaindetect/data/programming.magic'; + if (!\Phar::running()) { + return $magicPath; + } else { + //magic file within a .phar does not work: + // https://bugs.php.net/bug.php?id=67556 + //put it outside + $target = '/tmp/phorkie-programming.magic'; + if (!file_exists($target)) { + copy($magicPath, $target); } + return $target; } return parent::getMagicFile(); } |
