当前位置: 首页>>代码示例>>PHP>>正文


PHP File::deleteDirectory方法代码示例

本文整理汇总了PHP中File::deleteDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP File::deleteDirectory方法的具体用法?PHP File::deleteDirectory怎么用?PHP File::deleteDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在File的用法示例。


在下文中一共展示了File::deleteDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteDirectory

 /**
  * Check if a directory exists, if so delete it
  * @param string $model
  */
 public static function deleteDirectory($model)
 {
     $path = public_path('assets/img/' . $model->getTable() . '/' . $model->id);
     if (\File::exists($path)) {
         \File::deleteDirectory(public_path($path));
     }
 }
开发者ID:jmagrippis,项目名称:magrippis,代码行数:11,代码来源:AppServiceProvider.php

示例2: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::drop('users');
     //delete everything inside the profile pictures directory
     $path = public_path() . '/content/profile_pictures/';
     File::deleteDirectory($path, true);
 }
开发者ID:elvinmakhmudov,项目名称:shopping.app,代码行数:12,代码来源:2014_10_12_000000_create_users_table.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     if (File::isDirectory('packages')) {
         File::deleteDirectory('packages');
     }
 }
开发者ID:kun391,项目名称:laravel-generator,代码行数:7,代码来源:TestCase.php

示例4: tearDown

 public function tearDown()
 {
     parent::tearDown();
     $this->userFileStorage = null;
     File::deleteDirectory($this->tmpDir);
     File::cleanDirectory($this->storageDir);
 }
开发者ID:ysaroka,项目名称:uploader,代码行数:7,代码来源:UserFileStorageTest.php

示例5: fire

 public function fire()
 {
     $options = $this->option();
     $this->seed_path = storage_path('seeder');
     Asset::setFromSeed(true);
     // -------------------------------------
     if (is_true($options['reset'])) {
         if (Config::getEnvironment() == 'production') {
             $really = $this->confirm('This is the *** PRODUCTION *** server are you sure!? [yes|no]');
             if (!$really) {
                 $this->info("**** Exiting ****");
                 exit;
             }
         }
         if (!File::exists($this->seed_path)) {
             File::makeDirectory($this->seed_path);
             $n = 50;
             for ($i = 1; $i <= $n; $i++) {
                 $gender_types = ['men', 'women'];
                 foreach ($gender_types as $gender) {
                     $user_photo_url = "http://api.randomuser.me/portraits/{$gender}/{$i}.jpg";
                     File::put($this->seed_path . "/{$gender}_{$i}.jpg", file_get_contents($user_photo_url));
                 }
                 $this->info("Cache user seed image - {$i}");
             }
         }
         if ($this->confirm('Do you really want to delete the tables? [yes|no]')) {
             // first delete all assets
             if (Schema::hasTable('assets')) {
                 foreach (Asset::all() as $asset) {
                     $asset->delete();
                 }
             }
             $name = $this->call('migrate');
             $name = $this->call('migrate:reset');
             File::deleteDirectory(public_path('assets/content/users'));
             $this->info('--- Halp has been reset ---');
         }
         Auth::logout();
         $this->setupDatabases();
         return;
     }
     // -------------------------------------
     if (is_true($options['setup'])) {
         $this->setupDatabases();
     }
     // -------------------------------------
     if ($options['seed'] == 'all') {
         $this->seed();
     }
     if ($options['seed'] == 'users') {
         $this->seedUsers();
     }
     if ($options['seed'] == 'tasks') {
         $this->seedTasks();
     }
     if ($options['seed'] == 'projects') {
         $this->seedProjects();
     }
 }
开发者ID:vanderlin,项目名称:halp,代码行数:60,代码来源:SetupSite.php

示例6: testDirectoryCreation

 public function testDirectoryCreation()
 {
     \File::deleteDirectory(storage_path(Jboysen\LaravelGcc\GCCompiler::STORAGE));
     $this->assertFalse(file_exists(storage_path(Jboysen\LaravelGcc\GCCompiler::STORAGE)));
     $this->createApplication();
     $this->assertTrue(file_exists(storage_path(Jboysen\LaravelGcc\GCCompiler::STORAGE)));
 }
开发者ID:jboysen,项目名称:laravel-gcc,代码行数:7,代码来源:TestServiceProvider.php

示例7: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     //borrramos generaciones previas
     File::deleteDirectory(app_path('modelos_generados'));
     //creamos el directorio en app..
     File::makeDirectory(app_path('modelos_generados'), 777);
     $tablas = SchemaHelper\Table::getTablesCurrentDatabase();
     $this->info("Buscando tablas..");
     foreach ($tablas as $tabla) {
         $this->info("Generando Modelo de la tabla: " . $tabla->table_name);
         //class name
         $class_name = ucfirst(camel_case(str_singular_spanish($tabla->table_name)));
         $baseString = File::get(app_path('models/Schema/Template.txt'));
         //replace class name..
         $baseString = str_replace('@class_name@', $class_name, $baseString);
         //replace table name..
         $baseString = str_replace('@table_name@', $tabla->table_name, $baseString);
         //replace pretty name..
         $baseString = str_replace('@pretty_name@', $tabla->table_name, $baseString);
         //find columns.
         $columns = $tabla->columns()->whereNotIn('column_name', static::$common_hidden)->get();
         //generate fillable
         $baseString = str_replace('@fillable@', $this->generarFillable($columns), $baseString);
         //generate pretty fields string.
         $baseString = str_replace('@pretty_fields@', $this->generarPrettyFields($columns), $baseString);
         //generate rules..
         $baseString = str_replace('@rules@', $this->genenarRules($columns), $baseString);
         //generate belongs to..
         $baseString = str_replace('@belongs_to@', $this->generarBelongsTo($columns), $baseString);
         File::put(app_path('modelos_generados/' . $class_name . '.php'), $baseString);
     }
     $this->info("Generación terminada.");
 }
开发者ID:richarrieta,项目名称:miequipo,代码行数:38,代码来源:GenerarModelos.php

示例8: download

 /**
  * Download the module from an url
  *
  * @param $url
  * @param $dest
  * @return bool
  */
 public static function download($url, $name, $dest = null)
 {
     if ($dest == null) {
         $dest = \Module::getPath();
     }
     $tmpName = date($name . '-Ymdhis.zip');
     $result = file_put_contents(__DIR__ . "/" . $tmpName, fopen($url, 'r'));
     if ($result) {
         $zip = new ZipArchive();
         if ($zip->open(__DIR__ . "/" . $tmpName) === true) {
             $destFolder = $dest . '/' . $name;
             $oldFolder = "";
             if (is_dir($destFolder)) {
                 $oldFolder = $destFolder . '-old';
                 if (is_dir($oldFolder)) {
                     \File::deleteDirectory($oldFolder);
                 }
                 rename($destFolder, $oldFolder);
             }
             $tmpFolder = $dest . '/' . $name . '-tmp';
             $zip->extractTo($tmpFolder);
             $zip->close();
             $file = glob($tmpFolder . '/*');
             $result = rename($file[0], $destFolder);
             \File::deleteDirectory($tmpFolder);
             if ($result) {
                 \File::deleteDirectory($oldFolder);
             }
             return $result;
         } else {
             return false;
         }
     }
     return false;
 }
开发者ID:php-arx,项目名称:arxmin,代码行数:42,代码来源:Module.php

