Skip to content

Commit af8db4f

Browse files
committed
Added option to ensure attachments
1 parent 8c0358f commit af8db4f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/derhasi/RedmineToGit/Command/WikiCommand.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ protected function configure()
113113
'Maximum filesize for attachments in bytes',
114114
'0'
115115
)
116+
->addOption(
117+
'ensureAttachments',
118+
NULL,
119+
InputOption::VALUE_NONE,
120+
'Makes sure the attachments from the current version are downloaded'
121+
)
116122
;
117123
}
118124

@@ -216,6 +222,8 @@ protected function buildWikiVersions() {
216222

217223
$this->wikiVersions = array();
218224

225+
$ensure_attachments = $this->currentInput->getOption('ensureAttachments');
226+
219227
// Show a progress bar for featching wiki page information.
220228
$this->currentOutput->writeln("<info>Fetching wiki page information from API ...</info>");
221229
$progress = $this->getHelperSet()->get('progress');
@@ -234,6 +242,13 @@ protected function buildWikiVersions() {
234242
$this->wikiVersions[$key] = $version;
235243
}
236244
}
245+
// In the case we want to ensure the attachments, we need to process the
246+
// last version again.
247+
elseif ($ensure_attachments && $current_version == $index_version) {
248+
$version = $page->loadVersion($index_version);
249+
$key = $version->updated_on . '-' . $version->title . '-' . $version->version;
250+
$this->wikiVersions[$key] = $version;
251+
}
237252

238253
// advances the progress bar 1 unit
239254
$progress->advance();

0 commit comments

Comments
 (0)