Add runtime fallback for Tools Time->duration() method#462
Merged
dereuromark merged 1 commit intoMar 17, 2026
Merged
Conversation
The duration() method is specific to the Tools TimeHelper. Applications not using the Tools plugin would get a fatal error. This adds a method_exists check with a fallback to PHP's DateInterval::format().
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feature/isolated-admin-dashboard #462 +/- ##
===================================================================
Coverage 73.70% 73.70%
Complexity 838 838
===================================================================
Files 44 44
Lines 2906 2906
===================================================================
Hits 2142 2142
Misses 764 764 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a2e9576
into
feature/isolated-admin-dashboard
16 checks passed
dereuromark
added a commit
that referenced
this pull request
Mar 17, 2026
The duration() method is specific to the Tools TimeHelper. Applications not using the Tools plugin would get a fatal error. This adds a method_exists check with a fallback to PHP's DateInterval::format(). Port of #462 to master.
dereuromark
added a commit
that referenced
this pull request
Mar 18, 2026
* Add modern isolated admin dashboard with Bootstrap 5 - Create QueueAppController as isolated base for admin controllers - Add queue.php layout with Bootstrap 5.3.3 and Font Awesome 6.7.2 via CDN - Add reusable elements: sidebar, stats_card, status_badge, flash messages - Update admin templates with card-based layout and modern styling - Add new configuration options: adminLayout, dashboardAutoRefresh, ignoreAuthorization - Update icon fallback to use Font Awesome 6 icons - Add documentation for admin dashboard features * Fix PHPStan error for optional Authorization dependency * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Add runtime fallback for Tools Time->duration() method (#462) The duration() method is specific to the Tools TimeHelper. Applications not using the Tools plugin would get a fatal error. This adds a method_exists check with a fallback to PHP's DateInterval::format(). * Remove redundant sidebar links and improve template styling - Remove Dashboard/List links from sidebars (now in navbar) - Add nav-link CSS classes to sidebar links - Add Font Awesome icons to sidebar action links - Simplify link routes by removing explicit plugin/prefix - Add block => true to postLinks in sidebars - Clean up stats page sidebar and add list-group styling - Add QueueScheduler link in navbar when plugin is loaded - Add Chart.js CDN to layout for stats page * Make demo jobs section collapsible (collapsed by default) * Modernize all edit/form templates to Bootstrap 5 - Convert all edit pages from old sidebar nav to Bootstrap 5 cards - Update grid classes from old Foundation to Bootstrap 5 (col-lg-*) - Add proper form-control/form-select classes to all form inputs - Add Font Awesome icons to all buttons and headers - Use list-group for action links in sidebars - Convert search element from inline float to responsive card layout - Add proper spacing, alerts, and visual hierarchy - QueuedJobs: edit, data, test, execute, import, migrate - QueueProcesses: edit, view - element: search * Fix Execute Job placement and search task dropdown - Move Execute Job link outside collapsible demo section - Fix search element to use $jobTypes variable for task dropdown * Fixes and improvements for admin dashboard - Fix Chart.js infinite vertical expansion on stats page - Use query parameter for job_type to support slashes in names - Add back button when viewing specific job type stats - Add mobile offcanvas navigation - Add adminLayout and dashboardAutoRefresh to config example - Remove ignoreAuthorization feature (security concerns) * Default to isolated layout, add missing tests - Change adminLayout default: null uses Queue.queue, false disables - Add tests for clone(), execute(), and migrate() actions - Update documentation to reflect new default behavior * Fix CS * Fix CS * Add title attributes to duration and memory icons * Add Server Time title to clock icons * Simplify # Conflicts: # templates/Admin/QueuedJobs/index.php * Fix status display for requeued jobs - Add isRequeued() method to QueueHelper to detect jobs that have failed but are within retry limits and will be picked up again - Add warning state to ok.php element for orange/yellow display - Update all status display logic in dashboard and QueuedJobs views to use hasFailed() and isRequeued() helper methods instead of raw field checks - Requeued jobs now show with yellow "Requeued" badge instead of incorrectly showing as "Failed" or "Running" - Add tests for isRequeued() method * Fix dashboard stats double-counting jobs Pending count was including running and failed jobs, causing the sum of all stats cards to exceed the actual number of jobs. Now properly subtracts running and failed counts from pending to avoid overlap. * Improve dashboard stats display - Reorder stats cards: Scheduled → Pending → Running → Failed (follows job lifecycle chronologically) - Add safeguard against negative pendingJobs count with max(0, ...)
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.
Summary
The
duration()method is specific to the Tools TimeHelper and is not available in the core CakePHP TimeHelper. Applications not using the Tools plugin would get a fatal error when viewing completed jobs:Changes
Added
method_exists()checks forTime->duration()calls in:templates/Admin/QueuedJobs/index.phptemplates/Admin/QueuedJobs/view.phpThe fallback uses PHP's native
DateInterval::format('%H:%I:%S')with leading zeros trimmed for a clean display (e.g., "0:02:30" instead of "00:02:30").Related
This follows the same pattern as the existing
relLengthOfTimefallbacks added in f58ec4d.