Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 02:01 pm EST

Geeklog Forums

Some advice


Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
Today for the second time this week, my site's mysql server crashed due to the gus_userstats table getting too big.
I've know of this issue in the past and usually watch it close enough to empty the stats when they grow too large.
But this particular problem is of my own doing. My new jQchat plugin queries jQchat/process.php every 2 seconds or so.
And as lib-common.php is included, each request is a hit for GUS.
No problem to fix the issue, add the page to the gus_ignore_page table.

Now for the question...
I want to add jQchat/process.php to gus_ignore_page automatically if GUS is installed so new and novice admins don't need to figure it out themselves.
What would the best way to go about this be?
Should I:
  • Add a check to jQchat functions.inc to check for the GUS plugin and if installed make sure the DB entry exists this would happen every time functions.inc is included.
  • Insert the entry during installation and be oblivious if GUS is installed at some later time
  • Add a warning in jQchat admin w/ maybe an easy insert button


further ideas and feedback welcomed.

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
I would probably add the warning with the easy insert button along with an ignore button to remove the warning if the users do not need it.
One of the Geeklog Core Developers.
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
The real solution is to not include lib-common.php. Not a simple solution, I know. But there should be a "mini" lib-common.php for AJAX style items to use since they are not "hits" to the site. Most of lib-common.php is HTML/GUI tools that AJAX stuff doesn't need. So you would include lib-database, lib-sessions, lib-security, etc (COM_applyFilter). Then the question is do you include the plugins functions.inc. And again, probably not. Most of functions.inc in a plugin is also there to support HTML/GUI stuff. So if Geeklog made a standard solution to this, that solution should also be to move any "important" plugin functions to a similar "minifuncs.inc" file in the plugin.

Looking through lib-common we find the follow is necessary:

set_errorhandler
include siteconfig.php
include config.class.php
load it
check site-enabled
most of the include up the theme selection (stop, don't include it)
cookie handling
who's online
locales
user group and permissions load (which should be part of lib-sessions.php, not sure why it's here)

That gets use line 435 or so. At this point most of the functions that follow, if they aren't used in the beginning of the file, are not needed.
COM_errorLog and COM_accessLog might be needed
COM_checkWords and the various template handling functions might be needed
Mail functions should be in a lib-mail.php
Skip all the block stuff
COM_getDisplayName
COM_formatTimeString, COM_getUserDateTimeFormat (probably should be in lib-user)
COM_checkSpeedLimit, update, clear (should be in lib-session or lib-security)
COM_buildURL, COM_setArgName, COM_getArgument
COM_getPermSQL, COM_getTopicSQL (should be in lib-security)
Filters, sanitize, clickable links, date and number functions are in mini lib-common

Finally there would be something like:

foreach ($_PLUGINS as $pi_name) {
require_once $_CONF['path'] . 'plugins/' . $pi_name . '/service.inc';
}

And the cron job functions would not exist.

This proposed lib-minimal.php might be annoying to maintain but it would make AJAX better all around.
 Quote

All times are EST. The time is now 02:01 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content