Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F726971
D21.id66.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 6, 4:19 AM
Size
2 KB
Mime Type
text/x-diff
Expires
Tue, Jan 7, 4:19 AM (2 d, 18 h ago)
Engine
blob
Format
Raw Data
Handle
537044
Attached To
D21: INP-1391 - Allow to separately run deployment steps
D21.id66.diff
View Options
Index: core/units/helpers/deployment_helper.php
===================================================================
--- core/units/helpers/deployment_helper.php
+++ core/units/helpers/deployment_helper.php
@@ -21,6 +21,10 @@
*/
const SQL_TRIM_LENGTH = 120;
+ const STAGE_DB_MIGRATE = 'db-migrate';
+
+ const STAGE_CACHE_RESET = 'cache-reset';
+
/**
* Name of module, that is processed right now.
*
@@ -78,6 +82,16 @@
public $ip = '';
/**
+ * Deployment stages to run.
+ *
+ * @var array
+ */
+ public $stages = array(
+ self::STAGE_DB_MIGRATE,
+ self::STAGE_CACHE_RESET,
+ );
+
+ /**
* Event, that triggered deployment.
*
* @var kEvent
@@ -106,8 +120,21 @@
if ( !$this->isCommandLine ) {
$this->ip = $this->Application->getClientIp();
}
- elseif ( isset($GLOBALS['argv'][3]) ) {
- $this->ip = $GLOBALS['argv'][3];
+ else {
+ if ( isset($GLOBALS['argv'][3]) ) {
+ $this->ip = $GLOBALS['argv'][3];
+ }
+
+ if ( isset($GLOBALS['argv'][4]) ) {
+ $new_stages = explode(',', $GLOBALS['argv'][4]);
+ $unknown_stages = array_diff($new_stages, $this->stages);
+
+ if ( $unknown_stages ) {
+ throw new InvalidArgumentException('Unknown deployment stages: ' . implode(', ', $unknown_stages));
+ }
+
+ $this->stages = $new_stages;
+ }
}
}
@@ -173,19 +200,23 @@
$ret = true;
$this->dryRun = $dry_run;
- foreach ( $this->Application->ModuleInfo as $module_name => $module_info ) {
- $this->moduleName = $module_name;
+ if ( in_array(self::STAGE_DB_MIGRATE, $this->stages) ) {
+ foreach ( $this->Application->ModuleInfo as $module_name => $module_info ) {
+ $this->moduleName = $module_name;
- if ( !file_exists($this->getModuleFile('project_upgrades.sql')) ) {
- continue;
- }
+ if ( !file_exists($this->getModuleFile('project_upgrades.sql')) ) {
+ continue;
+ }
- $ret = $ret && $this->deploy($module_name);
+ $ret = $ret && $this->deploy($module_name);
+ }
}
- if ( $ret && !$this->dryRun ) {
- $this->resetCaches();
- $this->refreshThemes();
+ if ( in_array(self::STAGE_CACHE_RESET, $this->stages) ) {
+ if ( $ret && !$this->dryRun ) {
+ $this->resetCaches();
+ $this->refreshThemes();
+ }
}
if ( !$this->isCommandLine ) {
@@ -719,4 +750,4 @@
return $this;
}
-}
\ No newline at end of file
+}
Event Timeline
Log In to Comment