Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[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)
Offline
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
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)
Offline
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
Offline
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…
Offline
Offline