WildcardSearch / Advanced-Sidebox

A plugin for MyBB forums that displays custom boxes on various forum pages.
GNU General Public License v3.0
20 stars 10 forks source link

Request: Portal template or other options #92

Closed Kretol closed 11 years ago

Kretol commented 11 years ago

It seems that when Adv. Sidebox is enabled and the option to replace portal boxes is set, there is no custom template to replace the normal portal template not being used. I've customized it a bit to add an extra table at the top (a sort of welcome box), so would like to request either a custom template (maybe for the middle area, considering the side is of course replaced by existing configuration) or other options to customize the portal somehow to facilitate it.

Thank you!

WildcardSearch commented 11 years ago

Hi @Kretol :smile:

Believe it or not, I am actually working on some big changes for ASB right now that will solve your issues. I've been talking for a while about giving admin more control over all the scripts (not just portal.php) and how they are implemented but I've only really been able to get started this weekend.

It is going great and although there is still lots to do, I feel good about the possibilities for ASB 2.0 . . .

Just be patient and I'll release something when I can.

avril-gh commented 11 years ago

Yeee ~ ASB 2.0 , sounds good :rabbit:

WildcardSearch commented 11 years ago

:smile_cat:

I am making good progress.

Still trying to decide whether to maintain backward compatibility or to consider the 2.0 series completely separate.

I'll warn you guys: structurally the changes (so far) have been huge. I am tired of looking at all those long file names and weird and inconsistent setting/variable/table/field names. So I have been really breaking things down as I work and the next version should be a lot cleaner in addition to the new features.

Also (now I am just rambling :D ) I am caching EVERYTHING now-- no more huge GOD class, no more queries AT ALL on the forum side*. That part is already working on my test copy and should have been done from the beginning (but I didn't know :frowning:

EDIT: * I mean the core, obviously add-on modules will use some queries.

avril-gh commented 11 years ago

(...) should have been done from the beginning (but I didn't know)

Remember when we talked that i prefer to foresight when designing something, and you always reply to me but for now lets just look here and now ? It was exacly the thing i tried to tell you when i said im worried because there is something and used metaphors like it seems to be going into bushes from where it may be hard to come back. You was confused by this metaphor, but i thought that you are so enthusiastic about everything, that its not yet the time to say it straight, while it may require huge redesigning, (dont want to say start over some parts) which you would be not happy to do at time when you was sure that its just perfect. So i keept this to myself and dressed it into metaphor, having hope that sooner or later you will find it out, and come with this idea by yourself._

The meaning of this metaphor was : with every update it tends to use more and more queries on front page even at time while nothing was enabled, and if it will continue this way, at some point there will be so many queries it will require redesigning, which is better to do before it happen

Looking forward to see how you will design this in 2.0 If i would make it myself, i would make one table, then every plugin and its settings would be one row, then at beginning of execution i would read all rows from this table at once (thats 1 query), convert result with these rows to global array (so it can be read from, multiple times throught all functions flow, without need for next and next queries of the same table for every plugin) That would be just 1 query and if you would additionaly cache this query (and update only at writes) it would be zero queries on front page.

So instead of

$query = $db->query('something');
while ($row = $db->fetch_array($query)) {
}
$query = $db->query('something');
while ($row = $db->fetch_array($query)) {
}

It would be

// only after write, fetch all and convert to array $myQuery and put to cache
$query = $db->query('something');
while ($row = $db->fetch_array($query)) {
    $myQuery[] = $row;
}
// then at beginning of execution get this array
$myQuery = $cache->read('myQuery');
// and then can iterate throught this data as many times as you want everywhere
// without even changing code too much
foreach ($myQuery as $row) {
    // and the rest is the same but just iterate with foreach instead of while, and thats zero queries
}

...and oh, If certain plugin is not displayed on current page then do not run his hook to not let it to do his own unnecessary queries while its not displayed anyway.

(Only queries if any would be the ones done by plugins but you would simply say not my fault, blame plugin author not me, cos asb itself do zero queries)

WildcardSearch commented 11 years ago

You are absolutely right when you say that you tried to warn me. I am truly sorry I did not listen, but in my defense it was because I could not see past what I was doing at that moment.

Thankfully, I am slowly solving most of the issues you address by using the MyBB $cache

Basically when admin makes any change, a flag is thrown that is read by the forum side. When the has_changed flag is true then the plugin builds a cache of all necessary info for ASB (and only the necessary stuff) . . . on every launch in which the has_changed flag evaluates to false the plugin works entirely from the cache so the only queries will be in the add-on modules themselves (and then only if they are in use, of course).

WildcardSearch commented 11 years ago

Okay @avril-gh and @Kretol I got 2.0 up and running. There are a few things that need to be addressed, but so far, so good :smile_cat:

With the new system, you should be able to solve your issues, @kretol

Kretol commented 11 years ago

Thank you much! :+1:

WildcardSearch commented 11 years ago

You're certainly welcome. Some bugs cropping up but I will work through them and hopefully it will smooth out soon. :smile: