Child Extensions

https://www.phpbb.com/ideas/
Post Reply
User avatar
Louis7777
Registered User
Posts: 247
Joined: Sat Apr 21, 2012 9:22 pm

Child Extensions

Post by Louis7777 » Mon Oct 30, 2017 1:51 pm

Similarly to the style inheritance that we already have, we could also have extension inheritance.

Use case:

Create a new extension from an existing extension (that will be normally updated) and then override some of its template files.

That will allow us to modify template files of extensions without the danger of any modifications being affected upon an update.

It will bring customizability to a whole new level.

User avatar
Toxyy
Registered User
Posts: 697
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek
Contact:

Re: Child Extensions

Post by Toxyy » Mon Oct 30, 2017 7:57 pm

I agree that this should be added but how should it be implemented?
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts || [3.2][BETA] Sticky Ad || [3.2][RC] Show User Activity ||
[3.2][DEV] User Delete Topics

User avatar
Bryx
Registered User
Posts: 18
Joined: Mon Oct 30, 2017 7:14 am
Contact:

Re: Child Extensions

Post by Bryx » Tue Oct 31, 2017 7:41 am

I hadn't even thought about it, it's a very good idea and it complements a bit the duo between styles and extensions. Good idea!
Thank you, Bryx
- bryx.fr

User avatar
Ger
Recognised Extension Developer
Posts: 1850
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Child Extensions

Post by Ger » Tue Oct 31, 2017 8:53 am

You can already put style specific files in an extension. Default there is prosilver and maybe an "all" that's used as fallback. You can easily create a folder like
./ext/vendor/ext_name/style/style_name/template/file_name.html
If that style inherits from prosilver, it works just like it works with the inheritance structure of "regular" styles.

Now if I understand you correctly, you want to be able to put such files in
./styles/style_name/ext/vendor/ext_name/template/file_name.html
That basically shifts the files from the extension package to the style package. In any case, I doubt that style developers don't want to support each and every extension, just like I (as extension author) don't want to support each and every style.

So in the end I don't think it solves anything, it just replaces one problem with another. Now you could argue that making both possible (e.g. that phpBB looks in both directories for the required files) but that would only overcomplicate things. What if files are available on both places? Which one should be used?

Now, I haven't voted yet because you do make a valid point: extensions and styles do have conflicts in this matter so there might be room for improvement. I just don't see a solution just yet. :)
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

User avatar
david63
Registered User
Posts: 16173
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Child Extensions

Post by david63 » Tue Oct 31, 2017 4:47 pm

The problem that I see from an extension developer's perspective is that if I change my extension and there is a "child" extension using that extension then there is a possibility that the child extension would stop working thereby creating problems for the child extension developer and possibly the parent extension developer.

As Ger says there is nothing to stop anyone creating their own template files for any extension either to add additional features or to work better with a particular style.

There are other, and in my opinion better, ways of achieving this:
  • You ask the original extension developer if they will incorporate your changes.
  • You fork the original extension and create another one with your changes in it.
  • You can even ask the original extension developer to add events in their extension for you to use.
As I see this it would probably only be used for "one off" changes by individual users and if the changes were more significant then it should be a new extension.

There would also be potential validation issues.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Louis7777
Registered User
Posts: 247
Joined: Sat Apr 21, 2012 9:22 pm

Re: Child Extensions

Post by Louis7777 » Thu Nov 02, 2017 5:53 pm

Toxyy wrote:
Mon Oct 30, 2017 7:57 pm
I agree that this should be added but how should it be implemented?
It could mimic the way WordPress does it with child themes. If the Child Extension has a file with the same name as the parent's, then it should override it.
Ger wrote:
Tue Oct 31, 2017 8:53 am
[...]
What I would like to do - say if I have an extension named "Ger" - is to make a new folder in the extensions directory and create a child extension "GerChild".

It will be a child extension, just because in the configuration file I will reference the parent that I want it to have. In this case "Ger".

Ultimately, what I want to achieve is to put in GerChild the same files with the same folders and names as in Ger and cancel / override those of the parent i.e. "if there is a child and if the child has that then don't use the parent's".

The goal is obvious - I want to be able to keep my changes, that's all. Whenever the parent gets updated, I get to keep my changes in the child.

