Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-10864

Allow extensions to be accessed via controller with shorter access name than "vendor/extname"

    Details

    • Type: Improvement
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-dev
    • Fix Version/s: 3.1.0-a1
    • Component/s: Extensions
    • Labels:
      None

      Description

      Currently, in order to access an extension's front controller, you have to type in the URL /index.php?ext=vendor/extensionName

      These names can get long and ugly. Originally, I believe this was done to prevent duplication, but there are ways to make sure a duplicate name is not taken.

      As such, I propose we add a new column on the phpbb_ext table called "extension_controller" or something similar, which holds a string value of alphanumeric characters and underscores, which can then be used to access that extension's front controller. This would allow URLs like this instead: /index.php?ext=blog
      Note that the extension should still be accessible via the vendor/extname path if needed.

      The MOD/Extension team should require that extensions submitted to the CDB, that require use of a controller, have a unique, and brief but descriptive controller name. Also, there should be a check within phpBB when attempting to install an extension to make sure another extension does not have the same name. We could then either simply error out or provide the admin with a way to use his own controller name for that installation of the extension.

      Thoughts?

        Activity

        Hide
        EXreaction EXreaction [X] (Inactive) added a comment -

        I think use of some mod_rewrite would be significantly better. Most hosts support it and it would look significantly better than the ugly index.php?ext=blah URL.

        Show
        EXreaction EXreaction [X] (Inactive) added a comment - I think use of some mod_rewrite would be significantly better. Most hosts support it and it would look significantly better than the ugly index.php?ext=blah URL.
        Hide
        bantu Andreas Fischer added a comment -

        Requiring a webserver module for no reason other than "it would look significantly better" sounds like a no-go. Also, there are other webservers, especially nginx.

        Show
        bantu Andreas Fischer added a comment - Requiring a webserver module for no reason other than "it would look significantly better" sounds like a no-go. Also, there are other webservers, especially nginx.
        Hide
        EXreaction EXreaction [X] (Inactive) added a comment -

        I meant that rather than do a bunch of work to make it look slightly better for some modules, do the work to support mod_rewrite, and, if mod_rewrite is not supported by the server, just use the current URL scheme.

        Show
        EXreaction EXreaction [X] (Inactive) added a comment - I meant that rather than do a bunch of work to make it look slightly better for some modules, do the work to support mod_rewrite, and, if mod_rewrite is not supported by the server, just use the current URL scheme.
        Hide
        Oleg Oleg [X] (Inactive) added a comment -

        What does "supporting mod_rewrite" mean/involve?

        Show
        Oleg Oleg [X] (Inactive) added a comment - What does "supporting mod_rewrite" mean/involve?
        Hide
        imkingdavid David King added a comment -

        Here is a related IRC log from May 22nd, 2012:

        [2012-05-22 11:16:18] <battye> naderman, is there any plan to integrate some mod_rewrite functionality so that extensions don't necessarily have to be called by index.php?ext=<extname>... and can be invoked by http://.../phpBB/<extname>.php ?
        [2012-05-22 11:18:28] <naderman> you should ask imkingdavid about that
        [2012-05-22 11:18:35] <imkingdavid> imo we should let extension authors choose the name by which their extension is accessed. so then we can do a mod_rewrite on any page that does not exist as a file or folder and have that be sent to the ext= parameter, and then have another row on the extensions table to check against.
        [2012-05-22 11:18:47] <naderman> indeed
        [2012-05-22 11:18:56] <naderman> I still don't think we should have only one controller per extension
        [2012-05-22 11:19:05] <naderman> and the parameter should be a free choice
        [2012-05-22 11:19:36] <naderman> imkingdavid: it should not be on the extension table
        [2012-05-22 11:19:45] <naderman> you can simply use the extension finder to find all controllers
        [2012-05-22 11:19:55] <naderman> call a method getName or some such on them
        [2012-05-22 11:20:01] <naderman> and then cache the result as a lookup table
        [2012-05-22 11:20:02] <battye> I agree, I think that if you give mod authors that flexibility then the shift to extensions will be swift
        [2012-05-22 11:20:05] <naderman> no need to put that in the db at all
        [2012-05-22 11:20:40] <imkingdavid> well, I'll add that to my todo unless someone else wants to look into it.
        [2012-05-22 11:20:56] <naderman> and the parameter should be something more generic than ext
        [2012-05-22 11:21:00] <naderman> just controller would do I guess
        [2012-05-22 11:21:13] <battye> naderman, if it were stored in the database would it not allow - at some point - the possibility of adding an extensions manager to the acp and allowing users to define the names that the extensions could be accessed?
        [2012-05-22 11:22:03] <imkingdavid> i agree with battye. then the board admin could say.. "hmm I like 'gallery' instead of 'mygallery' for accessing the gallery extension, so I want to change that"
        [2012-05-22 11:22:10] <imkingdavid> if it's in the db, they can just change it via the extension manager
        [2012-05-22 11:23:35] <naderman> battye: you can certainly do that, but it should definitely not go in the extension table
        [2012-05-22 11:23:41] <naderman> and it's not something for the extension manager at all
        [2012-05-22 11:23:46] <naderman> imkingdavid: if anything you can add a controller manager
        [2012-05-22 11:23:56] <naderman> because this is an entirely separate issue from extensions
        [2012-05-22 11:24:01] <naderman> we can even define controllers in core phpbb
        [2012-05-22 11:24:06] <naderman> there is nothing that ties them to extensions
        [2012-05-22 11:24:09] <imkingdavid> hmm
        [2012-05-22 11:24:22] <imkingdavid> so then we could for instance add a 'topic' controller that accesses viewtopic.php?
        [2012-05-22 11:24:26] <naderman> yes
        [2012-05-22 11:24:30] <naderman> or rather
        [2012-05-22 11:24:33] <naderman> viewtopic.php is a controller
        [2012-05-22 11:24:38] <naderman> it's just written poorly
        [2012-05-22 11:24:49] <imkingdavid> okay
        [2012-05-22 11:24:54] <imkingdavid> that's a nice idea
        [2012-05-22 11:25:09] <naderman> well it's how any other web software works

        As such, I'll look into creating a controller class to handle controllers.

        Show
        imkingdavid David King added a comment - Here is a related IRC log from May 22nd, 2012: [2012-05-22 11:16:18] <battye> naderman, is there any plan to integrate some mod_rewrite functionality so that extensions don't necessarily have to be called by index.php?ext=<extname>... and can be invoked by http://.../phpBB/ <extname>.php ? [2012-05-22 11:18:28] <naderman> you should ask imkingdavid about that [2012-05-22 11:18:35] <imkingdavid> imo we should let extension authors choose the name by which their extension is accessed. so then we can do a mod_rewrite on any page that does not exist as a file or folder and have that be sent to the ext= parameter, and then have another row on the extensions table to check against. [2012-05-22 11:18:47] <naderman> indeed [2012-05-22 11:18:56] <naderman> I still don't think we should have only one controller per extension [2012-05-22 11:19:05] <naderman> and the parameter should be a free choice [2012-05-22 11:19:36] <naderman> imkingdavid: it should not be on the extension table [2012-05-22 11:19:45] <naderman> you can simply use the extension finder to find all controllers [2012-05-22 11:19:55] <naderman> call a method getName or some such on them [2012-05-22 11:20:01] <naderman> and then cache the result as a lookup table [2012-05-22 11:20:02] <battye> I agree, I think that if you give mod authors that flexibility then the shift to extensions will be swift [2012-05-22 11:20:05] <naderman> no need to put that in the db at all [2012-05-22 11:20:40] <imkingdavid> well, I'll add that to my todo unless someone else wants to look into it. [2012-05-22 11:20:56] <naderman> and the parameter should be something more generic than ext [2012-05-22 11:21:00] <naderman> just controller would do I guess [2012-05-22 11:21:13] <battye> naderman, if it were stored in the database would it not allow - at some point - the possibility of adding an extensions manager to the acp and allowing users to define the names that the extensions could be accessed? [2012-05-22 11:22:03] <imkingdavid> i agree with battye. then the board admin could say.. "hmm I like 'gallery' instead of 'mygallery' for accessing the gallery extension, so I want to change that" [2012-05-22 11:22:10] <imkingdavid> if it's in the db, they can just change it via the extension manager [2012-05-22 11:23:35] <naderman> battye: you can certainly do that, but it should definitely not go in the extension table [2012-05-22 11:23:41] <naderman> and it's not something for the extension manager at all [2012-05-22 11:23:46] <naderman> imkingdavid: if anything you can add a controller manager [2012-05-22 11:23:56] <naderman> because this is an entirely separate issue from extensions [2012-05-22 11:24:01] <naderman> we can even define controllers in core phpbb [2012-05-22 11:24:06] <naderman> there is nothing that ties them to extensions [2012-05-22 11:24:09] <imkingdavid> hmm [2012-05-22 11:24:22] <imkingdavid> so then we could for instance add a 'topic' controller that accesses viewtopic.php? [2012-05-22 11:24:26] <naderman> yes [2012-05-22 11:24:30] <naderman> or rather [2012-05-22 11:24:33] <naderman> viewtopic.php is a controller [2012-05-22 11:24:38] <naderman> it's just written poorly [2012-05-22 11:24:49] <imkingdavid> okay [2012-05-22 11:24:54] <imkingdavid> that's a nice idea [2012-05-22 11:25:09] <naderman> well it's how any other web software works As such, I'll look into creating a controller class to handle controllers.
        Hide
        imkingdavid David King added a comment -

        The current patch uses the Symfony2 Framework to handle routing through app.php to execute a controller object/method that is resolved from the URL route.

        Show
        imkingdavid David King added a comment - The current patch uses the Symfony2 Framework to handle routing through app.php to execute a controller object/method that is resolved from the URL route.

          People

          • Assignee:
            Unassigned
            Reporter:
            imkingdavid David King
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development