-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3372 from CachetHQ/laravel-upgrade
Upgraded to Laravel 5.7
- Loading branch information
Showing
36 changed files
with
1,328 additions
and
324 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
app/Foundation/Exceptions/Displayers/SettingsDisplayer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?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\Foundation\Exceptions\Displayers; | ||
|
||
use CachetHQ\Cachet\Settings\ReadException; | ||
use Exception; | ||
use GrahamCampbell\Exceptions\Displayers\DisplayerInterface; | ||
use Illuminate\Http\Request; | ||
|
||
class SettingsDisplayer implements DisplayerInterface | ||
{ | ||
/** | ||
* The request instance. | ||
* | ||
* @var \Illuminate\Http\Request | ||
*/ | ||
protected $request; | ||
|
||
/** | ||
* Create a new redirect displayer instance. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Request $request) | ||
{ | ||
$this->request = $request; | ||
} | ||
|
||
/** | ||
* Get the error response associated with the given exception. | ||
* | ||
* @param \Exception $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) | ||
{ | ||
return cachet_redirect('setup'); | ||
} | ||
|
||
/** | ||
* Get the supported content type. | ||
* | ||
* @return string | ||
*/ | ||
public function contentType() | ||
{ | ||
return 'text/html'; | ||
} | ||
|
||
/** | ||
* Can we display the exception? | ||
* | ||
* @param \Exception $original | ||
* @param \Exception $transformed | ||
* @param int $code | ||
* | ||
* @return bool | ||
*/ | ||
public function canDisplay(Exception $original, Exception $transformed, int $code) | ||
{ | ||
return ($transformed instanceof ReadException) && !$this->request->is('setup*'); | ||
} | ||
|
||
/** | ||
* Do we provide verbose information about the exception? | ||
* | ||
* @return bool | ||
*/ | ||
public function isVerbose() | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?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\Settings; | ||
|
||
use Exception; | ||
|
||
/** | ||
* This is the read exception class. | ||
* | ||
* @author Graham Campbell <[email protected]> | ||
*/ | ||
class ReadException extends SettingsException | ||
{ | ||
/** | ||
* Create a new read exception instance. | ||
* | ||
* @param \Exception $e | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Exception $e) | ||
{ | ||
parent::__construct('Unable to read Cachet settings', $e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?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\Settings; | ||
|
||
use Exception; | ||
|
||
/** | ||
* This is the settings exception class. | ||
* | ||
* @author Graham Campbell <[email protected]> | ||
*/ | ||
class SettingsException extends Exception | ||
{ | ||
/** | ||
* Create a new write exception instance. | ||
* | ||
* @param string $m | ||
* @param \Exception $e | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(string $m, Exception $e) | ||
{ | ||
parent::__construct($m, 0, $e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?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\Settings; | ||
|
||
use Exception; | ||
|
||
/** | ||
* This is the write exception class. | ||
* | ||
* @author Graham Campbell <[email protected]> | ||
*/ | ||
class WriteException extends SettingsException | ||
{ | ||
/** | ||
* Create a new write exception instance. | ||
* | ||
* @param \Exception $e | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Exception $e) | ||
{ | ||
parent::__construct('Unable to write Cachet settings', $e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.