Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial support of laravel 6 #75

Open
wants to merge 8 commits into
base: 2.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ You can now [join our Slack community!](http://cachethq-slack.herokuapp.com)

## Requirements

- PHP 7.1.3 – 7.3
- PHP 7.3 − 8.0
- HTTP server with PHP support (e.g.: Apache, Nginx, Caddy)
- [Composer](https://getcomposer.org)
- A supported database: MySQL, PostgreSQL or SQLite
Expand Down
22 changes: 11 additions & 11 deletions app/Console/Commands/AppResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ public function __construct(Dispatcher $events)
*/
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);
$this->events->dispatch('command.resetting', $this);
$this->events->dispatch('command.generatekey', $this);
$this->events->dispatch('command.cacheconfig', $this);
$this->events->dispatch('command.cacheroutes', $this);
$this->events->dispatch('command.publishvendors', $this);
$this->events->dispatch('command.resetmigrations', $this);
$this->events->dispatch('command.runmigrations', $this);
$this->events->dispatch('command.runseeding', $this);
$this->events->dispatch('command.updatecache', $this);
$this->events->dispatch('command.extrastuff', $this);
$this->events->dispatch('command.reset', $this);
}
}
16 changes: 8 additions & 8 deletions app/Console/Commands/AppUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public function __construct(Dispatcher $events)
*/
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);
$this->events->dispatch('command.updating', $this);
$this->events->dispatch('command.cacheconfig', $this);
$this->events->dispatch('command.cacheroutes', $this);
$this->events->dispatch('command.publishvendors', $this);
$this->events->dispatch('command.runmigrations', $this);
$this->events->dispatch('command.updatecache', $this);
$this->events->dispatch('command.extrastuff', $this);
$this->events->dispatch('command.updated', $this);
}
}
22 changes: 11 additions & 11 deletions app/Console/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ public function handle()

$this->line('Installing Cachet...');

$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);
$this->events->dispatch('command.installing', $this);
$this->events->dispatch('command.generatekey', $this);
$this->events->dispatch('command.cacheconfig', $this);
$this->events->dispatch('command.cacheroutes', $this);
$this->events->dispatch('command.publishvendors', $this);
$this->events->dispatch('command.runmigrations', $this);
$this->events->dispatch('command.runseeding', $this);
$this->events->dispatch('command.updatecache', $this);
$this->events->dispatch('command.linkstorage', $this);
$this->events->dispatch('command.extrastuff', $this);
$this->events->dispatch('command.installed', $this);

$this->info('Cachet is installed ⚡');
}
Expand Down
28 changes: 19 additions & 9 deletions app/Exceptions/Displayers/JsonValidationDisplayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@
namespace CachetHQ\Cachet\Exceptions\Displayers;

use AltThree\Validator\ValidationException;
use Exception;
use GrahamCampbell\Exceptions\Displayers\DisplayerInterface;
use GrahamCampbell\Exceptions\Displayers\JsonDisplayer;
use Throwable;
use GrahamCampbell\Exceptions\Displayer\DisplayerInterface;
use GrahamCampbell\Exceptions\Displayer\AbstractJsonDisplayer;
use Symfony\Component\HttpFoundation\JsonResponse;

class JsonValidationDisplayer extends JsonDisplayer implements DisplayerInterface
class JsonValidationDisplayer extends AbstractJsonDisplayer implements DisplayerInterface
{
/**
* Get the error response associated with the given exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @param string $id
* @param int $code
* @param string[] $headers
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display(Exception $exception, string $id, int $code, array $headers)
public function display(Throwable $exception, string $id, int $code, array $headers)
{
$info = $this->info->generate($exception, $id, 400);

Expand All @@ -41,14 +41,24 @@ public function display(Exception $exception, string $id, int $code, array $head
/**
* Can we display the exception?
*
* @param \Exception $original
* @param \Exception $transformed
* @param \Throwable $original
* @param \Throwable $transformed
* @param int $code
*
* @return bool
*/
public function canDisplay(Exception $original, Exception $transformed, int $code)
public function canDisplay(Throwable $original, Throwable $transformed, int $code)
{
return $transformed instanceof ValidationException;
}

/**
* Get the supported content type.
*
* @return string
*/
public function contentType()
{
return 'application/json';
}
}
14 changes: 7 additions & 7 deletions app/Exceptions/Displayers/MaintenanceDisplayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace CachetHQ\Cachet\Exceptions\Displayers;