Sure the child might break, however, that's also a risk with child themes, isn't it (although broken html /css isn't as hazardous)?
david63 wrote:
Tue Oct 31, 2017 4:47 pm
The problem that I see from an extension developer's perspective is that if I change my extension and there is a "child" extension using that extension then there is a possibility that the child extension would stop working thereby creating problems for the child extension developer and possibly the parent extension developer.

As Ger says there is nothing to stop anyone creating their own template files for any extension either to add additional features or to work better with a particular style.

There are other, and in my opinion better, ways of achieving this:
  • You ask the original extension developer if they will incorporate your changes.
  • You fork the original extension and create another one with your changes in it.
  • You can even ask the original extension developer to add events in their extension for you to use.
As I see this it would probably only be used for "one off" changes by individual users and if the changes were more significant then it should be a new extension.

There would also be potential validation issues.
The problems with your suggestion are that (1) for every little thing I have to poke the original developer and (2) that if I fork the original extension then I'll have to be the one to update and keep track of the changes in the original one.

Also, if create my own template files and / or CSS for an extension, when it gets updated I will lose it all, isn't that right?

Finally, it's true that a child extension may stop working, but

(1) the parent can be normally updated and shouldn't be affected at all (i.e. we can disable the child and continue working using the parent)

(2) that's a risk that we should be willing to take in favor of customization and

(3) we already have child themes that can break if the parent gets updated, isn't that right?

User avatar
david63
Registered User
Posts: 16173
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Child Extensions

Post by david63 » Fri Nov 03, 2017 12:02 am

Louis7777 wrote:
Thu Nov 02, 2017 5:53 pm
if I fork the original extension then I'll have to be the one to update and keep track of the changes in the original one.
Not necessarily - your forked version will still work but if you want to have the changes included in your fork then yes you will need to update your fork, but that will be a simple matter of doing a pull request. With a child extension you are still going to have to monitor any changes and possibly add them manually.
Louis7777 wrote:
Thu Nov 02, 2017 5:53 pm
if create my own template files and / or CSS for an extension, when it gets updated I will lose it all, isn't that right?
Probably - but you would have a copy of them wouldn't you and it would only take a couple of minutes to drop them into the updated extension.
Louis7777 wrote:
Thu Nov 02, 2017 5:53 pm
we already have child themes that can break if the parent gets updated, isn't that right?
Yes but with child styles they are based on the core style which is maintained by the phpBB team unlike extensions which, in general, are not. Also I believe that at some point child styles will no longer exist.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Louis7777
Registered User
Posts: 247
Joined: Sat Apr 21, 2012 9:22 pm

Re: Child Extensions

Post by Louis7777 » Fri Nov 03, 2017 4:50 am

david63 wrote:
Fri Nov 03, 2017 12:02 am
Not necessarily - your forked version will still work but if you want to have the changes included in your fork then yes you will need to update your fork, but that will be a simple matter of doing a pull request. With a child extension you are still going to have to monitor any changes and possibly add them manually.
Thing is, I always like to have bleeding edge. The latest phpBB version and the latest versions for my installed extensions. Thus, I will have to hit that update button very often.

With a forked version I'll have to do a pull to get all the latest changes and since that will overwrite my own changes that I want to keep (of course I'll have them somewhere saved and do a diff), I'll have to do an extra step and reapply them.

With a child extension, however, I will only have to press a button in the ACP and update the original extension (hopefully that will be the case for phpBB v3.3), and ONLY if I notice any problems in my child extension (e.g. in its appearance or functionality) then I'll have to take actions such as to find out the newest changes in the parent and readjust my changes in the child. Plus, it would be very easy to spot the problem since a child extension would usually only contain a very small portion of the parent - just a few overridden files.

But if I've only overridden some CSS and template files, chances are that I'll hardly ever have to take any action since newer extension versions usually involve bug fixes, new features and performance updates rather than major changes in the HTML structure, changed IDs and class names etc.

And most importantly, it wouldn't be easy for a noob to fork extensions and do pull requests, whereas even an amateur can hit an "install" button in the ACP and then find out in phpBB's documentation that if he wants to customize the extension he can (1) create a new folder for a child extension and simply add a config file with "parent: <parent extension name>" (2) copy in there the files he wants from the parent (3) change them.
david63 wrote:
Fri Nov 03, 2017 12:02 am
Probably - but you would have a copy of them wouldn't you and it would only take a couple of minutes to drop them into the updated extension.
Of course, but that's not convenient and it's a hassle. That's not a way to maintain a website - not for a neat freak. At least, that's what I think. I would sigh every time I would hit the update button for an extension, because I would have to reapply all the changes! Whereas if I had child extensions, chances are that I wouldn't have to take any further actions after hitting that button.

User avatar
david63
Registered User
Posts: 16173
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Child Extensions

Post by david63 » Fri Nov 03, 2017 8:02 am

