mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-05 17:08:56 +02:00
add user data and message to lock command
This commit is contained in:
@@ -104,6 +104,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
|
||||
if (file_exists($lockFile)) {
|
||||
Console::output('<red>This environment is locked!</red>', 1, 2);
|
||||
echo file_get_contents($lockFile);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,22 @@ class LockCommand extends AbstractCommand implements RequiresEnvironment
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Console::output('Your name (enter to leave blank): ', 0, 0);
|
||||
$name = Console::readInput();
|
||||
Console::output('Your email (enter to leave blank): ', 0, 0);
|
||||
$email = Console::readInput();
|
||||
Console::output('Reason of lock (enter to leave blank): ', 0, 0);
|
||||
$reason = Console::readInput();
|
||||
|
||||
$lockmsg = PHP_EOL;
|
||||
if ($name) $lockmsg .= 'Locked by ' . $name . ' ';
|
||||
if ($email) $lockmsg .= '(' . $email . ')';
|
||||
if ($reason) $lockmsg .= PHP_EOL . $reason . PHP_EOL;
|
||||
|
||||
$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
|
||||
file_put_contents($lockFile, 'Locked environment at date: ' . date('Y-m-d H:i:s'));
|
||||
file_put_contents($lockFile, 'Locked environment at date: ' . date('Y-m-d H:i:s') . $lockmsg);
|
||||
|
||||
Console::output('Locked deployment to <light_purple>' . $this->getConfig()->getEnvironment() . '</light_purple> environment', 1, 2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
|
||||
$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
|
||||
if (file_exists($lockFile) && ($subcommand == 'rollback')) {
|
||||
Console::output('<red>This environment is locked!</red>', 1, 2);
|
||||
echo file_get_contents($lockFile);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -70,4 +71,4 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment
|
||||
$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
|
||||
if (file_exists($lockFile) && ($subcommand == 'rollback')) {
|
||||
Console::output('<red>This environment is locked!</red>', 1, 2);
|
||||
echo file_get_contents($lockFile);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -59,4 +60,4 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user