use Exception;
use GrahamCampbell\Exceptions\Displayers\DisplayerInterface;
use Throwable;
use GrahamCampbell\Exceptions\Displayer\DisplayerInterface;
use Illuminate\Contracts\View\Factory;
use Illuminate\Foundation\Http\Exceptions\MaintenanceModeException;
use Illuminate\Http\Response;
Expand Down Expand Up @@ -46,14 +46,14 @@ public function __construct(Factory $view)
/**
* Get the error response associated with the given exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @param string $id
* @param int $code
* @param string[] $headers
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display(Exception $exception, string $id, int $code, array $headers)
public function display(Throwable $exception, string $id, int $code, array $headers)
{
return new Response($this->render(), $code, array_merge($headers, ['Content-Type' => $this->contentType()]));
}
Expand Down Expand Up @@ -81,13 +81,13 @@ public function contentType()
/**
* Can we display the exception?
*
* @param \Exception $original
* @param \Exception $transformed
* @param \Throwable $original
* @param \Throwable $transformed
* @param int $code
*
* @return bool
*/
public function canDisplay(Exception $original, Exception $transformed, int $code)
public function canDisplay(Throwable $original, Throwable $transformed, int $code)
{
return $transformed instanceof MaintenanceModeException;
}
Expand Down
14 changes: 7 additions & 7 deletions app/Exceptions/Displayers/RedirectDisplayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace CachetHQ\Cachet\Exceptions\Displayers;

use Exception;
use GrahamCampbell\Exceptions\Displayers\DisplayerInterface;
use Throwable;
use GrahamCampbell\Exceptions\Displayer\DisplayerInterface;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

Expand Down Expand Up @@ -40,14 +40,14 @@ public function __construct(Request $request)
/**
* Get the error response associated with the given exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @param string $id
* @param int $code
* @param string[] $headers
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display(Exception $exception, string $id, int $code, array $headers)
public function display(Throwable $exception, string $id, int $code, array $headers)
{
return redirect()->guest('auth/login');
}
Expand All @@ -65,13 +65,13 @@ public function contentType()
/**
* Can we display the exception?
*
* @param \Exception $original
* @param \Exception $transformed
* @param \Throwable $original
* @param \Throwable $transformed
* @param int $code
*
* @return bool
*/
public function canDisplay(Exception $original, Exception $transformed, int $code)
public function canDisplay(Throwable $original, Throwable $transformed, int $code)
{
$redirect = $transformed instanceof HttpExceptionInterface && $transformed->getStatusCode() === 401;

Expand Down
14 changes: 7 additions & 7 deletions app/Exceptions/Displayers/SettingsDisplayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace CachetHQ\Cachet\Exceptions\Displayers;

use CachetHQ\Cachet\Settings\ReadException;
use Exception;
use GrahamCampbell\Exceptions\Displayers\DisplayerInterface;
use Throwable;
use GrahamCampbell\Exceptions\Displayer\DisplayerInterface;
use Illuminate\Http\Request;

class SettingsDisplayer implements DisplayerInterface
Expand All @@ -40,14 +40,14 @@ public function __construct(Request $request)
/**
* Get the error response associated with the given exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @param string $id
* @param int $code
* @param string[] $headers
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display(Exception $exception, string $id, int $code, array $headers)
public function display(Throwable $exception, string $id, int $code, array $headers)
{
return cachet_redirect('setup');
}
Expand All @@ -65,13 +65,13 @@ public function contentType()
/**
* Can we display the exception?
*
* @param \Exception $original
* @param \Exception $transformed
* @param \Throwable $original
* @param \Throwable $transformed
* @param int $code
*
* @return bool
*/
public function canDisplay(Exception $original, Exception $transformed, int $code)
public function canDisplay(Throwable $original, Throwable $transformed, int $code)
{
return ($transformed instanceof ReadException) && !$this->request->is('setup*');
}
Expand Down
14 changes: 7 additions & 7 deletions app/Exceptions/Displayers/ThrottleDisplayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace CachetHQ\Cachet\Exceptions\Displayers;

use Exception;
use GrahamCampbell\Exceptions\Displayers\DisplayerInterface;
use Throwable;
use GrahamCampbell\Exceptions\Displayer\DisplayerInterface;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException;

Expand Down Expand Up @@ -40,14 +40,14 @@ public function __construct(Request $request)
/**
* Get the error response associated with the given exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @param string $id
* @param int $code
* @param string[] $headers
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display(Exception $exception, string $id, int $code, array $headers)
public function display(Throwable $exception, string $id, int $code, array $headers)
{
return cachet_redirect('auth.login')->withError(trans('forms.login.rate-limit'));
}
Expand All @@ -65,13 +65,13 @@ public function contentType()
/**
* Can we display the exception?
*
* @param \Exception $original
* @param \Exception $transformed
* @param \Throwable $original
* @param \Throwable $transformed
* @param int $code
*
* @return bool
*/
public function canDisplay(Exception $original, Exception $transformed, int $code)
public function canDisplay(Throwable $original, Throwable $transformed, int $code)
{
return $transformed instanceof TooManyRequestsHttpException && $this->request->is('auth*');
}
Expand Down
4 changes: 2 additions & 2 deletions app/Exceptions/Filters/ApiFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class ApiFilter
/**
* Filter and return the displayers.
*
* @param \GrahamCampbell\Exceptions\Displayers\DisplayerInterface[] $displayers
* @param \GrahamCampbell\Exceptions\Displayer\DisplayerInterface[] $displayers
* @param \Illuminate\Http\Request $request
* @param \Exception $original
* @param \Exception $transformed
* @param int $code
*
* @return \GrahamCampbell\Exceptions\Displayers\DisplayerInterface[]
* @return \GrahamCampbell\Exceptions\Displayer\DisplayerInterface[]
*/
public function filter(array $displayers, Request $request, Exception $original, Exception $transformed, int $code)
{
Expand Down
10 changes: 5 additions & 5 deletions app/Exceptions/Transformers/BusTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace CachetHQ\Cachet\Exceptions\Transformers;

use CachetHQ\Cachet\Bus\Exceptions\ExceptionInterface;
use Exception;
use GrahamCampbell\Exceptions\Transformers\TransformerInterface;
use Throwable;
use GrahamCampbell\Exceptions\Transformer\TransformerInterface;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

/**
Expand All @@ -26,11 +26,11 @@ class BusTransformer implements TransformerInterface
/**
* Transform the provided exception.
*
* @param \Exception $exception
* @param \Throwable $exception
*
* @return \Exception
* @return \Throwable
*/
public function transform(Exception $exception)
public function transform(Throwable $exception)
{
if ($exception instanceof ExceptionInterface) {
$exception = new BadRequestHttpException($exception->getMessage());
Expand Down
1 change: 1 addition & 0 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, GrahamCampbell\Exceptions\ExceptionHandler::class);

$app->singleton(GrahamCampbell\Exceptions\Identifier\IdentifierInterface::class, GrahamCampbell\Exceptions\Identifier\HashingIdentifier::class);
/*
|--------------------------------------------------------------------------
| Return The Application
Expand Down
Loading