示例9: upload

 protected function upload()
 {
     $validator = $this->fileValidator(Input::all());
     if ($validator->passes()) {
         if ($this->_user->download_count) {
             \Excel::selectSheetsByIndex(0)->load(Input::get('file'), function ($reader) {
                 $finalHtml = '';
                 $currentTime = date('d-m-Y_His');
                 mkdir($currentTime);
                 foreach ($reader->toArray() as $row) {
                     $html = "\n\t\t\t<style>\n\t\t\t\t.page-break {\n\t    \t\t\tpage-break-after: always;\n\t\t\t\t}\n\t\t\t\t.outer-container {\n\t\t\t\t\tmargin: 0% auto;\n\t\t\t\t\tborder: 1px solid black;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t\theight: 99%;\n\t\t\t\t}\n\t\t\t\t.subject-container {\n\t\t\t\t\tfont-weight: bold;\n\t\t\t\t\tmargin-top: 30px;\n\t\t\t\t}\n\t\t\t\t.content-container {\n\t\t\t\t\ttext-align: left;\n\t\t\t\t\tpadding: 10px;\n\t\t\t\t\tmargin-top: 50px;\n\t\t\t\t}\n\t\t\t\tol {\n\t\t\t\t\ttext-align: left;\n\t\t\t\t}\n\t\t\t\tol li{\n\t\t\t\t\tpadding-bottom: 40px;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class='outer-container'>\n\t\t\t\t\n\t\t\t \t\t<p class='subject-container'>Subject: NOTICE UNDER SECTION 138 OF NEGOTIABLE INSTRUMENT ACT READ WITH SECTION 420 OF INDIAN PENAL CODE</p>\n\n\t\t\t\t\t<p class='content-container'>\n\t\t\t\t\t\tOn behalf of and under instructions of my client <u>{$row['name']}</u> S/o__________ R/o __________ (hereinafter referred to as &quot;my client&quot;). I do hereby serve you with the following legal notice:\n\n\t\t\t\t\t\t<ol>\n\t\t\t\t\t\t\t<li>That my client, an engineering student, while looking for job paid Rs {$row['amount']} to you for assured placement in an MNC, last year.</li>\n\t\t\t\t\t\t\t<li>That thereafter my client issued a number of reminders to you for placement, but still no opportunity was provided to him, i.e. as you were unable to fulfill the promise as to placement of my client. Therefore, it was decided between you and my client that the amount of Rs {$row['amount']} should be refunded and as a result you issued him a cheque no {$row['cheque_number']} dated {$row['cheque_date']}.</li>\n\t\t\t\t\t\t\t<li>That the said cheque was presented by my client to State Bank of India, Noida for credit in his account in the month of December 2011 itself, but it bounced due to insufficient funds. And my client contacted you and was assured of cash in lieu of bounced cheque, therefore, my client did not take legal action earlier. My client thereafter again requested many a time to you for the payment of the said cheque amount by telephone and/or through personal visit of his representative, but in vain.</li>\n\t\t\t\t\t\t\t<li>That in April 2012, my client again tried depositing the cheque with State Bank of India, Mysore but it was again returned as unpaid with remarks &#45; Funds Insufficient, vide Syndicate Bank memo dated 19 April 2012.</li>\n\t\t\t\t\t\t\t<li>That in the facts and circumstances created by you my above said client left with no alternative except to serve you the present notice and calling upon all of you to make the payment of the above mentioned cheque amount totaling Rs {$row['amount']}/- (Rupees Ten Thousand only) including bouncing charges in cash with interest @ 24% per annum within 15 days of the receipt of this notice failing which my client shall be constrained to institute against you a criminal complaint under section 138 of the Negotiable Instrument Act read with section 420 of IPC where under you could be sentenced to undergo imprisonment of the two years and also pay the fine equivalent of the double amount of the above mentioned cheque as well as legal charges of this notice of Rs 2100/-</li>\n\t\t\t\t\t\t\t<li>That a copy of this notice retained in my office for further reference /record and legal action.</li>\n\t\t\t\t\t\t</ol>\n\t\t\t\t\t</p>\n\t\t\t</div>";
                     $finalHtml .= $html . "<div class='page-break'></div>";
                     \PDF::loadHTML($html)->setPaper('a4')->setOrientation('portrait')->setWarnings(false)->save($currentTime . '/' . $row["name"] . '_' . $row['cheque_number'] . '.pdf');
                 }
                 \PDF::loadHTML($finalHtml)->setPaper('a4')->setOrientation('portrait')->setWarnings(false)->save($currentTime . '/' . $currentTime . '.pdf');
                 // Here we choose the folder which will be used.
                 $dirName = public_path() . '/' . $currentTime;
                 // Choose a name for the archive.
                 $zipFileName = $this->_user->email . '_' . $currentTime . '.zip';
                 // Create ".zip" file in public directory of project.
                 $zip = new ZipArchive();
                 if ($zip->open(public_path() . '/' . $zipFileName, ZipArchive::CREATE) === TRUE) {
                     // Copy all the files from the folder and place them in the archive.
                     foreach (glob($dirName . '/*') as $fileName) {
                         $file = basename($fileName);
                         $zip->addFile($fileName, $file);
                     }
                     $zip->close();
                     $headers = array('Content-Type' => 'application/octet-stream');
                 } else {
                     echo 'failed';
                 }
                 $filename = $this->_user->email . '_' . $currentTime . '.zip';
                 $filepath = $_SERVER["DOCUMENT_ROOT"];
                 ob_start();
                 // http headers for zip downloads
                 header("Pragma: public");
                 header("Expires: 0");
                 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                 header("Cache-Control: public");
                 header("Content-Description: File Transfer");
                 header("Content-type: application/octet-stream");
                 header("Content-Disposition: attachment; filename=\"" . $filename . "\"");
                 header("Content-Transfer-Encoding: binary");
                 header("Content-Length: " . filesize($filepath . "/" . $filename));
                 @readfile($filepath . "/" . $filename);
                 ob_end_flush();
                 \File::deleteDirectory($currentTime);
                 \File::delete($this->_user->email . '_' . $currentTime . '.zip');
                 // reader methods
                 $this->_user->download_count = $this->_user->download_count - 1;
                 $this->_user->save();
             });
         } else {
             return Redirect::to("home")->with('message', 'Your maximum download limit 3, exceeded in beta version.  Please subscribe to use this feature.');
         }
     }
     return Redirect::to("home")->withErrors($validator->messages());
 }
