-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add large scale infastructure design changes and api support
- Loading branch information
Showing
144 changed files
with
3,574 additions
and
1,473 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
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
43 changes: 43 additions & 0 deletions
43
applications/asset_server/code_manager/src/Command/Abstractions/PreparedCommand.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,43 @@ | ||
<?php | ||
|
||
namespace CodeManager\Command\Abstractions; | ||
|
||
use QuasarSource\Traits\TraitPatternName; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Symfony\Component\Console\Output\BufferedOutput; | ||
|
||
|
||
abstract class PreparedCommand { | ||
use TraitPatternName; | ||
|
||
public const CMD_DB_SCHEMA_UPDATE = 'doctrine:schema:update'; | ||
public const CMD_DB_SCHEMA_VALIDATE = 'doctrine:schema:validate'; | ||
|
||
/** @var Command */ | ||
private $cmd; | ||
/** @var BufferedOutput */ | ||
private $output; | ||
/** @var ArrayInput */ | ||
private $input; | ||
/** @var string */ | ||
protected $results; | ||
/** @var int */ | ||
protected $exit_code; | ||
|
||
public function __construct(string $name, Command $command, array $input=[]) { | ||
$this->set_name($name); | ||
$this->cmd = $command; | ||
$this->output = new BufferedOutput(); | ||
$this->input = new ArrayInput($input); | ||
} | ||
|
||
public function run_command(): void { | ||
$this->exit_code = $this->cmd->run($this->input, $this->output); | ||
$this->results = $this->output->fetch(); | ||
$this->on_command_completed(); | ||
} | ||
|
||
abstract protected function on_command_completed(): void; | ||
|
||
} |
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
32 changes: 32 additions & 0 deletions
32
applications/asset_server/code_manager/src/Command/Prepared/DBSchemaUpdate.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,32 @@ | ||
<?php | ||
|
||
namespace CodeManager\Command\Prepared; | ||
use CodeManager\Command\Abstractions\PreparedCommand; | ||
use QuasarSource\Utilities\StringUtilities; | ||
use Symfony\Component\Console\Command\Command; | ||
|
||
|
||
class DBSchemaUpdate extends PreparedCommand { | ||
|
||
/** @var bool */ | ||
private $db_schema_was_updated = false; | ||
|
||
public function __construct(Command $command) { | ||
parent::__construct(PreparedCommand::CMD_DB_SCHEMA_UPDATE, $command, [ | ||
'-vvv' => null, | ||
'--no-interaction' => null, | ||
'--force' => null | ||
]); | ||
} | ||
|
||
protected function on_command_completed(): void { | ||
#var_dump($this->results); | ||
if (StringUtilities::contains($this->results, 'Updating database schema')) { | ||
$this->db_schema_was_updated = true; | ||
} | ||
} | ||
|
||
public function did_db_schema_update(): bool { | ||
return $this->db_schema_was_updated; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
applications/asset_server/code_manager/src/Command/Prepared/DBSchemaValidate.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,43 @@ | ||
<?php | ||
|
||
namespace CodeManager\Command\Prepared; | ||
use CodeManager\Command\Abstractions\PreparedCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use QuasarSource\Utilities\Exceptions\ExceptionUtilities as DBG; | ||
use QuasarSource\Utilities\StringUtilities as STR; | ||
|
||
|
||
class DBSchemaValidate extends PreparedCommand { | ||
|
||
/** @var bool */ | ||
private $is_healthy_mapping; | ||
/** @var bool */ | ||
private $is_healthy_schema; | ||
|
||
public function __construct(Command $command) { | ||
parent::__construct(PreparedCommand::CMD_DB_SCHEMA_UPDATE, $command, []); | ||
} | ||
|
||
protected function on_command_completed(): void { | ||
#if ($this->exit_code !== 0) { | ||
# DBG::throw_exception('DB Health CMD had non 0 exit code{' . $this->exit_code . '} with output {' . $this->results . '}'); | ||
#} | ||
|
||
$output = STR::split_into_non_empty_lines($this->results); | ||
|
||
if (count($output) !== 6) { | ||
DBG::throw_exception('DB Check has invalid output<<' . json_encode($output) . '>>'); | ||
} | ||
|
||
$this->is_healthy_mapping = STR::contains($output[2], '[OK]'); | ||
$this->is_healthy_schema = STR::contains($output[5], '[OK]'); | ||
} | ||
|
||
public function is_healthy_schema(): bool { | ||
return $this->is_healthy_schema; | ||
} | ||
|
||
public function is_healthy_mapping(): bool { | ||
return $this->is_healthy_mapping; | ||
} | ||
} |
Oops, something went wrong.