One of the things I am struggling with in regard to this idea is a "usage case" - perhaps if someone could give an example of how this would be used it might be easier to understand, because at the moment I cannot see how it would be used.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Louis7777
Registered User
Posts: 247
Joined: Sat Apr 21, 2012 9:22 pm

Re: Child Extensions

Post by Louis7777 » Sat Nov 04, 2017 1:48 am

david63 wrote:
Fri Nov 03, 2017 8:02 am
One of the things I am struggling with in regard to this idea is a "usage case" - perhaps if someone could give an example of how this would be used it might be easier to understand, because at the moment I cannot see how it would be used.
Okay, let's see. With most extensions I usually want to fit them to my style, but I would rather not poke the author to support a specific style and I may as well be using a child theme that he doesn't know anything about. Also, I would rather not make any changes to the original extension since they will be lost after an update and I'll have to reapply them (that's where the problem lies).

So let's say that I want to change the appearance of the popular extension "mchat". I'll do the following:

1) I create a new extension at ./ext/louis/mchatchild/ with only the necessary configuration files. In one of them I should be able to type something like this "parent": "dmzx/mchat" to specify the original extension.

2) Then I can copy ./ext/dmzx/mchat/styles/stylename/template/file_name.html and ./ext/dmzx/mchat/styles/stylename/theme/stylesheet.css and paste them at ./ext/louis/mchatchild/styles/stylename/template/file_name.html and ./ext/louis/mchatchild/styles/stylename/theme/stylesheet.css respectively. I will then proceed to change the HTML and CSS to how I want, and I'll have successfully overridden those two files.

The original extension will stay unaffected and will be normally updated. My child extension will have very few files in it - apart from the configuration file it will only have overridden files with nice comments to know what has been changed.

Maybe Child Extensions isn't the best solution to the problem, but there is a problem. I hope that you can see my point. I would like a way to override an extension and keep my changes unaffected during updates, be it with a child extension or with an overrides file in the original extension or with something else.

User avatar
david63
Registered User
Posts: 16173
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Child Extensions

Post by david63 » Sat Nov 04, 2017 7:39 am

I understand that scenario and it has always been there - even with mods.

I don't believe that going to the effort of creating "child" extensions is the right way to go when effectively all you are wanting is to create another level, with undoubtedly additional complications, where there is already a method of dealing with what it is that you want - simply dropping a folder into an extension.

I think we are at a point here where we will have to agree to differ on this.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Louis7777
Registered User
Posts: 247
Joined: Sat Apr 21, 2012 9:22 pm

Re: Child Extensions

Post by Louis7777 » Sat Nov 04, 2017 1:26 pm

david63 wrote:
Sat Nov 04, 2017 7:39 am
I understand that scenario and it has always been there - even with mods.

I don't believe that going to the effort of creating "child" extensions is the right way to go when effectively all you are wanting is to create another level, with undoubtedly additional complications, where there is already a method of dealing with what it is that you want - simply dropping a folder into an extension.

I think we are at a point here where we will have to agree to differ on this.
Alright, you don't agree with the method presented here, that's reasonable, and maybe you are right, maybe it is too much and it's not the best approach to achieve what I want.

However, don't you think there should be a better way other than "simply dropping a folder into an extension"?

The future is about clicking buttons and updating everything that way. One can't possibly have to reapply - by copy-pasting files - all the changes manually for every extension every time he / she updates multiple extensions.

How about - instead of child extensions - just a single configuration file for overrides? For example, an overrides.json, in each extension's directory, where you can specify the original file you want to override and the changed file which could be inside an overrides folder. The overridden files shouldn't be touched upon an update.

What do you think?

User avatar
david63
Registered User
Posts: 16173
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Child Extensions

Post by david63 » Sat Nov 04, 2017 3:20 pm

I am not disagreeing that there could be an easier way to load "other" styles into an extension (and the same problem exists for language packs) and perhaps having some mechanism within the extension to load them from there might be a way forward.

One other point to bear in mind is that the framework for styles will shortly be changing and that may have an impact on this issue - in fact it may mean that the problem will not exist.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Louis7777
Registered User
Posts: 247
Joined: Sat Apr 21, 2012 9:22 pm

Re: Child Extensions

Post by Louis7777 » Sat Nov 04, 2017 4:55 pm

david63 wrote:
Sat Nov 04, 2017 3:20 pm
I am not disagreeing that there could be an easier way to load "other" styles into an extension (and the same problem exists for language packs) and perhaps having some mechanism within the extension to load them from there might be a way forward.
Do you think that a single configuration file within the extension (e.g. overrides.json or .yml) would be a good approach? It could also handle language files.

(I've seen similar techniques with other software such as PrestaShop)

Post Reply

Return to “phpBB Ideas”