PluginProbe
WPIDE – File Manager & Code Editor / 3.4.1
WPIDE – File Manager & Code Editor v3.4.1
3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 All 55 releases
← All changes | App/Services/Storage/Adapters/WPFileSystem.php +11 -12 3.5.93.4.1 View file →
@@ -1,16 +1,16 @@
1 1 <?php
2 2 namespace WPIDE\App\Services\Storage\Adapters;
3 3
4 +use finfo as Finfo;
4 5 use DirectoryIterator;
5 6 use FilesystemIterator;
7 +use League\Flysystem\Config;
6 8 use League\Flysystem\Exception;
7 9 use League\Flysystem\NotSupportedException;
8 10 use League\Flysystem\UnreadableFileException;
9 11 use League\Flysystem\Util;
10 12 use League\Flysystem\Adapter\AbstractAdapter;
11 -use League\MimeTypeDetection\ExtensionMimeTypeDetector;
12 -use League\MimeTypeDetection\FinfoMimeTypeDetector;
13 13 use LogicException;
14 14 use RecursiveDirectoryIterator;
15 15 use RecursiveIteratorIterator;
16 16 use SplFileInfo;
@@ -146,9 +146,9 @@
146 146 /**
147 147 * @inheritdoc
148 148 * @throws Exception
149 149 */
150 - public function write($path, $contents, $config)
150 + public function write($path, $contents, Config $config)
151 151 {
152 152 $path = $this->getRelativePath( $path );
153 153 $location = $this->applyPathPrefix($path);
154 154 $this->ensureDirectory(dirname($location));
@@ -171,9 +171,9 @@
171 171 /**
172 172 * @inheritdoc
173 173 * @throws Exception
174 174 */
175 - public function writeStream($path, $resource, $config)
175 + public function writeStream($path, $resource, Config $config)
176 176 {
177 177 $path = $this->getRelativePath( $path );
178 178 $location = $this->applyPathPrefix($path);
179 179 $this->ensureDirectory(dirname($location));
@@ -208,9 +208,9 @@
208 208
209 209 /**
210 210 * @inheritdoc
211 211 */
212 - public function updateStream($path, $resource, $config)
212 + public function updateStream($path, $resource, Config $config)
213 213 {
214 214 $path = $this->getRelativePath( $path );
215 215 return $this->writeStream($path, $resource, $config);
216 216 }
@@ -217,9 +217,9 @@
217 217
218 218 /**
219 219 * @inheritdoc
220 220 */
221 - public function update($path, $contents, $config)
221 + public function update($path, $contents, Config $config)
222 222 {
223 223 $path = $this->getRelativePath( $path );
224 224 $location = $this->applyPathPrefix($path);
225 225
@@ -356,15 +356,14 @@
356 356 public function getMimetype($path)
357 357 {
358 358 $path = $this->getRelativePath( $path );
359 359 $location = $this->applyPathPrefix($path);
360 + $finfo = new Finfo(FILEINFO_MIME_TYPE);
361 + $mimetype = @$finfo->file($location);
360 362
361 - if(extension_loaded('fileinfo')) {
362 - $mimeDetector = new FinfoMimeTypeDetector();
363 - }else{
364 - $mimeDetector = new ExtensionMimeTypeDetector();
363 + if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty', 'application/x-empty'])) {
364 + $mimetype = Util\MimeType::detectByFilename($location);
365 365 }
366 - $mimetype = $mimeDetector->detectMimeTypeFromPath($location);
367 366
368 367 return ['path' => $path, 'type' => 'file', 'mimetype' => $mimetype];
369 368 }
370 369
@@ -418,9 +417,9 @@
418 417
419 418 /**
420 419 * @inheritdoc
421 420 */
422 - public function createDir($dirname, $config)
421 + public function createDir($dirname, Config $config)
423 422 {
424 423
425 424 $dirname = $this->getRelativePath( $dirname );
426 425 $location = $this->applyPathPrefix($dirname);