PDA

View Full Version : scheduled task php script


indie
Tue 17th May '05, 6:59pm
Would anyone be kind enough to write a PHP script to run this simple query:

UPDATE subscriptionlog SET pusergroupid = 2;

Thanks if you can!

Marco van Herwaarden
Wed 18th May '05, 1:35am
Although this belong at vbulletin.org, here you go:
<?php
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($DB_site))
{
exit;
}
$DB_site->query("UPDATE " . TABLE_PREFIX . "subscriptionlog SET pusergroupid = 2");
log_cron_action('Previous Subscription Groups Updated', $nextitem);

?>
Just put it in a new php-script in your ./includes/cron directory and setup a new Scheduled Task.

indie
Wed 18th May '05, 1:42am
Thanks!

indie
Sat 24th Jun '06, 4:41am
I noticed this script stopped working awhile ago, it's not in my logs (since October 2005). Can anyone tell me how to fix it to get it to run with the latest vB? Thanks

Colin F
Sat 24th Jun '06, 5:34am
Try using this:

<?php
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "subscriptionlog SET pusergroupid = 2");
log_cron_action('Previous Subscription Groups Updated', $nextitem);

?>

indie
Sat 24th Jun '06, 3:00pm
Works once again, thanks! PS - Will this work with 3.6?

Marco van Herwaarden
Sat 24th Jun '06, 5:51pm
Yes the version posted by Colin, will work in both vBulletin 3.5 and 3.6.

Primal Rage
Wed 13th Sep '06, 10:51am
Try using this:

<?php
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "subscriptionlog SET pusergroupid = 2");
log_cron_action('Previous Subscription Groups Updated', $nextitem);

?>


I am hoping someone can help me as my coding is not the best, esentially the above script is what i need with a minor modification. Instead of changing all pusergroupid to 2, i want it to only change the pusergroupid to 2 if it currently equals 21.

so kinda like "IF pusergroupid = 21, CHANGE to pusergroupid = 2"

Any help would be appreciated.

Colin F
Wed 13th Sep '06, 11:00am
Replace this:
UPDATE " . TABLE_PREFIX . "subscriptionlog SET pusergroupid = 2
with:
UPDATE " . TABLE_PREFIX . "subscriptionlog SET pusergroupid = 2 WHERE pusergroupid = 21

Primal Rage
Wed 13th Sep '06, 11:22am
It worked great, thanx a million. Saved me a ton of work.