feat(console): add optional progress bar for long-running processes - #76
Open
Ibochkarev wants to merge 3 commits into
Open
feat(console): add optional progress bar for long-running processes#76Ibochkarev wants to merge 3 commits into
Ibochkarev wants to merge 3 commits into
Conversation
Add logProgress() to Processor for console progress reporting. ClearCache calls it during refresh. Console parses PROGRESS: messages and drives optional progress bar in modx.console (enabled for Clear Cache). Refs modxcms#16296
Use an isolated __MODX_PROGRESS__ prefix, parse it only when show_progress is on, clamp values, start Clear Cache with indeterminate progress before refresh, and cover the contract (modxcms#16296).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что сделано
Добавляет опциональный прогресс-бар в
MODx.Console, когдаshowProgress: true(Clear Cache использует его).Процессоры вызывают
logProgress($current, $total). Сообщения используют изолированный префикс__MODX_PROGRESS__:, поэтому обычные строки лога не могут рулить баром.System/Consoleпарсит эти сообщения только приshow_progress=1. Clear Cache стартует с indeterminate-прогрессом доcacheManager->refresh(), затем репортит determinate-шаги при записи результатов.Зачем нужно
Долгие console-задачи не давали фидбэка прогресса (modxcms#16296).
Как проверить
showProgress(например установка пакета) работает без бара;PROGRESS:-подобный текст лога не глотается.phpunit --filter ConsoleProgressProtocolTestСвязанные
Refs modxcms#16296
Оригинал: modxcms#16850