Browse Source

Move Filesystem to Utility

Corey Taylor 4 years ago
parent
commit
ff6b2fd971

+ 0 - 1
composer.json

@@ -45,7 +45,6 @@
         "cakephp/database": "self.version",
         "cakephp/datasource": "self.version",
         "cakephp/event": "self.version",
-        "cakephp/filesystem": "self.version",
         "cakephp/form": "self.version",
         "cakephp/http": "self.version",
         "cakephp/i18n": "self.version",

+ 1 - 1
psalm.xml

@@ -11,8 +11,8 @@
     <projectFiles>
         <directory name="src"/>
         <ignoreFiles>
-            <directory name="src/Filesystem"/>
             <directory name="vendor"/>
+            <file name="src/Utility/Filesystem.php"/>
         </ignoreFiles>
     </projectFiles>
 

+ 1 - 1
src/Command/I18nExtractCommand.php

@@ -22,7 +22,7 @@ use Cake\Console\ConsoleOptionParser;
 use Cake\Core\App;
 use Cake\Core\Configure;
 use Cake\Core\Plugin;
-use Cake\Filesystem\Filesystem;
+use Cake\Utility\Filesystem;
 use Cake\Utility\Inflector;
 
 /**

+ 1 - 1
src/Command/PluginAssetsTrait.php

@@ -18,7 +18,7 @@ namespace Cake\Command;
 
 use Cake\Core\Configure;
 use Cake\Core\Plugin;
-use Cake\Filesystem\Filesystem;
+use Cake\Utility\Filesystem;
 use Cake\Utility\Inflector;
 
 /**

+ 1 - 1
src/Console/CommandScanner.php

@@ -19,7 +19,7 @@ namespace Cake\Console;
 use Cake\Core\App;
 use Cake\Core\Configure;
 use Cake\Core\Plugin;
-use Cake\Filesystem\Filesystem;
+use Cake\Utility\Filesystem;
 use Cake\Utility\Inflector;
 
 /**

+ 0 - 1
src/Console/composer.json

@@ -26,7 +26,6 @@
         "php": ">=8.0",
         "cakephp/core": "^5.0",
         "cakephp/event": "^5.0",
-        "cakephp/filesystem": "^5.0",
         "cakephp/log": "^5.0",
         "cakephp/utility": "^5.0"
     },

+ 0 - 22
src/Filesystem/LICENSE.txt

@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-CakePHP(tm) : The Rapid Development PHP Framework (https://cakephp.org)
-Copyright (c) 2005-2020, Cake Software Foundation, Inc. (https://cakefoundation.org)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

+ 0 - 37
src/Filesystem/README.md

@@ -1,37 +0,0 @@
-[![Total Downloads](https://img.shields.io/packagist/dt/cakephp/filesystem.svg?style=flat-square)](https://packagist.org/packages/cakephp/filesystem)
-[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE.txt)
-
-# This package has been deprecated.
-
-## CakePHP Filesystem Library
-
-The Folder and File utilities are convenience classes to help you read from and write/append to files; list files within a folder and other common directory related tasks.
-
-## Basic Usage
-
-Create a folder instance and search for all the `.php` files within it:
-
-```php
-use Cake\Filesystem\Folder;
-
-$dir = new Folder('/path/to/folder');
-$files = $dir->find('.*\.php');
-```
-
-Now you can loop through the files and read from or write/append to the contents or simply delete the file:
-
-```php
-foreach ($files as $file) {
-    $file = new File($dir->pwd() . DIRECTORY_SEPARATOR . $file);
-    $contents = $file->read();
-    // $file->write('I am overwriting the contents of this file');
-    // $file->append('I am adding to the bottom of this file.');
-    // $file->delete(); // I am deleting this file
-    $file->close(); // Be sure to close the file when you're done
-}
-```
-
-## Documentation
-
-Please make sure you check the [official
-documentation](https://book.cakephp.org/4/en/core-libraries/file-folder.html)

+ 0 - 34
src/Filesystem/composer.json

@@ -1,34 +0,0 @@
-{
-    "name": "cakephp/filesystem",
-    "description": "CakePHP filesystem convenience classes to help you work with files and folders.",
-    "type": "library",
-    "keywords": [
-        "cakephp",
-        "filesystem",
-        "files",
-        "folders"
-    ],
-    "homepage": "https://cakephp.org",
-    "license": "MIT",
-    "authors": [
-        {
-            "name": "CakePHP Community",
-            "homepage": "https://github.com/cakephp/filesystem/graphs/contributors"
-        }
-    ],
-    "support": {
-        "issues": "https://github.com/cakephp/cakephp/issues",
-        "forum": "https://stackoverflow.com/tags/cakephp",
-        "irc": "irc://irc.freenode.org/cakephp",
-        "source": "https://github.com/cakephp/filesystem"
-    },
-    "require": {
-        "php": ">=8.0",
-        "cakephp/core": "^5.0"
-    },
-    "autoload": {
-        "psr-4": {
-            "Cake\\Filesystem\\": "."
-        }
-    }
-}

+ 1 - 1
src/TestSuite/TestSuite.php

@@ -18,7 +18,7 @@ declare(strict_types=1);
  */
 namespace Cake\TestSuite;
 
-use Cake\Filesystem\Filesystem;
+use Cake\Utility\Filesystem;
 use PHPUnit\Framework\TestSuite as BaseTestSuite;
 use SplFileInfo;
 

+ 1 - 1
src/Filesystem/Filesystem.php

@@ -14,7 +14,7 @@ declare(strict_types=1);
  * @since         4.0.0
  * @license       https://opensource.org/licenses/mit-license.php MIT License
  */
-namespace Cake\Filesystem;
+namespace Cake\Utility;
 
 use Cake\Core\Exception\CakeException;
 use CallbackFilterIterator;

+ 1 - 1
tests/TestCase/Command/I18nExtractCommandTest.php

@@ -17,9 +17,9 @@ declare(strict_types=1);
 namespace Cake\Test\TestCase\Command;
 
 use Cake\Core\Configure;
-use Cake\Filesystem\Filesystem;
 use Cake\TestSuite\ConsoleIntegrationTestTrait;
 use Cake\TestSuite\TestCase;
+use Cake\Utility\Filesystem;
 
 /**
  * I18nExtractCommandTest

+ 2 - 2
tests/TestCase/Command/PluginAssetsCommandsTest.php

@@ -20,10 +20,10 @@ use Cake\Command\Command;
 use Cake\Console\ConsoleIo;
 use Cake\Console\ConsoleOptionParser;
 use Cake\Core\Configure;
-use Cake\Filesystem\Filesystem;
 use Cake\TestSuite\ConsoleIntegrationTestTrait;
 use Cake\TestSuite\Stub\ConsoleOutput;
 use Cake\TestSuite\TestCase;
+use Cake\Utility\Filesystem;
 
 /**
  * PluginAssetsCommandsTest class
@@ -38,7 +38,7 @@ class PluginAssetsCommandsTest extends TestCase
     protected $wwwRoot;
 
     /**
-     * @var \Cake\Filesystem\Filesystem
+     * @var \Cake\Utility\Filesystem
      */
     protected $fs;
 

+ 1 - 1
tests/TestCase/Console/ConsoleIoTest.php

@@ -18,9 +18,9 @@ namespace Cake\Test\TestCase\Console;
 
 use Cake\Console\ConsoleIo;
 use Cake\Console\Exception\StopException;
-use Cake\Filesystem\Filesystem;
 use Cake\Log\Log;
 use Cake\TestSuite\TestCase;
+use Cake\Utility\Filesystem;
 
 /**
  * ConsoleIo test.

+ 1 - 1
tests/TestCase/TestSuite/TestSuiteTest.php

@@ -16,8 +16,8 @@ declare(strict_types=1);
  */
 namespace Cake\Test\TestCase\TestSuite;
 
-use Cake\Filesystem\Filesystem;
 use Cake\TestSuite\TestCase;
+use Cake\Utility\Filesystem;
 
 /**
  * TestSuiteTest

+ 3 - 3
tests/TestCase/Filesystem/FilesystemTest.php

@@ -14,16 +14,16 @@ declare(strict_types=1);
  * @since         4.0.0
  * @license       https://opensource.org/licenses/mit-license.php MIT License
  */
-namespace Cake\Test\TestCase\Filesystem;
+namespace Cake\Test\TestCase\Utility;
 
-use Cake\Filesystem\Filesystem;
 use Cake\TestSuite\TestCase;
+use Cake\Utility\Filesystem;
 use org\bovigo\vfs\vfsStream;
 
 /**
  * Filesystem class
  *
- * @coversDefaultClass \Cake\Filesystem\Filesystem
+ * @coversDefaultClass \Cake\Utility\Filesystem
  */
 class FilesystemTest extends TestCase
 {

+ 1 - 1
tests/TestCase/View/Helper/HtmlHelperTest.php

@@ -18,13 +18,13 @@ namespace Cake\Test\TestCase\View\Helper;
 
 use Cake\Core\Configure;
 use Cake\Core\Plugin;
-use Cake\Filesystem\Filesystem;
 use Cake\Http\ServerRequest;
 use Cake\I18n\Date;
 use Cake\Routing\Route\DashedRoute;
 use Cake\Routing\RouteBuilder;
 use Cake\Routing\Router;
 use Cake\TestSuite\TestCase;
+use Cake\Utility\Filesystem;
 use Cake\View\Helper\HtmlHelper;
 use Cake\View\View;