mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
update
This commit is contained in:
parent
58856b8ae4
commit
909ed5ba70
5 changed files with 81 additions and 0 deletions
|
@ -10,6 +10,7 @@ use Illuminate\Support\ServiceProvider;
|
|||
use Modules\Microweber\App\Console\Commands\RunDomainRepair;
|
||||
use Modules\Microweber\Listeners\DomainIsCreatedListener;
|
||||
use Modules\Microweber\MicroweberApacheVirtualHostConfig;
|
||||
use Modules\Microweber\MicroweberBackupConfig;
|
||||
|
||||
class MicroweberServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -47,6 +48,7 @@ class MicroweberServiceProvider extends ServiceProvider
|
|||
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
|
||||
app()->backupManager->registerConfig(MicroweberBackupConfig::class, $this->moduleNameLower);
|
||||
app()->virtualHostManager->registerConfig(MicroweberApacheVirtualHostConfig::class, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
|
|
17
web/Modules/Microweber/MicroweberBackupConfig.php
Normal file
17
web/Modules/Microweber/MicroweberBackupConfig.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Microweber;
|
||||
|
||||
use App\Backup\Abstract\BackupConfigBase;
|
||||
|
||||
class MicroweberBackupConfig extends BackupConfigBase
|
||||
{
|
||||
public array $excludePaths = [
|
||||
'/storage/framework/cache',
|
||||
'/storage/framework/views',
|
||||
'/userfiles/cache',
|
||||
'/userfiles/media/thumbnails',
|
||||
'/storage/framework/sessions',
|
||||
];
|
||||
|
||||
}
|
17
web/app/Backup/Abstract/BackupConfigBase.php
Normal file
17
web/app/Backup/Abstract/BackupConfigBase.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Backup\Abstract;
|
||||
|
||||
abstract class BackupConfigBase
|
||||
{
|
||||
public array $excludePaths = [
|
||||
];
|
||||
|
||||
public function getConfig()
|
||||
{
|
||||
$configValues = [];
|
||||
$configValues['excludePaths'] = $this->excludePaths;
|
||||
|
||||
return $configValues;
|
||||
}
|
||||
}
|
44
web/app/Backup/BackupManager.php
Normal file
44
web/app/Backup/BackupManager.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace App\Backup;
|
||||
|
||||
class BackupManager
|
||||
{
|
||||
public $registerConfigs = [];
|
||||
|
||||
public function registerConfig($config, $module = null)
|
||||
{
|
||||
$this->registerConfigs[$module][] = $config;
|
||||
}
|
||||
|
||||
public function getConfigs($forModules = [])
|
||||
{
|
||||
$allConfigs = [];
|
||||
foreach ($this->registerConfigs as $module => $configs) {
|
||||
if (empty($forModules)) {
|
||||
continue;
|
||||
}
|
||||
if (! in_array($module, $forModules)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($configs as $config) {
|
||||
try {
|
||||
$registerConfigInstance = app()->make($config);
|
||||
$getConfig = $registerConfigInstance->getConfig();
|
||||
if (! empty($getConfig)) {
|
||||
foreach ($getConfig as $key => $value) {
|
||||
if (! isset($allConfigs[$key])) {
|
||||
$allConfigs[$key] = [];
|
||||
}
|
||||
$allConfigs[$key] = array_merge($allConfigs[$key], $value);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// can't create instance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $allConfigs;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ namespace App;
|
|||
use Illuminate\Foundation\Application;
|
||||
|
||||
/**
|
||||
* @property \App\Backup\BackupManager $backupManager
|
||||
* @property \App\VirtualHosts\ApacheVirtualHostManager $virtualHostManager
|
||||
*/
|
||||
class PhyreLaravelApplication extends Application
|
||||
|
|
Loading…
Reference in a new issue