Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-03-27 08:06:24

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

[Solved] Too many plugin prefs throws a maximum execution time error

Hi,
It seems that adding too many plugin prefs can throw a maximum execution time error.
It is the case when displaying many players prefs via oui_player (see issue).
I guess that the better way to avoid that is to register my own plugin prefs tab, isn’t it?
If so, does anyone already have a kind of template or do I need to start from the core prefs tab?
Thanks…

Edit: fixed; my mistake!

Last edited by NicolasGraph (2017-03-27 14:05:10)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#2 2017-03-27 09:17:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,270
Website GitHub

Re: [Solved] Too many plugin prefs throws a maximum execution time error

NicolasGraph wrote #305060:

It seems that adding too many plugin prefs can throw a maximum execution time error.

Really? Roughly how many before it breaks? You mean the prefs panel times out? I find it difficult to fathom where that could happen unless your prefs are doing some intense querying or display wrangling. I’ll see if I can test it out in your plugin at some point and find out what’s going on.

I guess that the better way to avoid that is to register my own plugin prefs tab… does anyone already have a kind of template

You could take a look at smd_article_stats, in particular the smd_artstat_prefs() function, which sets everything up. That’s not the only way to do it, but an array structure sets up any prefs that haven’t been already made and the function is registered with the prefs tab. Nice and automated, and also ensures everything is set up even in plugin cache mode where lifecycle events don’t fire.

We should beef up the prefs handling in core at some point. Maybe make a prefs object that you can just call ->register() (or ->add()) on and have it added automatically to the tab of your choice and linked with the given rendering callback. That would complement the new prefs layout quite nicely I think, allowing you to add new ‘tabs’ of your own or supplement core prefs easily without a tonne of extra code. Might raise a feature request on GitHub for that actually so I don’t forget.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2017-03-27 09:42:09

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: [Solved] Too many plugin prefs throws a maximum execution time error

Bloke wrote #305061:

Really? Roughly how many before it breaks? You mean the prefs panel times out? I find it difficult to fathom where that could happen unless your prefs are doing some intense querying or display wrangling. I’ll see if I can test it out in your plugin at some point and find out what’s going on.

Yes, if you can install the plugin and go to the prefs tab, you’ll be able to display/hide up to ten providers player prefs as groups of prefs, and some have more than ten prefs themselves… I don’t exactly know when it breaks for now but trying to display all at the same time on mamp throws the error.

You could take a look at smd_article_stats, in particular the smd_artstat_prefs() function, which sets everything up…

I’ll give it a look, thanks, but I already have a custom way to set providers prefs and register related attributes which allow me to easily add providers classes without any extra works. My problem is mainly to find a way to avoid this maximum execution time error. I’m now trying to build a dedicated tab from the core prefs tab…

That would complement the new prefs layout quite nicely I think, allowing you to add new ‘tabs’ of your own or supplement core prefs easily without a tonne of extra code. Might raise a feature request on GitHub for that actually so I don’t forget.

Ok, I’ll do it thanks.

Last edited by NicolasGraph (2017-03-27 09:43:39)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#4 2017-03-27 09:51:35

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: [Solved] Too many plugin prefs throws a maximum execution time error

Maybe related to this?

Offline

#5 2017-03-27 11:49:02

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: [Solved] Too many plugin prefs throws a maximum execution time error

Stef, you’ve a typo in the Github URL (comma). Can’t fix it myself.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2017-03-27 12:17:03

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: [Solved] Too many plugin prefs throws a maximum execution time error

etc wrote #305066:

Maybe related to this?

Thanks Oleg; I’m performing more tests.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#7 2017-03-27 12:30:49

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: [Solved] Too many plugin prefs throws a maximum execution time error

Ok, In fact, the problem comes from the prefWidget() function used for my plugin prefs. If I just return text_input, avoiding to automatically parse some valid values to know what kind of widget to display (select, color type input, etc.), I’m able to display all plugin prefs (quite fastly). So I need to rework that…


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#8 2017-03-27 13:47:35

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: [Solved] Too many plugin prefs throws a maximum execution time error

Fixed.
Yes, I know… :-/


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

Board footer

Powered by FluxBB