EmptyDir.php in WPIDE – File Manager & Code Editor trunk, at App/Helpers/EmptyDir.php
| 1 | <?php |
| 2 | namespace WPIDE\App\Helpers; |
| 3 | |
| 4 | use WPIDE\App\Services\Storage\LocalFileSystem; |
| 5 | |
| 6 | class EmptyDir |
| 7 | { |
| 8 | |
| 9 | public static function create($path) { |
| 10 | |
| 11 | if ( ! is_dir( $path ) ) { |
| 12 | wp_mkdir_p( $path ); |
| 13 | } |
| 14 | |
| 15 | $fs = LocalFileSystem::load($path); |
| 16 | |
| 17 | if(!$fs->fileExists('/.htaccess')){ |
| 18 | |
| 19 | $fs->store('/', '.htaccess', 'Deny from all', true); |
| 20 | } |
| 21 | |
| 22 | if(!$fs->fileExists('/index.html')){ |
| 23 | |
| 24 | $fs->store('/', 'index.html', '', true); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | } |
| 29 |