-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce installation script (#214)
* Introduce installation script to support automatic deployments * Update readme --------- Co-authored-by: Marko Ivančić <marko.ivancic@srce.hr>
- Loading branch information
Showing
7 changed files
with
61 additions
and
7 deletions.
There are no files selected for viewing
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,39 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Script which can be run to do the module installation which includes running database migrations. | ||
*/ | ||
|
||
use SimpleSAML\Database; | ||
use SimpleSAML\Module\oidc\Services\DatabaseMigration; | ||
|
||
// This is the base directory of the SimpleSAMLphp installation | ||
$baseDir = dirname(__FILE__, 4); | ||
|
||
// Add library autoloader and configuration | ||
require_once $baseDir . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . '_autoload.php'; | ||
|
||
echo 'Starting with module installation.' . PHP_EOL; | ||
|
||
try { | ||
$database = Database::getInstance(); | ||
$databaseMigration = new DatabaseMigration($database); | ||
|
||
if ($databaseMigration->isUpdated()) { | ||
echo 'Database is up to date, skipping.' . PHP_EOL; | ||
return 0; | ||
} | ||
|
||
echo 'Running database migrations.' . PHP_EOL; | ||
|
||
$databaseMigration->migrate(); | ||
|
||
echo 'Done running migrations.'; | ||
return 0; | ||
} catch (Throwable $exception) { | ||
echo 'There was an error while trying run database migrations: ' . $exception->getMessage(); | ||
return 1; | ||
} |
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
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