當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。