本文整理匯總了PHP中Illuminate\Support\Facades\File::deleteDirectory方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::deleteDirectory方法的具體用法?PHP File::deleteDirectory怎麽用?PHP File::deleteDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\File
的用法示例。
在下文中一共展示了File::deleteDirectory方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: folderDelete
/**
* Delete the folder with the given path
*
* @param string $folder
*
* @return boolean
* @throws DirectoryDoesNotExists
*/
public function folderDelete($folder)
{
if (!File::isDirectory($this->getPath($folder))) {
throw new DirectoryDoesNotExists();
}
return File::deleteDirectory($this->getPath($folder));
}
示例2: getSubmissionVerdict
public function getSubmissionVerdict($srcContent, $srcExt)
{
assert($srcExt == "cpp" || $srcExt == "java" || $srcExt == "py", "'Source code language must be C++, Java or Python'");
$judgingBaseFolder = '../judging/';
$submissionFolderName = uniqid();
$submissionFolder = "{$judgingBaseFolder}{$submissionFolderName}/";
// Write the source code file
$srcFpath = "{$submissionFolder}main.{$srcExt}";
File::makeDirectory($submissionFolder);
File::put($srcFpath, $srcContent);
// Create the required test case files
$caseNo = 1;
$testcases = $this->testcases()->get();
foreach ($testcases as $tc) {
$inFname = "test{$caseNo}.in";
$outFname = "test{$caseNo}.ans";
$inFpath = $submissionFolder . $inFname;
$outFpath = $submissionFolder . $outFname;
File::put($inFpath, $tc->input);
File::put($outFpath, $tc->output);
$caseNo += 1;
}
// Judge!
$judgingScript = "python \"{$judgingBaseFolder}judge.py\"";
$judgingArguments = sprintf('"%s" "%s" %d', $srcFpath, $submissionFolder, $this['time_limit']);
$judgeCommand = "{$judgingScript} {$judgingArguments}";
$verdict = shell_exec($judgeCommand);
// Clean-up the submission directory
File::deleteDirectory($submissionFolder);
return $verdict;
}
示例3: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('pictures');
//delete everything inside the images directory
$path = public_path() . '/content/images/';
File::deleteDirectory($path, true);
}
示例4: delete
/**
* @param $id
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function delete($id)
{
$news = News::find($id);
$deleteDir = File::deleteDirectory(base_path() . '/public/' . 'img/news/' . $news->id);
$news->delete();
Flash::success('Notícia deletada!');
return redirect(route('news.index'));
}
示例5: deletePhotosByUser
public static function deletePhotosByUser($userId)
{
$directory = "assets/images/_upload/fotos/" . $userId;
File::deleteDirectory($directory);
$finalists = Finalists::where('category', 'fotos')->get();
foreach ($finalists as $finalist) {
self::where('photosId', '=', $finalist->idCategory)->where('usersId', '=', $userId)->delete();
}
return self::where('usersId', $userId)->delete();
}
示例6: boot
public static function boot()
{
parent::boot();
static::deleted(function ($project) {
$path = public_path('files/projects/' . $project->id);
if (File::exists($path)) {
File::deleteDirectory($path);
}
});
}
示例7: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$this->info('Start housekeeping.');
$maxBuilds = intval($this->option('max-builds'));
$targetBuilds = $this->build->byGeneration($maxBuilds);
foreach ($targetBuilds as $targetBuild) {
$this->build->deleteById($targetBuild->id);
File::deleteDirectory(public_path($targetBuild->artifact));
}
$this->info('Finish housekeeping.');
}
示例8: removeRtmpServer
public static function removeRtmpServer($key)
{
$channel_records_path = $_ENV['CHANNEL_RECORDS_PATH'];
$app_conf_path = $_ENV['RTMP_APPS_CONF_PATH'];
if (is_dir($channel_records_path . $key)) {
File::deleteDirectory($channel_records_path . $key);
}
if (File::exists($app_conf_path . $key . '.conf')) {
File::delete($app_conf_path . $key . '.conf');
}
}
示例9: destroy
/**
* Remove the specified resource from storage.
*
* @param CategoryRequest $request
* @param $categoryId
* @return \Illuminate\Http\Response
*/
public function destroy(CategoryRequest $request, $categoryId)
{
$category = Category::findOrFail($categoryId);
$children = $category->getChildren();
foreach ($children as $child) {
File::deleteDirectory(public_path('images/categories/' . $child->id));
}
File::deleteDirectory(public_path('images/categories/' . $category->id));
$category->deleteSubtree(true);
return $this->response->noContent();
}
示例10: boot
/**
* Event to delete files in public/html folder
*
* @return void
*/
public static function boot()
{
parent::boot();
if (config('typicms.html_cache')) {
static::saved(function ($model) {
File::deleteDirectory(public_path() . '/html');
});
static::deleted(function ($model) {
File::deleteDirectory(public_path() . '/html');
});
}
}
示例11: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
switch ($this->argument('mode')) {
case 'build':
App::make('script-auto-compiler-l4')->build();
break;
case 'clear':
File::deleteDirectory(Config::get('script-auto-compiler-l4::config.tmp'));
break;
default:
break;
}
}
示例12: clean
/**
* Delete published assets
*
* @return void
*/
public function clean()
{
$assetsDir = public_path() . '/' . $this->config->get('asset::public_dir');
foreach (array_keys($this->processed) as $typeDir) {
File::deleteDirectory($assetsDir . '/' . $typeDir);
}
foreach ($this->getGroupNames('styles') as $group) {
Cache::forget('asset.styles.groups.' . $group);
}
foreach ($this->getGroupNames('scripts') as $group) {
Cache::forget('asset.scripts.groups.' . $group);
}
}
示例13: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('users')->delete();
User::create(array('firstname' => 'User', 'lastname' => 'Name', 'username' => 'username1', 'email' => 'user1@msn.com', 'password' => 'usernameone'));
// create directories //
// check to see if directory is created //
if (File::exists(public_path() . '/../storage/uploads')) {
File::deleteDirectory(public_path() . '/../storage/uploads');
}
File::makeDirectory(public_path() . '/../storage/uploads');
File::makeDirectory(public_path() . '/../storage/uploads/username1');
// chmod directory //
chmod("/../storage/uploads/username1", 777);
}
示例14: performConversions
/**
* Perform the given conversions for the given media.
*
* @param \Spatie\MediaLibrary\Conversion\ConversionCollection $conversions
* @param \Spatie\MediaLibrary\Media $media
*/
public function performConversions(ConversionCollection $conversions, Media $media)
{
$tempDirectory = $this->createTempDirectory();
$copiedOriginalFile = $tempDirectory . '/' . str_random(16) . '.' . $media->extension;
app(Filesystem::class)->copyFromMediaLibrary($media, $copiedOriginalFile);
if ($media->type == Media::TYPE_PDF) {
$copiedOriginalFile = $this->convertToImage($copiedOriginalFile);
}
foreach ($conversions as $conversion) {
$conversionResult = $this->performConversion($media, $conversion, $copiedOriginalFile);
$renamedFile = MediaLibraryFileHelper::renameInDirectory($conversionResult, $conversion->getName() . '.' . $conversion->getResultExtension(pathinfo($copiedOriginalFile, PATHINFO_EXTENSION)));
app(Filesystem::class)->copyToMediaLibrary($renamedFile, $media, 'conversions');
}
File::deleteDirectory($tempDirectory);
}
示例15: generateDocs
public static function generateDocs()
{
$appDir = config('swagger-lume.paths.annotations');
$docDir = config('swagger-lume.paths.docs');
if (!File::exists($docDir) || is_writable($docDir)) {
// delete all existing documentation
if (File::exists($docDir)) {
File::deleteDirectory($docDir);
}
File::makeDirectory($docDir);
$excludeDirs = config('swagger-lume.paths.excludes');
$swagger = \Swagger\scan($appDir, $excludeDirs);
$filename = $docDir . '/api-docs.json';
$swagger->saveAs($filename);
}
}