-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat: add OCC command to list all routes (incl. fixing the Router) #52919
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
base: master
Are you sure you want to change the base?
Conversation
1886595 to
6669894
Compare
| protected function configure(): void { | ||
| parent::configure(); | ||
| $this | ||
| ->setName('router:list') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[AsCommand(
name: 'router:list',
description: 'List registered routes',
)]
nit
| $rows = $this->formatRoutes($allRoutes); | ||
| $this->writeTableInOutputFormat($input, $output, $rows); | ||
| } | ||
| return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return 0; | |
| return self::SUCCESS; |
lib/private/Route/Router.php
Outdated
| $apps = $user === null | ||
| ? $this->appManager->getEnabledApps() | ||
| : $this->appManager->getEnabledAppsForUser($user); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| $apps = $user === null | |
| ? $this->appManager->getEnabledApps() | |
| : $this->appManager->getEnabledAppsForUser($user); | |
| if ($user === null) { | |
| $apps = $this->appManager->getEnabledApps(); | |
| } else { | |
| $apps = $this->appManager->getEnabledAppsForUser($user); | |
| } |
I would like to suggest using a normal if-else statement here instead of the ternary operator for better readability.
come-nc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When testing this branch (which will need a rebase after #52793 is merged), I do not see the ajax routes of user_ldap in the output of occ router:list.
So either the command is missing them or you broke their loading in the router.
And I do not see anything special in the command code, apart from the wrong assumption that all routes have a caller default.
It is set by the parser?
|
- Add routes to individual collections for each app and then merge them for the root collection holding all routes for the URL generator. - Short cut route loading with already loaded apps - Simplify active collection handling - Remove deprecated `OC_App` usage - Fully type Router methods Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
4f41e49 to
129983f
Compare
Yes TBH thought we removed all places not returning an array from routes.php in #42678 but seems like I missed that we still have the Probably revert this here :) |
|
Yeah, I had the issue with the cached routes PR, there are still routes returned by routes.php and relying on a file include. Yes |
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
|
With the tiny fix I pushed, it now works for old school routes: The main weird thing is the empty application. It should just use the application id it nows about. |
|
A command, to list routes, was added by: #53669 What about the fix for the router? |
Summary
Main idea was to add a command to list all registered routes, to make the annotation more usable.
But when doing so I noticed the Router is broken as retrieving individual collections of routes was broken,
so this also contains a fix for it:
and then merge them for the root collection holding all routes for the
URL generator.
OC_AppusageChecklist