Last active
October 19, 2016 09:19
-
-
Save vincenzo/a7b2a19940c311f17970015f28fe1564 to your computer and use it in GitHub Desktop.
isc.patch
This file contains hidden or 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
diff --git a/etc/cli/src/Command/DbSanitizeCommand.php b/etc/cli/src/Command/DbSanitizeCommand.php | |
index fba916a..ac4517a 100644 | |
--- a/etc/cli/src/Command/DbSanitizeCommand.php | |
+++ b/etc/cli/src/Command/DbSanitizeCommand.php | |
@@ -22,6 +22,8 @@ class DbSanitizeCommand extends SolasCommandBase { | |
protected function execute(InputInterface $input, OutputInterface $output) { | |
$this->validateInput($input); | |
$project = new SolasProject($this->getSelectedProject()); | |
+ $internalCode = $this->selectEnvironment('snapshot') | |
+ ->getVariable('SITE_CODE')->value; | |
/* @var DrushHelper $dh */ | |
$dh = $this->getHelper('drush'); | |
@@ -31,7 +33,7 @@ class DbSanitizeCommand extends SolasCommandBase { | |
$this->stdErr->write("<info>[*]</info> Sanitizing database for <info>" . $project->getProperty('title') . "</info> (" . $project->id . ")..."); | |
$dh->execute([ | |
'-y', | |
- "@$project->internalCode._local", | |
+ "@$internalCode._local", | |
'sql-sanitize', | |
'--sanitize-email="%[email protected]"' | |
], NULL, TRUE); | |
diff --git a/etc/cli/src/Command/DbSyncCommand.php b/etc/cli/src/Command/DbSyncCommand.php | |
index 376f0a3..a283d6b 100644 | |
--- a/etc/cli/src/Command/DbSyncCommand.php | |
+++ b/etc/cli/src/Command/DbSyncCommand.php | |
@@ -24,7 +24,9 @@ class DbSyncCommand extends SolasCommandBase { | |
protected function execute(InputInterface $input, OutputInterface $output) { | |
$this->validateInput($input); | |
$project = new SolasProject($this->getSelectedProject()); | |
- $backupPath = $this::DB_BACKUP_BASE_PATH . "/" . date('Y-m-d') . '-' . $project->internalCode . '.sql'; | |
+ $internalCode = $this->selectEnvironment('snapshot') | |
+ ->getVariable('SITE_CODE')->value; | |
+ $backupPath = $this::DB_BACKUP_BASE_PATH . "/" . date('Y-m-d') . '-' . $internalCode . '.sql'; | |
$this->stdErr->writeln("<info>[*]</info> Importing live database backup for <info>" . $project->getProperty('title') . "</info> (" . $project->id . ")..."); | |
diff --git a/etc/cli/src/Command/DeployCommand.php b/etc/cli/src/Command/DeployCommand.php | |
index 4ed2410..5c4381e 100644 | |
--- a/etc/cli/src/Command/DeployCommand.php | |
+++ b/etc/cli/src/Command/DeployCommand.php | |
@@ -42,7 +42,9 @@ class DeployCommand extends SolasCommandBase { | |
$this->validateInput($input); | |
$project = new SolasProject($this->getSelectedProject()); | |
- $project->setRootDirectory($this->sitesDefaultDirectory() . '/' . $project->internalCode); | |
+ $internalCode = $this->selectEnvironment('snapshot') | |
+ ->getVariable('SITE_CODE')->value; | |
+ $project->setRootDirectory($this->sitesDefaultDirectory() . '/' . $internalCode); | |
$siteJustFetched = FALSE; | |
$profileJustFetched = FALSE; | |
@@ -138,7 +140,7 @@ class DeployCommand extends SolasCommandBase { | |
$this->cleanBuilds($project); | |
// End of deployment. | |
- $this->stdErr->writeln("<info>[*]</info> Deployment finished.\n\tGo to <info>http://$project->internalCode.local.solas.britishcouncil.digital</info> to view the site.\n\tThe password for all users is <info>password</info>."); | |
+ $this->stdErr->writeln("<info>[*]</info> Deployment finished.\n\tGo to <info>http://$internalCode.local.solas.britishcouncil.digital</info> to view the site.\n\tThe password for all users is <info>password</info>."); | |
} | |
/** | |
@@ -337,7 +339,7 @@ class DeployCommand extends SolasCommandBase { | |
foreach ($hooks as $hook) { | |
$replaced = 0; | |
- $newhook = str_ireplace('drush -y', "drush @{$project->internalCode}._local -y", $hook, $replaced); | |
+ $newhook = str_ireplace('drush -y', "drush @{$internalCode}._local -y", $hook, $replaced); | |
if ($replaced) { | |
$drush = new Process($newhook); | |
$drush->setTimeout($this::EXTERNAL_PROCESS_TIMEOUT); | |
diff --git a/etc/cli/src/Command/ElasticSearchReindexCommand.php b/etc/cli/src/Command/ElasticSearchReindexCommand.php | |
index 5ff3b3e..e47403d 100644 | |
--- a/etc/cli/src/Command/ElasticSearchReindexCommand.php | |
+++ b/etc/cli/src/Command/ElasticSearchReindexCommand.php | |
@@ -23,6 +23,8 @@ class ElasticSearchReindexCommand extends SolasCommandBase { | |
protected function execute(InputInterface $input, OutputInterface $output) { | |
$this->validateInput($input); | |
$project = new SolasProject($this->getSelectedProject()); | |
+ $internalCode = $this->selectEnvironment('snapshot') | |
+ ->getVariable('SITE_CODE')->value; | |
// Instantiating a new DrushHelper as the default one doesn't have any output. | |
$dh = new DrushHelper($this->output); | |
@@ -31,12 +33,12 @@ class ElasticSearchReindexCommand extends SolasCommandBase { | |
try { | |
$this->stdErr->writeln('<info>[*]</info> Indexing all content for <info>' . $project->getProperty('title') . '</info> (' . $project->id . ')...'); | |
$dh->execute([ | |
- "@{$project->internalCode}._local", | |
+ "@{$internalCode}._local", | |
"search-api-reindex", | |
"search" | |
], NULL, TRUE); | |
$dh->execute([ | |
- "@{$project->internalCode}._local", | |
+ "@{$internalCode}._local", | |
"search-api-index", | |
"search" | |
], NULL, TRUE, FALSE); | |
diff --git a/etc/cli/src/Command/SiteInternalCodeCommand.php b/etc/cli/src/Command/SiteInternalCodeCommand.php | |
index a371746..0a785d4 100644 | |
--- a/etc/cli/src/Command/SiteInternalCodeCommand.php | |
+++ b/etc/cli/src/Command/SiteInternalCodeCommand.php | |
@@ -18,9 +18,10 @@ class SiteInternalCodeCommand extends SolasCommandBase { | |
protected function execute(InputInterface $input, OutputInterface $output) { | |
$this->validateInput($input); | |
- $project = new SolasProject($this->getSelectedProject()); | |
- if ($project->internalCode) { | |
- $this->stdErr->writeln($project->internalCode); | |
+ $internalCode = $this->selectEnvironment('snapshot') | |
+ ->getVariable('SITE_CODE')->value; | |
+ if ($internalCode) { | |
+ $this->stdErr->writeln($internalCode); | |
return 0; | |
} | |
return 1; | |
diff --git a/etc/cli/src/Command/TestEnvironmentCommand.php b/etc/cli/src/Command/TestEnvironmentCommand.php | |
index e077f5e..a87835b 100644 | |
--- a/etc/cli/src/Command/TestEnvironmentCommand.php | |
+++ b/etc/cli/src/Command/TestEnvironmentCommand.php | |
@@ -47,7 +47,9 @@ class TestEnvironmentCommand extends SolasCommandBase { | |
// If environment already exists, but --refresh has not been specified, | |
// throw an exception and advise accordingly. | |
- if ($this->getSelectedProject()->getEnvironment($testEnv) && !$input->getOption('refresh')) { | |
+ if ($this->getSelectedProject() | |
+ ->getEnvironment($testEnv) && !$input->getOption('refresh') | |
+ ) { | |
throw new EnvironmentStateException("Environment <info>$testEnv</info> already exists.\nAdd [-r | --refresh] if you would like to update an existing test environment."); | |
} | |
@@ -128,7 +130,9 @@ class TestEnvironmentCommand extends SolasCommandBase { | |
$git->execute(['push', 'origin', $testEnv], $repoDir, TRUE, FALSE); | |
if ($project->gitHubIntegrationEnabled()) { | |
- $this->stdErr->writeln("\n<error>GitHub integration is enabled on this project, so the environment just created is inactive.\nPlease go to </error><info>https://github.com/britishcouncil/solas_ " . $project->internalCode . "</info><error> and issue a pull request from </error><info>$testEnv</info><error> to </error><info>qa</info><error> in order to create an active test environment. The pull request can then be safely closed once testing is complete.</error>"); | |
+ $internalCode = $this->selectEnvironment('snapshot') | |
+ ->getVariable('SITE_CODE')->value; | |
+ $this->stdErr->writeln("\n<error>GitHub integration is enabled on this project, so the environment just created is inactive.\nPlease go to </error><info>https://github.com/britishcouncil/solas_ " . $internalCode . "</info><error> and issue a pull request from </error><info>$testEnv</info><error> to </error><info>qa</info><error> in order to create an active test environment. The pull request can then be safely closed once testing is complete.</error>"); | |
} | |
} | |
return 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment