Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[upgrade] show timestamp for output during upgrade #17093

Merged
merged 3 commits into from Jul 1, 2015

Conversation

MorrisJobke
Copy link
Contributor

  • added -v option to show timestamp

cc @LukasReschke @DeepDiver1975 @nickvergessen @rullzer @Xenopathic

./occ upgrade -v
ownCloud or one of the apps require upgrade - only a limited number of commands are available
2015-06-23T09:06:15+0000 Turned on maintenance mode
2015-06-23T09:06:15+0000 Checked database schema update
2015-06-23T09:06:15+0000 Checked database schema update for apps
2015-06-23T09:06:15+0000 Updated database
2015-06-23T09:06:15+0000 Updated <files_sharing> to 0.6.6
2015-06-23T09:06:15+0000 Update successful
2015-06-23T09:06:15+0000 Turned off maintenance mode
$ ./occ upgrade
ownCloud or one of the apps require upgrade - only a limited number of commands are available
Turned on maintenance mode
Checked database schema update
Checked database schema update for apps
Updated database
Updated <files_sharing> to 0.6.5
Update successful
Turned off maintenance mode

*/
protected function writeln(OutputInterface $output, $line) {
$time = new \DateTime();
$t = $time->format(\DateTime::ISO8601);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make use of logdateformat and logtimezone from system config?

@MorrisJobke
Copy link
Contributor Author

@nickvergessen fixed.

$t = '';
if($this->showTimestamp) {
$time = new \DateTime();
$t = $time->format(\DateTime::ISO8601) . ' ';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reactivating my comment:
Should we make use of logdateformat and logtimezone from system config?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed

@RobinMcCorkell
Copy link
Member

I can foresee a problem we might have if we try to extend this in the future - if a subclass wants an OutputInterface to write stuff to the console, the best we can do from here is pass on the existing OutputInterface, but that means that output will not contain the timestamp (since that is a wrapper function of this class). Symfony Console supports the concept of formatters though - it might be best to create an OutputFormatter subclass with the format() function overriden, that prepends a timestamp. Then everything is contained in the $output object.

@MorrisJobke
Copy link
Contributor Author

@Xenopathic Thanks for the pointer :)

@@ -110,6 +126,12 @@ protected function execute(InputInterface $input, OutputInterface $output) {
}

if(\OC::checkUpgrade(false)) {
if ($input->getOption('show-timestamp')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could also just use a verbosity level for this or default to true. It does not really hurt to have it. but you can't have it retro-actively

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MorrisJobke what do you think?

@RobinMcCorkell
Copy link
Member

Nice, looks like clean code to me! (apart from the above comments of course)

@nickvergessen
Copy link
Contributor

@MorrisJobke @Xenopathic should be up to date now, I replaced the additional option with a check for verbosity, I hope that's fine

@MorrisJobke
Copy link
Contributor Author

@nickvergessen Thanks

@RobinMcCorkell
Copy link
Member

👍

@nickvergessen nickvergessen mentioned this pull request Jun 24, 2015
@scrutinizer-notifier
Copy link

A new inspection was created.

@nickvergessen
Copy link
Contributor

rebased due to #17095

@ghost
Copy link

ghost commented Jun 24, 2015

🚀 Test PASSed.🚀
chuck

@MorrisJobke
Copy link
Contributor Author

As this was nearly completely rewritten by @nickvergessen : I tested this and it works, thanks 👍

@MorrisJobke
Copy link
Contributor Author

stable8.1 is created -> merge

MorrisJobke added a commit that referenced this pull request Jul 1, 2015
[upgrade] show timestamp for output during upgrade
@MorrisJobke MorrisJobke merged commit 4e44cc4 into master Jul 1, 2015
@MorrisJobke MorrisJobke deleted the upgrade-timestamp branch July 1, 2015 06:55
@lock lock bot locked as resolved and limited conversation to collaborators Aug 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants