From 3e3e0633dfb5bdfd9049f4f318092a57dc2de03e Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Tue, 30 Apr 2024 18:03:36 +0300 Subject: [PATCH] update --- web/app/Actions/ApacheWebsiteDelete.php | 4 ++++ web/app/Models/Domain.php | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/web/app/Actions/ApacheWebsiteDelete.php b/web/app/Actions/ApacheWebsiteDelete.php index d705c54..6280cb9 100644 --- a/web/app/Actions/ApacheWebsiteDelete.php +++ b/web/app/Actions/ApacheWebsiteDelete.php @@ -15,6 +15,10 @@ class ApacheWebsiteDelete public function handle() { + if (empty($this->domain)) { + return false; + } + $apacheConf = '/etc/apache2/sites-available/'.$this->domain.'.conf'; shell_exec('rm -rf '.$apacheConf); diff --git a/web/app/Models/Domain.php b/web/app/Models/Domain.php index 92322d7..427afa3 100644 --- a/web/app/Models/Domain.php +++ b/web/app/Models/Domain.php @@ -92,7 +92,11 @@ class Domain extends Model static::deleting(function ($model) { - ShellApi::exec('rm -rf '.$model->domain_public); + if (empty($model->domain_public)) { + return; + } + + shell_exec('rm -rf '.$model->domain_public); $deleteApacheWebsite = new ApacheWebsiteDelete(); $deleteApacheWebsite->setDomain($model->domain);