Skip to content

Commit d7e4830

Browse files
committed
Use maria db commands when available
1 parent e8ddfd9 commit d7e4830

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

ProcessMaker/Http/Controllers/Admin/DevLinkController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function getOauthClient(Request $request)
4343

4444
if (!$client) {
4545
$clientRepository = app('Laravel\Passport\ClientRepository');
46-
$client = $clientRepository->create(null, 'devlink', $redirectUri);
46+
$client = $clientRepository->createAuthorizationCodeGrantClient('devlink', [$redirectUri]);
4747
}
4848

4949
$query = http_build_query([

tests/TestCase.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ protected function withPersonalAccessClient()
154154
{
155155
$clients = app()->make('Laravel\Passport\ClientRepository');
156156
try {
157-
$clients->personalAccessClient();
157+
$clients->personalAccessClient('users');
158158
} catch (\RuntimeException $e) {
159159
Artisan::call('passport:install --no-interaction');
160160
}
@@ -255,7 +255,7 @@ public function restoreDatabaseSnapshot($id)
255255
if (!file_exists(base_path($filename))) {
256256
throw new \Exception("Database snapshot not found: $filename");
257257
}
258-
$command = 'mysql ' . $this->mysqlConnectionString();
258+
$command = $this->getMysqlCommand() . $this->mysqlConnectionString();
259259
$command .= ' ' . env('DB_DATABASE') . ' < ' . base_path($filename);
260260
if (system($command) === false) {
261261
dd("Failed to restore database from snapshot: $command");
@@ -295,4 +295,17 @@ private function getDumpCommand()
295295
// Fall back to mysqldump
296296
return 'mysqldump ';
297297
}
298+
299+
private function getMysqlCommand()
300+
{
301+
// Check if mariadb client is available (common in Alpine environments)
302+
$result = \Illuminate\Support\Facades\Process::run('command -v mariadb');
303+
304+
if ($result->successful()) {
305+
return 'mariadb ';
306+
}
307+
308+
// Fall back to mysql
309+
return 'mysql ';
310+
}
298311
}

0 commit comments

Comments
 (0)