isDirectory() public static method

Determine if the given path is a directory.
public static isDirectory ( string $directory ) : boolean
$directory string
return boolean
Example #1
0
 public static function uploadImage($user_id)
 {
     $error_code = ApiResponse::OK;
     if (User::where('user_id', $user_id)->first()) {
         $profile = Profile::where('user_id', $user_id)->first();
         if (Input::hasFile('file')) {
             $file = Input::file('file');
             $destinationPath = public_path() . '/images/' . $user_id . '/avatar';
             $filename = date('YmdHis') . '_' . $file->getClientOriginalName();
             $extension = $file->getClientOriginalExtension();
             if (!File::isDirectory($destinationPath)) {
                 File::makeDirectory($destinationPath, $mode = 0777, true, true);
             }
             $upload_success = $file->move($destinationPath, $filename);
             $profile->image = 'images/' . $user_id . '/avatar/' . $filename;
             $profile->save();
             $data = URL::asset($profile->image);
         } else {
             $error_code = ApiResponse::MISSING_PARAMS;
             $data = null;
         }
     } else {
         $error_code = ApiResponse::UNAVAILABLE_USER;
         $data = ApiResponse::getErrorContent(ApiResponse::UNAVAILABLE_USER);
     }
     return array("code" => $error_code, "data" => $data);
 }
Example #2
0
 function simpan($id)
 {
     if ($this->getCount($id) > 6) {
         echo "not";
     } else {
         $pajak = new Pajak();
         $pajak->id_pengadaan = $id;
         $pajak->jenis_pajak = Input::get('jenis_pajak');
         $pajak->no_pajak = Input::get("no_pajak");
         $pajak->tgl_pajak = date('Y-m-d', strtotime(Input::get('tanggal')));
         $pajak->save();
         $id_pajak = $pajak->id_pajak;
         if (!File::isDirectory(public_path() . '/asset/img/pajak/' . $id)) {
             File::makeDirectory(public_path() . '/asset/img/pajak/' . $id);
         }
         $filenpwp = Input::file('file_npwp');
         $newnpwp = $id . '_' . $id_pajak . '.' . $filenpwp->guessClientExtension();
         Image::make($filenpwp->getRealPath())->save(public_path('/asset/img/pajak/' . $id . '/' . $newnpwp));
         $data = Pajak::find($id_pajak);
         $data->file_pajak = $newnpwp;
         if ($data->save()) {
             echo "ok";
         } else {
             echo "error";
         }
     }
 }
Example #3
0
 /**
  * @param $file
  * @return array
  */
 public function upload($file)
 {
     if (!$file->getClientOriginalName()) {
         return ['status' => false, 'code' => 404];
     }
     $destinationPath = public_path() . $this->imgDir;
     $fileName = $file->getClientOriginalName();
     $fileSize = $file->getClientSize();
     $ext = $file->guessClientExtension();
     $type = $file->getMimeType();
     $upload_success = Input::file('file')->move($destinationPath, $fileName);
     if ($upload_success) {
         $md5_name = md5($fileName . time()) . '.' . $ext;
         $_uploadFile = date('Ymd') . '/' . $md5_name;
         if (!File::isDirectory($destinationPath . date('Ymd'))) {
             File::makeDirectory($destinationPath . date('Ymd'));
         }
         // resizing an uploaded file
         Image::make($destinationPath . $fileName)->resize($this->width, $this->height)->save($destinationPath . $_uploadFile);
         File::delete($destinationPath . $fileName);
         $data = ['status' => true, 'code' => 200, 'file' => ['disk_name' => $fileName, 'file_name' => $md5_name, 'type' => $type, 'size' => $fileSize, 'path' => $this->imgDir . $_uploadFile]];
         return $data;
     } else {
         return ['status' => false, 'code' => 400];
     }
 }
Example #4
0
 public function setUp()
 {
     parent::setUp();
     if (File::isDirectory('packages')) {
         File::deleteDirectory('packages');
     }
 }
