Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14746557
D19137.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D19137.diff
View Options
diff --git a/src/applications/harbormaster/management/HarbormasterManagementRebuildLogWorkflow.php b/src/applications/harbormaster/management/HarbormasterManagementRebuildLogWorkflow.php
--- a/src/applications/harbormaster/management/HarbormasterManagementRebuildLogWorkflow.php
+++ b/src/applications/harbormaster/management/HarbormasterManagementRebuildLogWorkflow.php
@@ -6,7 +6,10 @@
protected function didConstruct() {
$this
->setName('rebuild-log')
- ->setExamples('**rebuild-log** --id __id__ [__options__]')
+ ->setExamples(
+ pht(
+ "**rebuild-log** --id __id__ [__options__]\n".
+ "**rebuild-log** --all"))
->setSynopsis(
pht(
'Rebuild the file and summary for a log. This is primarily '.
@@ -18,31 +21,76 @@
'param' => 'id',
'help' => pht('Log to rebuild.'),
),
+ array(
+ 'name' => 'all',
+ 'help' => pht('Rebuild all logs.'),
+ ),
+ array(
+ 'name' => 'force',
+ 'help' => pht(
+ 'Force logs to rebuild even if they appear to be in good '.
+ 'shape already.'),
+ ),
));
}
public function execute(PhutilArgumentParser $args) {
$viewer = $this->getViewer();
+ $is_force = $args->getArg('force');
+
$log_id = $args->getArg('id');
- if (!$log_id) {
+ $is_all = $args->getArg('all');
+
+ if (!$is_all && !$log_id) {
throw new PhutilArgumentUsageException(
- pht('Choose a build log to rebuild with "--id".'));
+ pht(
+ 'Choose a build log to rebuild with "--id", or rebuild all '.
+ 'logs with "--all".'));
}
- $log = id(new HarbormasterBuildLogQuery())
- ->setViewer($viewer)
- ->withIDs(array($log_id))
- ->executeOne();
- if (!$log) {
+ if ($is_all && $log_id) {
throw new PhutilArgumentUsageException(
pht(
- 'Unable to load build log "%s".',
- $log_id));
+ 'You can not specify both "--id" and "--all". Choose one or '.
+ 'the other.'));
+ }
+
+ if ($log_id) {
+ $log = id(new HarbormasterBuildLogQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($log_id))
+ ->executeOne();
+ if (!$log) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'Unable to load build log "%s".',
+ $log_id));
+ }
+ $logs = array($log);
+ } else {
+ $logs = new LiskMigrationIterator(new HarbormasterBuildLog());
}
PhabricatorWorker::setRunAllTasksInProcess(true);
- $log->scheduleRebuild(true);
+
+ foreach ($logs as $log) {
+ echo tsprintf(
+ "%s\n",
+ pht(
+ 'Rebuilding log "%s"...',
+ pht('Build Log %d', $log->getID())));
+
+ try {
+ $log->scheduleRebuild($is_force);
+ } catch (Exception $ex) {
+ if ($is_all) {
+ phlog($ex);
+ } else {
+ throw $ex;
+ }
+ }
+ }
echo tsprintf(
"%s\n",
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 9:48 AM (5 h, 21 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7029067
Default Alt Text
D19137.diff (3 KB)
Attached To
Mode
D19137: Add "--all" and an explicit "--force" flag to `bin/harbormaster rebuild-log`
Attached
Detach File
Event Timeline
Log In to Comment