开发者ID:naren2vsocialize,项目名称:vehelpers,代码行数:59,代码来源:HomeController.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     if (File::exists($this->tempDirectory)) {
         File::deleteDirectory($this->tempDirectory);
     }
     File::makeDirectory($this->tempDirectory);
 }
开发者ID:andywer,项目名称:larablob,代码行数:8,代码来源:TestCase.php

示例11: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  PhotosRequest  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(PhotosRequest $request, $id)
 {
     //
     $imageDir = storage_path('app') . '/img/photos/' . $id;
     \File::cleanDirectory($imageDir);
     \File::deleteDirectory($imageDir);
     Photos::find($id)->delete();
     return \Redirect::back()->with('message', 'Fotoğraf Silindi!');
 }
开发者ID:karpuzkan,项目名称:laravel,代码行数:16,代码来源:PhotosController.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  GalleryCategory $category
  * @return Response
  */
 public function destroy(GalleryCategory $category)
 {
     \File::deleteDirectory(config('gallery.gallery_path') . '/' . $category->id . '/');
     $category->delete();
     if (\Request::ajax()) {
         return '';
     }
     return redirect()->route('admin.gallery.index');
 }
开发者ID:n1n7axiii,项目名称:laravel-gallery,代码行数:15,代码来源:GalleryAdminCategoryController.php

示例13: cleanup

 private function cleanup($requestId)
 {
     $dirs = \File::directories(self::DIR);
     foreach ($dirs as $dir) {
         if (strpos($dir, $requestId) !== false) {
             continue;
         }
         \File::deleteDirectory($dir);
     }
 }
开发者ID:SimZal,项目名称:laracrawl,代码行数:10,代码来源:CompareController.php

示例14: remove

 public function remove($id)
 {
     $upload = Upload::findOrFail($id);
     if (!$upload->canDelete()) {
         return $this->_access_denied();
     }
     File::deleteDirectory($upload->path);
     $upload->delete();
     return Redirect::back()->with('notification:success', $this->deleted_message);
 }
开发者ID:k4ml,项目名称:laravel-base,代码行数:10,代码来源:UploadsController.php

示例15: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     require __DIR__ . '/routes.php';
     $this->loadViewsFrom(__DIR__ . '/views', 'blog');
     $this->publishes([__DIR__ . '/config/blog.php' => config_path('blog.php'), __DIR__ . '/views' => base_path('resources/views/vendor/blog'), __DIR__ . '/database/migrations' => database_path('/migrations')]);
     if (glob(__DIR__ . '/model/publish/*.php')) {
         $this->publishes([__DIR__ . '/model/publish' => app_path('/')]);
         \File::deleteDirectory(__DIR__ . '/model/publish/', true);
     }
 }
开发者ID:n1n7axiii,项目名称:laravel-blog,代码行数:15,代码来源:BlogServiceProvider.php


注:本文中的File::deleteDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。