Example #5
0
 /**
  * Executes a program and returns the return code.
  * Output from command is logged at INFO level.
  * @return int Return code from execution.
  */
 public function execute()
 {
     // test if os match
     $myos = Phing::getProperty("os.name");
     $this->log("Myos = " . $myos, PROJECT_MSG_VERBOSE);
     if ($this->os !== null && strpos($os, $myos) === false) {
         // this command will be executed only on the specified OS
         $this->log("Not found in " . $os, PROJECT_MSG_VERBOSE);
         return 0;
     }
     if ($this->dir !== null) {
         if ($this->dir->isDirectory()) {
             $currdir = getcwd();
             @chdir($this->dir->getPath());
         } else {
             throw new BuildException("Can't chdir to:" . $this->dir->__toString());
         }
     }
     if ($this->escape == true) {
         // FIXME - figure out whether this is correct behavior
         $this->command = escapeshellcmd($this->command);
     }
     if ($this->error !== null) {
         $this->command .= ' 2> ' . $this->error->getPath();
         $this->log("Writing error output to: " . $this->error->getPath());
     }
     if ($this->output !== null) {
         $this->command .= ' 1> ' . $this->output->getPath();
         $this->log("Writing standard output to: " . $this->output->getPath());
     } elseif ($this->spawn) {
         $this->command .= ' 1>/dev/null';
         $this->log("Sending ouptut to /dev/null");
     }
     // If neither output nor error are being written to file
     // then we'll redirect error to stdout so that we can dump
     // it to screen below.
     if ($this->output === null && $this->error === null) {
         $this->command .= ' 2>&1';
     }
     // we ignore the spawn boolean for windows
     if ($this->spawn) {
         $this->command .= ' &';
     }
     $this->log("Executing command: " . $this->command);
     $output = array();
     $return = null;
     exec($this->command, $output, $return);
     if ($this->dir !== null) {
         @chdir($currdir);
     }
     foreach ($output as $line) {
         $this->log($line, $this->passthru ? PROJECT_MSG_INFO : PROJECT_MSG_VERBOSE);
     }
     if ($return != 0 && $this->checkreturn) {
         throw new BuildException("Task exited with code {$return}");
     }
     return $return;
 }
 protected static function prepare($type)
 {
     $path = storage_path('logs/wechat');
     $file = $path . '/' . $type . '-' . date('Y-m-d') . '.log';
     if (!\File::isDirectory($path)) {
         \File::makeDirectory($path);
     }
     return $file;
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->setReplacement();
     $this->setSetting();
     if (!\File::isDirectory($this->getStorageDirectory())) {
         \File::makeDirectory($this->getStorageDirectory());
         $this->makeCrudForm();
     }
 }
Example #8
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->setReplacement();
     if (!\File::isDirectory($this->storageDirectory)) {
         \File::makeDirectory($this->storageDirectory);
     }
     $this->makeBaseRepo();
     $this->makeModelRepo();
     $this->comment(PHP_EOL . 'CRUDED IT' . PHP_EOL);
 }
Example #9
0
 /**
  * Get Existing Bill Templates
  */
 protected function getExistingBillTemplates()
 {
     $path = __DIR__ . '/../../../../';
     $billsTypes = \File::allFiles($path . "resources/components/bills");
     $customPath = base_path() . '/resources/views/bills';
     $customBillTypes = \File::isDirectory($customPath) ? \File::allFiles($customPath) : [];
     foreach (array_merge($billsTypes, $customBillTypes) as $billFile) {
         app('veer')->loadedComponents['billsTypes'][array_get(pathinfo($billFile), 'filename')] = array_get(pathinfo($billFile), 'filename');
     }
 }
Example #10
0
function make_controller($controller, $method)
{
    $content = "<?php\n\nclass {$controller} extends BaseController\n{\n    /**\n     * 初始化\n     * @return void\n     */\n    public function __construct()\n    {\n        parent::__construct();\n    }\n\n    /**\n     * 页面:默认\n     * @return Response\n     */\n    public function {$method}()\n    {\n        return __FILE__;\n    }\n}\n";
    $array = explode('_', $controller);
    $fileName = array_pop($array) . '.php';
    $path = app_path('controllers/' . implode('/', $array) . '/');
    // 若目录不存在,则递归创建
    File::isDirectory($path) or File::makeDirectory($path, 0777, true);
    // 创建文件
    File::put($path . '/' . $fileName, $content);
}
Example #11
0
 public function assets($file = null)
 {
     if (!is_null($file) && \File::isDirectory($this->themesAssetsPath)) {
         if (!\File::exists($this->themesAssetsPath . $file)) {
             return \Response::make("Not found!", 404);
         }
         $requestedFile = \File::get($this->themesAssetsPath . $file);
         return \Response::make($requestedFile, 200, array('Content-Type' => $this->mimeMap[\Str::lower(\File::extension($this->themesAssetsPath . $file))]));
     }
     return \Redirect::route('app.home');
 }
 public function fire()
 {
     if (!$this->option('verbose')) {
         $this->output = new NullOutput();
     }
     if (\File::isDirectory($indexPath = Config::get('laravel-lucene-search.index.path'))) {
         \File::deleteDirectory($indexPath);
         $this->info('Search index is cleared.');
     } else {
         $this->comment('There is nothing to clear..');
     }
 }
Example #13
0
 /**
  * Create directories necessary for backup process
  */
 private function prepareDirectories()
 {
     if (!File::isDirectory($this->userFolderPath)) {
         File::makeDirectory($this->userFolderPath, 0775);
     }
     if (!File::isDirectory($this->userFolderPath . '/files')) {
         File::makeDirectory($this->userFolderPath . '/files', 0775);
     }
     if (!File::isDirectory($this->userFolderPath . '/zip')) {
         File::makeDirectory($this->userFolderPath . '/zip', 0775);
     }
 }
Example #14
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     // Create certs dir if it doesn't exist
     if (!File::isDirectory('/data/certs')) {
         File::makeDirectory('/data/certs');
     }
     // Touch sqlite database file
     if (!File::exists('/data/trusted.sqlite')) {
         File::put('/data/trusted.sqlite', '');
         $this->call('migrate', ['--seed' => true, '--force' => true]);
     }
 }
Example #15
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $dir = storage_path('backup');
     if (!\File::isDirectory($dir)) {
         \File::makeDirectory($dir);
     }
     $command = sprintf('mysqldump %s > %s -u%s -p%s', $this->option('db'), storage_path("backup/{$this->option('db')}.sql"), $this->argument('user'), $this->argument('pass'));
     system($command);
     $now = \Carbon\Carbon::now()->toDateTimeString();
     $result = "{$this->getName()} command done at {$now}";
     \Log::info($result);
     return $this->info($result);
 }
Example #16
0
 function check_directory($path)
 {
     $directory = dirname($path);
     $folders = explode('/', $directory);
     $dir = '';
     foreach ($folders as $folder) {
         $dir .= $folder . '/';
         if (!File::isDirectory($dir)) {
             File::makeDirectory($dir);
         }
     }
     return $path;
 }
 protected function putInPoFile($locale)
 {
     $header = $this->getHeader($locale);
     $path = base_path(config('trans.translations_path') . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES');
     $file = $path . DIRECTORY_SEPARATOR . 'messages.po';
     if (\File::exists($file)) {
         $header .= "\n";
         $content = preg_replace('/^([^#])+:?/', $header, \File::get($file));
     } else {
         $content = $header;
     }
     if (!\File::isDirectory($path)) {
         \File::makeDirectory($path, 493, true);
     }
     return \File::put($file, $content);
 }
Example #18
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     // Create certs dir if it doesn't exist
     if (!File::isDirectory(base_path() . '/certs')) {
         File::makeDirectory(base_path() . '/certs');
     }
     // Touch sqlite database file
     if (!File::exists(app_path() . '/database/trusted.sqlite')) {
         File::put(app_path() . '/database/trusted.sqlite', '');
     }
     // Setup key and database migration
     if (Config::get('app.key') == 'YourSecretKey!!!') {
         $this->call('key:generate');
         $this->call('migrate', ['--seed' => true, '--force' => true]);
     }
 }
 /**
  * undocumented function
  *
  * @return void
  * @author 
  **/
 public function upload()
 {
     if ($_SERVER['REQUEST_METHOD'] === 'GET') {
         $temp_dir = 'public/temp/' . Input::get('resumableIdentifier');
         $chunk_file = $temp_dir . '/' . Input::get('resumableFilename') . '.part' . Input::get('resumableChunkNumber');
         if (File::exists($chunk_file)) {
             return Response::json(array(), 200);
         } else {
             return Response::json(array(), 404);
         }
     }
     if (!empty($_FILES)) {
         foreach ($_FILES as $file) {
             // check the error status
             if ($file['error'] != 0) {
                 $this->_log('error ' . $file['error'] . ' in file ' . Input::get('resumableFilename'));
                 continue;
             }
             // init the destination file (format <filename.ext>.part<#chunk>
             // the file is stored in a temporary directory
             $temp_dir = 'public/temp/' . Input::get('resumableIdentifier');
             $dest_file = $temp_dir . '/' . Input::get('resumableFilename') . '.part' . Input::get('resumableChunkNumber');
             // create the temporary directory
             if (!File::isDirectory($temp_dir)) {
                 File::makeDirectory($temp_dir, 0777, true);
             }
             // move the temporary file
             if (!move_uploaded_file($file['tmp_name'], $dest_file)) {
                 $this->_log('Error saving (move_uploaded_file) chunk ' . Input::get('resumableChunkNumber') . ' for file ' . Input::get('resumableFilename'));
             } else {
                 // check if all the parts present, and create the final destination file
                 $this->createFileFromChunks($temp_dir, Input::get('resumableFilename'), Input::get('resumableChunkSize'), Input::get('resumableTotalSize'));
             }
         }
     }
 }
 /**
  *  Create validators as specified in the configuration file
  */
 private function createValidators()
 {
     $dir = $this->configSettings['pathTo']['validators'];
     if (!\File::isDirectory($dir)) {
         \File::makeDirectory($dir);
     }
     $pathToValidators = $this->configSettings['pathTo']['templates'];
     $validator = $this->nameOf('validator');
     $fileName = $dir . $validator . '.php';
     try {
         $this->makeFileFromTemplate($fileName, $pathToValidators . 'validator.txt');
     } catch (FileNotFoundException $e) {
         $this->command->error('Template file ' . $pathToValidators . $validator . '.txt does not exist! You need to create it to generate that file!');
     }
 }
 protected function path($folder)
 {
     $path = base_path("database/manifest/{$folder}");
     if (!\File::isDirectory($path)) {
         \File::makeDirectory($path, 0755);
     }
     return $path;
 }
