porting 3.0 mods to 3.1 extensions...

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Paul Online
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 371
Joined: Thu Sep 16, 2004 9:02 am
Contact:

Re: porting 3.0 mods to 3.1 extensions...

Post by Paul »

By adding a key to the $data parameter (Which is a array) that already exists; https://github.com/phpbb/phpbb/blob/dev ... .php#L1646 By modifying any function signature you introduce high risks for conflicts.
asinshesq
Registered User
Posts: 156
Joined: Fri May 14, 2004 10:32 pm
Location: NYC

Re: porting 3.0 mods to 3.1 extensions...

Post by asinshesq »

You're right in the case of submit_post()...for example my save full drafts mod passes new variables to submit_post() via $data so that's a bad example :oops:

But there are plenty of other functions where arrays are not passed. What's the preferred way to pass a new variable to functions that do not have array parameters (e.g. the old user_notification() function)? Should we be using globals or should we be asking the developers to add if statements like nickvergessen suggested or is there a third way?
Last edited by asinshesq on Sun Oct 20, 2013 8:59 pm, edited 1 time in total.
Alan
User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: porting 3.0 mods to 3.1 extensions...

Post by nickvergessen »

Instead of theoratically discussion, please just name a place when you find one where one of your mods needs one.
Then we will see a way to fix it or make it work on another way.
Member of the Development-TeamNo Support via PM
asinshesq
Registered User
Posts: 156
Joined: Fri May 14, 2004 10:32 pm
Location: NYC

Re: porting 3.0 mods to 3.1 extensions...

Post by asinshesq »

I wasn't planning to sit down and determine what I need until I have some general rules. I think the questions remain:

- how should we pass additional variables to a function that doesn't already use array parameters we can tack onto? (I haven't studied the new core code yet, but If the new core code generally includes array parameters in every function then this problem is solved ;) )

- how should we 'replace' a block of code with a re-written block of code?

Do you want us to be suggesting if clauses in lots of places (it seems bizarre to me that extension authors are going to mess up the core code in this way) or are there other tricks we should consider?

I understand you want to talk about specific cases but if some simple rules are not communicated I fear that, as rxu said:
rxu wrote:...it seems that creating extensions for 3.1 is rather impossible for regular community member unlike it was for 3.0 MODs.
Alan
User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: porting 3.0 mods to 3.1 extensions...

Post by nickvergessen »

asinshesq wrote:Do you want us to be suggesting if clauses in lots of places (it seems bizarre to me that extension authors are going to mess up the core code in this way) or are there other tricks we should consider?
Adding tones of if() statements is not different to the fact that MODs deleted code of core files with a replace-with statement?
asinshesq wrote:I understand you want to talk about specific cases but if some simple rules are not communicated I fear that, as rxu said:
rxu wrote:...it seems that creating extensions for 3.1 is rather impossible for regular community member unlike it was for 3.0 MODs.
There is no simple rule like "replace your <add block> code with a call to <xyz>"
Each place you want to modify, we need to get to know and add an event in place. We then add the event for the next release and you can use it. That is the rule.
If you dont want to name the places where you need the events, we can not help you and your modification will never be an extension.
thats it, simple as is.
Member of the Development-TeamNo Support via PM
asinshesq
Registered User
Posts: 156
Joined: Fri May 14, 2004 10:32 pm
Location: NYC

Re: porting 3.0 mods to 3.1 extensions...

Post by asinshesq »

nickvergessen wrote:Adding tones of if() statements is not different to the fact that MODs deleted code of core files with a replace-with statement?
There are a huge number of validated mods for phpbb3.0.x, and a typical forum operator installs only a few. Are you planning on scattering if statements throughout the core code for every extension? That's a lot of if statements in the core code. I understood you were planning to stick in 'events' for every extension but I thought each event would be a one line standard form 'hook' that would be easy for you (the developers) to insert without spending a lot of time studying an author's planned extension. I didn't understand that you were planning on in effect becoming co-authors with the extension authors and if that's what's involved I don't see how that's going to be practical from your point of view.

Of course, this may just be my misunderstanding of what you are saying, and perhaps it's much easier than I think. Is there a single form of event code that will appear wherever authors ask for them and you approve?
nickvergessen wrote:There is no simple rule like "replace your <add block> code with a call to <xyz>"
Each place you want to modify, we need to get to know and add an event in place. We then add the event for the next release and you can use it. That is the rule.
If you dont want to name the places where you need the events, we can not help you and your modification will never be an extension.
thats it, simple as is.
I understood that, but what is it you (the developers) need to know for a typical extension? Do you just need to know where the author wants it and you will then insert the event if the request makes sense? (This goes back to my question above: is an event a single standard form line of code that you simply insert or is it more specialized for the extension that needs it?
Alan
User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: porting 3.0 mods to 3.1 extensions...

Post by nickvergessen »

You can ask for requests in the forum: https://area51.phpbb.com/phpBB/viewforum.php?f=111
We need to add 2 lines + docs for a php event: https://wiki.phpbb.com/Add_Events
Are you planning on scattering if statements throughout the core code for every extension?
No, but if an Ext requires it and it makes sense, we will add on.
I didn't understand that you were planning on in effect becoming co-authors with the extension authors and if that's what's involved I don't see how that's going to be practical from your point of view.
We just add stuff to phpBB nothing related to your extension. The only thing required, is that you as an ext dev need to communicate what we need to know so we can add it.

I suggest you click through the links related to events in the wiki, to understand the system a bit more in depth
Member of the Development-TeamNo Support via PM
User avatar
tbackoff
Registered User
Posts: 180
Joined: Sat Jun 12, 2010 3:25 am

Re: porting 3.0 mods to 3.1 extensions...

Post by tbackoff »

nickvergessen wrote:
Are you planning on scattering if statements throughout the core code for every extension?
No, but if an Ext requires it and it makes sense, we will add on.
What if it doesn't make sense? It seems like MOD Authors are then going to go back to the "old way" of requiring core file edits because the developers decided that an event wasn't practical in the code.
asinshesq
Registered User
Posts: 156
Joined: Fri May 14, 2004 10:32 pm
Location: NYC

Re: porting 3.0 mods to 3.1 extensions...

Post by asinshesq »

Will we still allow modx style mods with validation?? Or will those be history (other than on hack sites)?
Alan
User avatar
Master_Cylinder
Registered User
Posts: 361
Joined: Wed Jul 31, 2013 9:54 pm

Re: porting 3.0 mods to 3.1 extensions...

Post by Master_Cylinder »

t_backoff wrote:
nickvergessen wrote:
Are you planning on scattering if statements throughout the core code for every extension?
No, but if an Ext requires it and it makes sense, we will add on.
What if it doesn't make sense? It seems like MOD Authors are then going to go back to the "old way" of requiring core file edits because the developers decided that an event wasn't practical in the code.
If people install unapproved MODs then I doubt they'd get much support from phpBB if/when they hose their board. MOD or no-MOD, there's nothing to stop people from doing things they shouldn't.
These kids today...
Buy them books, send them to school and what do they do?

They eat the paste. :lol:
Post Reply