Merge pull request #3092 from CachetHQ/replace-graham-campbell-core
Replace GrahamCampbell/Core
This commit is contained in:
76
app/Console/Commands/AppInstallCommand.php
Normal file
76
app/Console/Commands/AppInstallCommand.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
/**
|
||||
* This is the app install command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class AppInstallCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:install';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Installs the application';
|
||||
|
||||
/**
|
||||
* The events instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Events\Dispatcher
|
||||
*/
|
||||
protected $events;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Dispatcher $events)
|
||||
{
|
||||
$this->events = $events;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->events->fire('command.installing', $this);
|
||||
$this->events->fire('command.generatekey', $this);
|
||||
$this->events->fire('command.cacheconfig', $this);
|
||||
$this->events->fire('command.cacheroutes', $this);
|
||||
$this->events->fire('command.publishvendors', $this);
|
||||
$this->events->fire('command.runmigrations', $this);
|
||||
$this->events->fire('command.runseeding', $this);
|
||||
$this->events->fire('command.updatecache', $this);
|
||||
$this->events->fire('command.linkstorage', $this);
|
||||
$this->events->fire('command.extrastuff', $this);
|
||||
$this->events->fire('command.installed', $this);
|
||||
}
|
||||
}
|
||||
76
app/Console/Commands/AppResetCommand.php
Normal file
76
app/Console/Commands/AppResetCommand.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
/**
|
||||
* This is the app reset command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class AppResetCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:reset';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Resets and installs the application';
|
||||
|
||||
/**
|
||||
* The events instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Events\Dispatcher
|
||||
*/
|
||||
protected $events;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Dispatcher $events)
|
||||
{
|
||||
$this->events = $events;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->events->fire('command.resetting', $this);
|
||||
$this->events->fire('command.generatekey', $this);
|
||||
$this->events->fire('command.cacheconfig', $this);
|
||||
$this->events->fire('command.cacheroutes', $this);
|
||||
$this->events->fire('command.publishvendors', $this);
|
||||
$this->events->fire('command.resetmigrations', $this);
|
||||
$this->events->fire('command.runmigrations', $this);
|
||||
$this->events->fire('command.runseeding', $this);
|
||||
$this->events->fire('command.updatecache', $this);
|
||||
$this->events->fire('command.extrastuff', $this);
|
||||
$this->events->fire('command.reset', $this);
|
||||
}
|
||||
}
|
||||
73
app/Console/Commands/AppUpdateCommand.php
Normal file
73
app/Console/Commands/AppUpdateCommand.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
/**
|
||||
* This is the app update command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class AppUpdateCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:update';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Updates the application';
|
||||
|
||||
/**
|
||||
* The events instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Events\Dispatcher
|
||||
*/
|
||||
protected $events;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Dispatcher $events)
|
||||
{
|
||||
$this->events = $events;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->events->fire('command.updating', $this);
|
||||
$this->events->fire('command.cacheconfig', $this);
|
||||
$this->events->fire('command.cacheroutes', $this);
|
||||
$this->events->fire('command.publishvendors', $this);
|
||||
$this->events->fire('command.runmigrations', $this);
|
||||
$this->events->fire('command.updatecache', $this);
|
||||
$this->events->fire('command.extrastuff', $this);
|
||||
$this->events->fire('command.updated', $this);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Console;
|
||||
|
||||
use CachetHQ\Cachet\Console\Commands\AppInstallCommand;
|
||||
use CachetHQ\Cachet\Console\Commands\AppResetCommand;
|
||||
use CachetHQ\Cachet\Console\Commands\AppUpdateCommand;
|
||||
use CachetHQ\Cachet\Console\Commands\BeaconCommand;
|
||||
use CachetHQ\Cachet\Console\Commands\DemoMetricPointSeederCommand;
|
||||
use CachetHQ\Cachet\Console\Commands\DemoSeederCommand;
|
||||
@@ -34,6 +37,9 @@ class Kernel extends ConsoleKernel
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
AppInstallCommand::class,
|
||||
AppResetCommand::class,
|
||||
AppUpdateCommand::class,
|
||||
BeaconCommand::class,
|
||||
DemoMetricPointSeederCommand::class,
|
||||
DemoSeederCommand::class,
|
||||
|
||||
@@ -69,6 +69,15 @@ class CommandSubscriber
|
||||
$events->listen('command.installing', __CLASS__.'@fireInstallingCommand', 5);
|
||||
$events->listen('command.updating', __CLASS__.'@fireUpdatingCommand', 5);
|
||||
$events->listen('command.resetting', __CLASS__.'@fireResettingCommand', 5);
|
||||
$events->listen('command.generatekey', __CLASS__.'@onGenerateKey');
|
||||
$events->listen('command.cacheconfig', __CLASS__.'@onCacheConfig');
|
||||
$events->listen('command.cacheroutes', __CLASS__.'@onCacheRoutes');
|
||||
$events->listen('command.publishvendors', __CLASS__.'@onPublishVendors');
|
||||
$events->listen('command.resetmigrations', __CLASS__.'@onResetMigrations');
|
||||
$events->listen('command.runmigrations', __CLASS__.'@onRunMigrations');
|
||||
$events->listen('command.runseeding', __CLASS__.'@onRunSeeding');
|
||||
$events->listen('command.linkstorage', __CLASS__.'@onLinkStorage');
|
||||
$events->listen('command.updatecache', __CLASS__.'@onUpdateCache');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,4 +167,116 @@ class CommandSubscriber
|
||||
|
||||
$command->line('Backup completed!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a command.generatekey event.
|
||||
*
|
||||
* @param \Illuminate\Console\Command $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onGenerateKey(Command $command)
|
||||
{
|
||||
$command->call('key:generate');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a command.cacheconfig event.
|
||||
*
|
||||
* @param \Illuminate\Console\Command $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onCacheConfig(Command $command)
|
||||
{
|
||||
$command->call('config:cache');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a command.cacheroutes event.
|
||||
*
|
||||
* @param \Illuminate\Console\Command $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onCacheRoutes(Command $command)
|
||||
{
|
||||
$command->call('route:cache');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a command.publishvendors event.
|
||||
*
|
||||
* @param \Illuminate\Console\Command $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onPublishVendors(Command $command)
|
||||
{
|
||||
$command->call('vendor:publish');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a command.resetmigrations event.
|
||||
*
|
||||
* @param \Illuminate\Console\Command $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onResetMigrations(Command $command)
|
||||
{
|
||||
$command->call('migrate:reset', ['--force' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a command.runmigrations event.
|
||||
*
|
||||
* @param \Illuminate\Console\Command $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onRunMigrations(Command $command)
|
||||
{
|
||||
$command->call('migrate', ['--force' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a command.runseeding event.
|
||||
*
|
||||
* @param \Illuminate\Console\Command $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onRunSeeding(Command $command)
|
||||
{
|
||||
$command->call('db:seed', ['--force' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a command.linkstorage event.
|
||||
*
|
||||
* @param \Illuminate\Console\Command $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onLinkStorage(Command $command)
|
||||
{
|
||||
if ($command->getApplication()->has('storage:link')) {
|
||||
$command->call('storage:link');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a command.updatecache event.
|
||||
*
|
||||
* @param \Illuminate\Console\Command $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onUpdateCache(Command $command)
|
||||
{
|
||||
$command->line('Clearing cache...');
|
||||
$command->call('cache:clear');
|
||||
$command->info('Cache cleared!');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user