Example #22
0
 /**
  * Save given file
  *
  * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file
  * @param                                                     $path
  *
  * @return array
  * @throws Exception
  */
 function save_file(Symfony\Component\HttpFoundation\File\UploadedFile $file, $path)
 {
     $fileName = sprintf("%d_%s", time(), str_replace(' ', '_', $file->getClientOriginalName()));
     if (File::exists("{$path}/{$fileName}")) {
         throw new Exception('File already exists!');
     }
     if (!File::isDirectory($path)) {
         File::makeDirectory($path, 755, true);
     }
     if (!$file->move($path, $fileName)) {
         throw new Exception('Failed to save!');
     }
     return ['filename' => $fileName, 'size' => $file->getSize()];
 }
Example #23
0
 /**
  * @param string $dir
  */
 public function createDirectory($dir)
 {
     if (!\File::isDirectory($dir)) {
         \File::makeDirectory($dir);
     }
 }
Example #24
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     /*
      * Prepare seeding
      */
     $faker = Faker::create();
     if (config('database.default') != 'sqlite') {
         DB::statement('SET FOREIGN_KEY_CHECKS=0');
     }
     Model::unguard();
     /*
      * Seeding users table
      */
     App\User::truncate();
     factory(App\User::class)->create(['name' => 'John Doe', 'email' => '*****@*****.**', 'password' => bcrypt('password')]);
     factory(App\User::class, 9)->create();
     $this->command->info('users table seeded');
     /**
      * Seeding roles table
      */
     Bican\Roles\Models\Role::truncate();
     DB::table('role_user')->truncate();
     $adminRole = Bican\Roles\Models\Role::create(['name' => 'Admin', 'slug' => 'admin']);
     $memberRole = Bican\Roles\Models\Role::create(['name' => 'Member', 'slug' => 'member']);
     App\User::where('email', '!=', '*****@*****.**')->get()->map(function ($user) use($memberRole) {
         $user->attachRole($memberRole);
     });
     App\User::whereEmail('*****@*****.**')->get()->map(function ($user) use($adminRole) {
         $user->attachRole($adminRole);
     });
     $this->command->info('roles table seeded');
     /*
      * Seeding articles table
      */
     App\Article::truncate();
     $users = App\User::all();
     $users->each(function ($user) use($faker) {
         $user->articles()->save(factory(App\Article::class)->make());
         $user->articles()->save(factory(App\Article::class)->make());
     });
     $this->command->info('articles table seeded');
     /**
      * Seeding comments table
      */
     App\Comment::truncate();
     $articles = App\Article::all();
     $articles->each(function ($article) use($faker, $users) {
         $article->comments()->save(factory(App\Comment::class)->make(['author_id' => $faker->randomElement($users->lists('id')->toArray())]));
     });
     $this->command->info('comments table seeded');
     /*
      * Seeding tags table
      */
     App\Tag::truncate();
     DB::table('article_tag')->truncate();
     $rawTags = ['General', 'Laravel', 'Lumen', 'Eloquent', 'Servers', 'Tips', 'Lesson Feedback'];
     foreach ($rawTags as $tag) {
         App\Tag::create(['name' => $tag, 'slug' => str_slug($tag)]);
     }
     $tags = App\Tag::all();
     foreach ($articles as $article) {
         $article->tags()->attach($faker->randomElements($tags->lists('id')->toArray(), $faker->randomElement([1, 2, 3])));
     }
     $this->command->info('tags table seeded');
     /*
      * Seeding attachments table
      */
     App\Attachment::truncate();
     if (!File::isDirectory(attachment_path())) {
         File::deleteDirectory(attachment_path(), true);
     }
     $articles->each(function ($article) use($faker) {
         $article->attachments()->save(factory(App\Attachment::class)->make());
     });
     $files = App\Attachment::lists('name');
     if (!File::isDirectory(attachment_path())) {
         File::makeDirectory(attachment_path(), 777, true);
     }
     foreach ($files as $file) {
         File::put(attachment_path($file), '');
     }
     $this->command->info('attachments table seeded');
     /**
      * Close seeding
      */
     Model::reguard();
     if (config('database.default') != 'sqlite') {
         DB::statement('SET FOREIGN_KEY_CHECKS=1');
     }
 }
 public function upload()
 {
     // Archivo a cargar
     $doc_file = Input::file('file');
     // Directorio de destino
     $destinationPath = public_path() . '/img/resources/slider/';
     //Si la ruta de carpetas no existe, entonces se crean
     if (!File::isDirectory($destinationPath)) {
         $result = File::makeDirectory($destinationPath, 0775, true);
     }
     // Directorio temporal
     $tempPath = public_path() . '/img/temp/';
     // Crear carpeta
     if (!File::isDirectory($tempPath)) {
         $result = File::makeDirectory($tempPath, 0775, true);
     }
     //Extension del archivo
     $extension = $doc_file->getClientOriginalExtension();
     // Mime Type
     $mimeType = $doc_file->getMimeType();
     // Nombre original del archivo
     $OriginalFileName = $doc_file->getClientOriginalName();
     // Tamaño original del archivo
     $OriginalFileSize = $doc_file->getSize();
     // Nombre temnporal del archivo
     $HashfileName = md5($OriginalFileName . rand(11111, 99999)) . '.' . $extension;
     // Reglas de archivo
     // Validacion de extension
     $extAllowed = array('jpg');
     if (!in_array($extension, $extAllowed)) {
         return Response::json(array('status' => false, 'message' => 'Documento invalido Por Extension'));
     }
     // Validacion de mimetype
     $mimeAllowed = array('application/octet-stream', 'application/x-download', 'image/jpeg');
     if (!in_array($mimeType, $mimeAllowed)) {
         return Response::json(array('status' => false, 'message' => 'Documento invalido Por Mimetype'));
     }
     // Validacion de tamaño de archivo
     $maxFileSize = 1024 * 1024 * 20;
     // 5MB
     if ($OriginalFileSize > $maxFileSize) {
         return Response::json(array('status' => false, 'message' => 'El documento es demasiado grande'));
     }
     try {
         // Carga de documentos al servidor
         $uploadSuccess = $doc_file->move($tempPath, $HashfileName);
         if ($uploadSuccess) {
             //$tempExt = File::extension($tempPath . $HashfileName);
             //if($tempExt == 'jpg' || $tempExt == 'png')
             //{
             //File::copy($tempPath . $HashfileName, $destinationPath . 'Timeline'.date('Y-m-d').'.'.$tempExt);
             //$OriginalFileName = 'Timeline'.date('Y-m-d').'.'.$tempExt;
             //}
             //else
             //{
             File::copy($tempPath . $HashfileName, $destinationPath . $OriginalFileName);
             //}
             return Response::json(array('status' => true, 'message' => 'Archivo cargado exitosamente', 'original' => $OriginalFileName, 'original_size' => $OriginalFileSize, 'uploaded' => $HashfileName, 'path' => $destinationPath . $OriginalFileName), 200);
         } else {
             return Response::json(array('status' => false, 'message' => 'Error al cargar el documento al servidor'), 200);
         }
     } catch (Exception $e) {
         return Response::json(array('status' => false, 'message' => 'Error al cargar el documento al servidor [' . $e->getMessage() . ']'), 200);
     }
 }
