Skip to content

[regression] [master] App routes are loaded before the app itself #18095

Closed

Description

@RobinMcCorkell

After #17961, app routes are loaded before the app itself is loaded, as the URLGenerator used in OC_Defaults requires a Router, which in turn loads all routes, but this all occurs before any apps are loaded. If an app does initialization in appinfo/app.php which is required in appinfo/routes.php, then that app will cause errors. I'm not sure if there are any apps that will display these issues, but it's still bad that the app routes are getting loaded before the app itself.

Relevant backtrace from when I noticed it (was unit testing at the time):

PHP  10. OC::init() /srv/local/owncloud/core/lib/base.php:1125
PHP  11. OC_Util::checkServer() /srv/local/owncloud/core/lib/base.php:608
PHP  12. OC_Defaults->__construct() /srv/local/owncloud/core/lib/private/util.php:571
PHP  13. OC\URLGenerator->linkToRoute() /srv/local/owncloud/core/lib/private/defaults.php:69
PHP  14. OC\Route\CachingRouter->generate() /srv/local/owncloud/core/lib/private/urlgenerator.php:65
PHP  15. OC\Route\Router->generate() /srv/local/owncloud/core/lib/private/route/cachingrouter.php:53
PHP  16. OC\Route\Router->loadRoutes() /srv/local/owncloud/core/lib/private/route/router.php:305
PHP  17. OC\Route\Router->requireRouteFile() /srv/local/owncloud/core/lib/private/route/router.php:155
PHP  18. include_once() /srv/local/owncloud/core/lib/private/route/router.php:315

Activity

  1. changed the title [-]App routes are loaded before the app itself[/-] [+][regression] App routes are loaded before the app itself[/+] on Aug 6, 2015
  2. changed the title [-][regression] App routes are loaded before the app itself[/-] [+][regression] [master] App routes are loaded before the app itself[/+] on Aug 6, 2015
  3. RobinMcCorkell commented on Aug 6, 2015

    @RobinMcCorkell
    ContributorAuthor
  4. PVince81 commented on Aug 6, 2015

    @PVince81
    Contributor

    I suggest to directly call \OC::$server->getURLGenerator()->linkToRoute('settings_help') in getKnowledgeBaseUrl().

  5. schiessle commented on Aug 6, 2015

    @schiessle
    Contributor

    Might solve the problem but I'm not sure if I like the solution.

    1. it breaks the pattern of default.php where all default values are defined at the top next to each other and can be changed easily.
    2. I have the feeling that this would just solve the symptom but not the root of the problem. The next time someone creates a route to early we will run into the same issue again. Therefor I would prefer to fix it deeper in the stack so that it no longer matter when you create a route. But I'm not sure if this would be possible without to much changes. @LukasReschke afaik you worked on the routing stuff in the past. Any ideas?
  6. RobinMcCorkell commented on Aug 6, 2015

    @RobinMcCorkell
    ContributorAuthor

    Setting severity high as this is currently blocking the refactor of files_external (and could be breaking other apps too)

  7. locked as resolved and limited conversation to collaborators on Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions