mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
update
This commit is contained in:
parent
1441eaa6e4
commit
f2f7dc815e
6 changed files with 82 additions and 32 deletions
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Microweber\App\Providers;
|
||||
|
||||
use App\Events\DomainIsChanged;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Modules\Microweber\Listeners\DomainIsChangedListener;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event to listener mappings for the application.
|
||||
*
|
||||
* @var array<class-string, array<int, class-string>>
|
||||
*/
|
||||
|
||||
protected $listen = [
|
||||
DomainIsChanged::class => [
|
||||
DomainIsChangedListener::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*/
|
||||
public function shouldDiscoverEvents(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -47,6 +47,7 @@ class MicroweberServiceProvider extends ServiceProvider
|
|||
});
|
||||
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
|
||||
app()->backupManager->registerConfig(MicroweberBackupConfig::class, $this->moduleNameLower);
|
||||
app()->virtualHostManager->registerConfig(MicroweberApacheVirtualHostConfig::class, $this->moduleNameLower);
|
||||
|
|
38
web/Modules/Microweber/Listeners/DomainIsChangedListener.php
Normal file
38
web/Modules/Microweber/Listeners/DomainIsChangedListener.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Microweber\Listeners;
|
||||
|
||||
use App\Events\DomainIsChanged;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Modules\Microweber\App\Models\MicroweberInstallation;
|
||||
|
||||
class DomainIsChangedListener
|
||||
{
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*/
|
||||
public function handle(DomainIsChanged $event): void
|
||||
{
|
||||
if (!isset($event->domain->id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$findMicroweberInstallation = MicroweberInstallation::where('domain_id', $event->domain->id)->first();
|
||||
if (!$findMicroweberInstallation) {
|
||||
return;
|
||||
}
|
||||
|
||||
shell_exec('php '. $findMicroweberInstallation->installation_path . '/artisan cache:clear');
|
||||
|
||||
}
|
||||
}
|
|
@ -14,12 +14,14 @@ class DomainIsChanged
|
|||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $domain;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($domain)
|
||||
{
|
||||
//
|
||||
$this->domain = $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\DomainIsChanged;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class DomainIsChangedListener
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*/
|
||||
public function handle(DomainIsChanged $event): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -34,10 +34,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
],
|
||||
ModelPhyreServerCreated::class => [
|
||||
ModelPhyreServerCreatedListener::class,
|
||||
],
|
||||
DomainIsChanged::class => [
|
||||
DomainIsChangedListener::class,
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue