The plugin system works by storing all plugin code for all scripts in memory, so you can quickly find your plugins using large amounts of memory if they contain a lot of code.
A simple way to avoid this problem is to use the plugin code simply to
call an external script, which contains all the complex code. In this way the code is only loaded when it is actually required.
For example, a plugin could contain this:
$tmp_uid =& $vbulletin->userinfo['userid'];
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "profilelog
(userid, dateline)
VALUES
($tmp_uid, " . TIMENOW . ")
");
or alternatively, that code could be placed into a file called (for example) plugins/my_script.php, and the plugin itself would contain this:
include('./plugins/my_script.php');
Naturally, the second option will use up far less memory than the first, and this saving will become more and more beneficial as the amount of code to be run increases.
Copyright © 2024 MH Sub I, LLC dba vBulletin. All rights reserved. vBulletin® is a registered trademark of MH Sub I, LLC dba vBulletin.
<?php
// your plugin code goes here
?>