Skip to content

Commit 7325aeb

Browse files
committed
Merge branch '4.x' into develop
2 parents 25ddda9 + 9c67bb0 commit 7325aeb

File tree

4 files changed

+42
-20
lines changed

4 files changed

+42
-20
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ jobs:
2121
steps:
2222
- name: Checkout changes
2323
uses: actions/checkout@v1
24+
2425
- name: Install PHP
2526
uses: shivammathur/setup-php@master
2627
with:
2728
php-version: ${{ matrix.phpVersions }}
29+
2830
- name: Install Composer dependencies
29-
run: composer install --no-interaction --no-progress --no-suggest --no-scripts
31+
run: |
32+
composer config --no-interaction allow-plugins.composer/installers true
33+
composer install --no-interaction --no-progress --no-scripts
34+
3035
- name: Run Tests
3136
run: ./vendor/bin/phpunit ./tests

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"require": {
1717
"php": "^8.0.2",
1818
"composer/composer": "^2.0.0",
19+
"composer/installers": "^1 || ^2",
1920
"doctrine/dbal": "^2.13.3|^3.1.4",
2021
"intervention/image": "^3.10",
2122
"linkorb/jsmin-php": "~1.0",

src/Exception/ErrorHandler.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ public function handleException(Throwable $proposedException)
8585
*/
8686
protected function isNotFoundException($exception)
8787
{
88-
return array_first($this->notFoundExceptions, function($type) use ($exception) {
89-
return $exception instanceof $type;
90-
});
88+
foreach ($this->notFoundExceptions as $type) {
89+
if ($exception instanceof $type) {
90+
return true;
91+
}
92+
}
93+
return false;
9194
}
9295

9396
/**

src/Foundation/Console/ProjectSetCommand.php

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,22 @@ public function handle()
6969
protected function storeProjectDetails($result)
7070
{
7171
// Save project locally
72-
if (class_exists(\System\Models\Parameter::class)) {
73-
\System\Models\Parameter::set([
74-
'system::project.id' => $result['id'],
75-
'system::project.key' => $result['project_id'],
76-
'system::project.name' => $result['name'],
77-
'system::project.owner' => $result['owner'],
78-
'system::project.is_active' => $result['is_active']
79-
]);
80-
}
81-
else {
82-
if (!is_dir($cmsStorePath = storage_path('cms'))) {
83-
mkdir($cmsStorePath);
72+
try {
73+
if (class_exists(\System\Models\Parameter::class)) {
74+
\System\Models\Parameter::set([
75+
'system::project.id' => $result['id'],
76+
'system::project.key' => $result['project_id'],
77+
'system::project.name' => $result['name'],
78+
'system::project.owner' => $result['owner'],
79+
'system::project.is_active' => $result['is_active']
80+
]);
81+
}
82+
else {
83+
$this->storeProjectDetailsLocally($result);
8484
}
85-
86-
$this->injectJsonToFile(storage_path('cms/project.json'), [
87-
'project' => $result['project_id']
88-
]);
85+
}
86+
catch (Exception $ex) {
87+
$this->storeProjectDetailsLocally($result);
8988
}
9089

9190
// Save authentication token
@@ -96,6 +95,20 @@ protected function storeProjectDetails($result)
9695
);
9796
}
9897

98+
/**
99+
* storeProjectDetailsLocally instead
100+
*/
101+
protected function storeProjectDetailsLocally($result)
102+
{
103+
if (!is_dir($cmsStorePath = storage_path('cms'))) {
104+
mkdir($cmsStorePath);
105+
}
106+
107+
$this->injectJsonToFile(storage_path('cms/project.json'), [
108+
'project' => $result['project_id']
109+
]);
110+
}
111+
99112
/**
100113
* requestServerData contacts the update server for a response.
101114
* @param string $uri Gateway API URI

0 commit comments

Comments
 (0)