本文整理匯總了PHP中Illuminate\Support\Facades\File::cleanDirectory方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::cleanDirectory方法的具體用法?PHP File::cleanDirectory怎麽用?PHP File::cleanDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\File
的用法示例。
在下文中一共展示了File::cleanDirectory方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$base_dir = storage_path() . '/flattnr';
if (!File::exists($base_dir)) {
$this->line("\nDirectory does not exist, please run artisan flattnr:storage to create it...");
} else {
$this->line("\nFlushing the Storage Directory...");
File::cleanDirectory($base_dir);
}
}
示例2: down
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::table('resources', function ($table) {
$table->dropIndex('search');
});
DB::table('permissions')->where('name', 'LIKE', 'resources.%')->delete();
Schema::drop('resource_tag');
Schema::drop('resources');
Schema::drop('resource_tags');
Schema::drop('resource_categories');
File::cleanDirectory(base_path('resources/resources'));
}
開發者ID:backstagetechnicalservices,項目名稱:website,代碼行數:16,代碼來源:2015_12_16_103730_create_resources_tables.php
示例3: import
public function import(Request $request)
{
$filePath = Session::pull('dataTransferResult.FilesPath');
$createdProductCategories = [];
$createdProductLines = [];
Excel::selectSheets('Категории')->load($filePath . '/products.xlsx', function ($reader) use($filePath, $createdProductCategories, $createdProductLines) {
foreach ($reader->toArray() as $row) {
if ($row['nomer'] == null) {
continue;
}
$productCategory = ProductCategory::findOrNew($row['nomer']);
if ($row['nomer'] > ProductCategory::max('id')) {
$imagePattern = '/img/product-category-' . $row['nomer'];
$findResults = File::glob($filePath . $imagePattern . '*');
$imageOriginalPath = $findResults[0];
$imageExt = File::extension($imageOriginalPath);
$imagePath = $filePath . $imagePattern . '.' . $imageExt;
$newImagePath = 'img/uploads/' . str_random(32) . '.' . $imageExt;
File::move($imagePath, public_path() . '/' . $newImagePath);
$productCategory->id = $row['nomer'];
$productCategory->title = $row['nazvanie'];
$productCategory->image = $newImagePath;
$createdProductCategories[$row['nomer']] = $productCategory;
$productCategory->save();
}
}
Excel::selectSheets('Линейки продукции')->load($filePath . '/products.xlsx', function ($reader) use($filePath, $createdProductCategories, $createdProductLines) {
foreach ($reader->toArray() as $row) {
if ($row['nomer'] == null) {
continue;
}
if ($row['nomer'] > ProductLine::max('id')) {
$imagePattern = '/img/product-line-' . $row['nomer'];
$findResults = File::glob($filePath . $imagePattern . '*');
$imageOriginalPath = $findResults[0];
$imageExt = File::extension($imageOriginalPath);
$imagePath = $filePath . $imagePattern . '.' . $imageExt;
$newImagePath = 'img/uploads/' . str_random(32) . '.' . $imageExt;
File::move($imagePath, public_path() . '/' . $newImagePath);
$createdProductLines[$row['nomer']] = ProductLine::create(['id' => $row['nomer'], 'product_category_id' => $row['kategoriya'], 'title' => $row['nazvanie'], 'image' => $newImagePath]);
}
}
Excel::selectSheets('Продукция')->load($filePath . '/products.xlsx', function ($reader) use($filePath, $createdProductCategories, $createdProductLines) {
foreach ($reader->toArray() as $row) {
if ($row['nomer'] == null) {
continue;
}
$imagePattern = '/img/product-' . $row['nomer'];
$findResults = File::glob($filePath . $imagePattern . '*');
$imageOriginalPath = $findResults[0];
$imageExt = File::extension($imageOriginalPath);
$imagePath = $filePath . $imagePattern . '.' . $imageExt;
$newImagePath = 'img/uploads/' . str_random(32) . '.' . $imageExt;
File::move($imagePath, public_path() . '/' . $newImagePath);
$productCategoryId = $row['kategoriya'] == null ? null : $row['kategoriya'];
$productLineId = $row['lineyka_produktsii'] == null ? null : $row['lineyka_produktsii'];
$product = new Product(['title' => $row['nazvanie'], 'image' => $newImagePath, 'rating' => $row['reyting']]);
if ($productCategoryId != null) {
if (array_key_exists(intval($row['kategoriya']), $createdProductCategories)) {
$product->productCategory()->associate($createdProductCategories[$row['kategoriya']]);
} else {
$product->productCategory()->associate(ProductCategory::find($productCategoryId));
}
}
if ($productLineId != null) {
if (array_key_exists(intval($row['lineyka_produktsii']), $createdProductLines)) {
$product->productLine()->associate($createdProductLines[$row['lineyka_produktsii']]);
} else {
$product->productLine()->associate(ProductLine::find([$row['lineyka_produktsii']]));
}
}
$product->save();
$imagePattern = '/img/product-' . $row['nomer'] . '-color-';
$findResults = File::glob($filePath . $imagePattern . '*');
foreach ($findResults as $findResult) {
$newImagePath = 'img/uploads/' . str_random(32) . '.' . $imageExt;
$colorCode = substr($findResult, strpos($findResult, 'color') + 6, strpos($findResult, '.') - strpos($findResult, 'color') - 6);
File::move($findResult, public_path() . '/' . $newImagePath);
$productColor = new ProductColor(['image' => $newImagePath]);
$colorNumber = substr($findResult, strpos($findResult, 'color') + 6, strpos($findResult, '.') - strpos($findResult, 'color') - 6);
$imagePattern = '/img/product-' . $row['nomer'] . '-image-' . $colorNumber;
$findProductColorImageResults = File::glob($filePath . $imagePattern . '*');
$productImagePath = '';
if (count($findProductColorImageResults) != 0) {
$imageOriginalPath = $findProductColorImageResults[0];
$productImagePath = 'img/uploads/' . str_random(32) . '.' . $imageExt;
File::move($imageOriginalPath, public_path() . '/' . $productImagePath);
}
$productColor->product_image = $productImagePath;
$productColor->product_id = $product->id;
$productColor->code = $colorCode;
$product->productColors()->save($productColor);
}
}
File::cleanDirectory(public_path() . '/resources/uploads/');
});
});
});
return redirect()->route('admin.dataTransfer.index');
}
示例4: setFolder
/**
* @return array
* @throws \Exception
*/
private function setFolder()
{
$rootFolder = base_path() . '/resources/measurements/';
$finished = File::get($rootFolder . 'finished.txt');
$current = $this->getNext($finished);
$folder = $rootFolder . 'session ' . $current . '/';
if (!File::exists($folder)) {
if (File::makeDirectory($folder)) {
throw new \Exception("Directory not created");
}
return array($rootFolder, $current, $folder);
} else {
if (!File::cleanDirectory($folder)) {
throw new \Exception("Directory not cleaned");
}
return array($rootFolder, $current, $folder);
}
}
示例5: getDatabaseDump
/**
* Get a dump of the db.
* @return string
* @throws Exception
* @throws \Exception
*/
protected function getDatabaseDump()
{
File::cleanDirectory(storage_path() . "/app/backups/");
$databaseBackupHandler = app()->make('Spatie\\Backup\\BackupHandlers\\Database\\DatabaseBackupHandler');
$filesToBeBackedUp = array();
$databases = ["games_old", "fitness_old", "food_old", "ifitness_logs", "games_logs", "PMSystem", "wwe_new", "mobile_support"];
foreach ($databases as $db) {
$newFile = storage_path() . "/app/backups/" . 'laravel-backup-db' . $db . uniqid();
touch($newFile);
$tempFile = $newFile;
$status = $databaseBackupHandler->getDatabase($db)->dump($tempFile);
if (!$status || filesize($tempFile) == 0) {
throw new \Exception('Could not create backup of db');
}
$filesToBeBackedUp[$db] = $tempFile;
$this->temporaryFiles[] = $tempFile;
}
if (count($filesToBeBackedUp) < 1) {
throw new \Exception('could not backup db');
}
$this->comment('Database dumped');
return $filesToBeBackedUp;
}
示例6: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('clipfile');
File::cleanDirectory('/web-storage/clipshare/static');
}
示例7: GetAidaImaginiPachete
public function GetAidaImaginiPachete($operator)
{
File::cleanDirectory("Pachete/{$operator}");
$pachete = Pachete::all()->lists('PackID');
// dd($AidaImgPachet);
foreach ($pachete as $pachet) {
$AidaImgPachet = Soap::AidaSoap($operator, 'PackDetails', ['AIDA_PackDetailsRQ' => ['Package' => ['ID' => $pachet]]])->Package->Picture;
if (@$AidaImgPachet->URL != null) {
$numefisier = parseurl($AidaImgPachet->URL, 'url');
Image::make(file_get_contents($AidaImgPachet->URL))->save("Pachete/{$operator}/{$numefisier}");
Pachete::where('PackID', $pachet)->update(['Picture' => $numefisier]);
}
// dd($AidaImgPachet);
}
echo 'Actualizare finalizata cu success. Puteti inchide fereastra.';
}