Example #26
0
 /**
  * @param string $sourceImagePath Source image path
  * @param string $thumbName Thumbnail name
  * @param        $newFileName
  * @param null $width Desired width for resize
  * @param null $height Desired height for resize
  * @param string $resizeType Resize type
  * @param null $color
  * @return \Intervention\Image\Image
  */
 public function createThumbnail($sourceImagePath, $thumbName, $newFileName, $width = null, $height = null, $resizeType = 'crop', $color = null)
 {
     $image = Image::make($sourceImagePath);
     $width = !$width ? null : $width;
     $height = !$height ? null : $height;
     switch ($resizeType) {
         case 'crop':
             $image->fit($width, $height);
             break;
         case 'resize':
             $image->resize($width, $height, function ($constraint) {
                 $constraint->aspectRatio();
                 $constraint->upsize();
             });
             break;
         case 'fit':
             $image->resize($width, $height, function ($constraint) {
                 $constraint->aspectRatio();
             })->resizeCanvas($width, $height, 'center', false, $color);
     }
     $thumbnailPath = $this->getThumbnailPath($thumbName);
     if (!FileFacade::isDirectory($thumbnailPath)) {
         FileFacade::makeDirectory($thumbnailPath);
     }
     return $image->save($thumbnailPath . $newFileName);
 }
Example #27
0
 public static function getImageWineFromServer($user_id, $wine_unique_id, $image_url)
 {
     $destinationPath = public_path() . '/images/' . $user_id . '/wine/' . $wine_unique_id;
     if (File::isDirectory($destinationPath)) {
         $file = File::files($destinationPath);
         $image_paths = explode('/', $file[0]);
         $image_name = $image_paths[count($image_paths) - 1];
         $image_url = URL::asset('/images/' . $user_id . '/wine/' . $wine_unique_id . '/' . $image_name);
     } else {
         if ($image_url != null) {
             $image_url = URL::asset($image_url);
         }
     }
     return $image_url;
 }
 public function removeAssets()
 {
     $pasta = base_path() . "/resources/views/themes/linexti/assets/";
     if (\File::isDirectory($pasta)) {
         $success = \File::cleanDirectory($pasta);
         if ($success) {
             return 'sucesso';
         }
     } else {
         return 'diretoriovazio';
     }
 }
 /**
  * Handles a file instance while looping an tree of directories.
  * 
  * @param File $file File object reference
  * @param int $level Current level of tree parse
  * @return int State of what to do next can be CONTINUE, ABORT or ABORTFOLDER.
  */
 function handle($file, $level)
 {
     $toPath = $this->_destFile->getAbsolutePath();
     $toPath .= substr($file->getAbsolutePath(), strlen($this->_fromFile->getAbsolutePath()));
     $toFile = $this->_manager->getFile($toPath);
     // Do action
     if ($file->isDirectory()) {
         $toFile->mkdir();
     } else {
         $file->copyTo($toFile);
     }
     return $this->CONTINUE;
 }
Example #30
0
 /**
  * Clear Directory
  * @param string|array $directory
  */
 private function _clearDirectory($directory)
 {
     if (is_array($directory)) {
         $_directories = $directory;
         foreach ($_directories as $directory) {
             if (\File::isDirectory(public_path($directory))) {
                 \File::deleteDirectory(public_path($directory));
             }
             \File::makeDirectory(public_path($directory), 0777, true);
         }
     } elseif (is_string($directory)) {
         if (\File::isDirectory(public_path($directory))) {
             \File::deleteDirectory(public_path($directory));
         }
         \File::makeDirectory(public_path($directory), 0777, true);
     }
 }