From: Verdon V. <ve...@ve...> - 2007-02-04 21:31:24
|
Hi, I'm trying to cobble together something kind of customized to do some maintenance on a phpws 0.10.2 site and am running into timeout errors. I'm hoping someone might be able to suggest an alternative method for me. The error is PHP Fatal error: Maximum execution time of 30 seconds exceeded in / home/user/public_html/dev/en/lib/pear/DB/mysql.php on line 316 The goal of the script is that I have a table with member profiles that include an expiration date. I need a script that can look at that table, find the expired users, then look up the corresponding user and remove them from a couple groups. Eventually, this script will get run via cron. I am just getting started... <?php require_once("/home/user/public_html/dev/en/conf/config.php"); define('PHPWS_SOURCE_DIR', $source_dir); require_once PHPWS_SOURCE_DIR . 'security.php'; require_once PHPWS_SOURCE_DIR . 'core/Core.php'; require_once PHPWS_SOURCE_DIR . 'mod/users/class/Users.php'; require_once PHPWS_SOURCE_DIR . 'mod/users/class/Groups.php'; $GLOBALS['core'] =& new PHPWS_Core(NULL, NULL); $today = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d"), date("Y"))); /* first get the array of expired members */ $expiredMembers = $GLOBALS["core"]->sqlSelect ("mod_cstmembers_members", "expiryDate", $today, NULL, "<", NULL, NULL, NULL, NULL, TRUE); /* then loop through them */ foreach ($expiredMembers as $member){ /* get the user_id */ $user_id = PHPWS_User::getUserId($member['owner']); if ($user_id) { /* remove them from the groups */ $group_id = 1; PHPWS_User_Groups::removeGroupFromUser($user_id, $group_id); } } ?> Thanks, verdon |