PDA

View Full Version : Universal Cron Job Clean up (collective work from vb.org programmers)


T3MEDIA
03-04-2005, 05:34 PM
Hi I would love to make a super Cron Job. This one I would like to start cleans up removed users.

Here is the catch.

If the user is deleted it will check and remove them from:
vbarcade
Vbarticals
vbjurnals
photopost

etc etc etc until that person has nothing left on the site.
inculding attachments (inculding the attachment in PM hack)

This would be awsome for all users AND can work together with alot of hacks!

We could make it like a Linux kind of thing in the sense we all add to it untill almost any hack on here can be used with it if needed.

Can we start this together guys?

(Pulls up britches) WELP! >ahhh< I made the idea... >Sniffff< any one else in des hear parts can add to it?

I do not have a problem testing and handling the submitions and updates. Also I can handle the version dates and submition of authors.

T3MEDIA
03-05-2005, 08:47 PM
no one?

lasto
03-05-2005, 09:33 PM
not sure how to do the hack but what would happen if people never had the following hacks installed

vbarcade
Vbarticals
vbjurnals
photopost

because out of them i only have photopost but its still a good idea u came up as it would make the board and database a lot cleaner.

T3MEDIA
03-06-2005, 10:53 AM
nothing. the cron job will do this...
gather a list of users right...

look in all areas (for the most common hacks)
so arcade table, photopost ect...
if there is a user hanging around that is NOT in the userlist it is safe to say that user is deleted thus remove leftovers.

If you do not have lets say the Arcade tables.... then nothing will show.
Same way if you DO have the arcade but alot of users never used it.
nothing will happen.

It only removed orphan files, tables of deleted users.

Now all we need is some nice people to start and adding to this super cron job.

T3MEDIA
03-09-2005, 12:13 AM
come on guys?

T3MEDIA
03-19-2005, 03:15 PM
wow. I will give it a bit more time if not I will drop the idea.

tnguy3n
03-19-2005, 04:21 PM
it's fairly easy to write the script; however, for some ppl who don't have either vbarcade, Vbarticals, vbjurnals or photopost (i don't have vbarticle nor vbjournal nor photopost), it gives an error in mysql DELETE statement.

T3MEDIA
03-20-2005, 12:24 PM
I thought I would get the "it's easy"s.
Ok dont worry about the errors how can you help? I would love to hear how you can implement your ideas to this project.

tnguy3n
03-20-2005, 01:27 PM
However, you can work around to avoid these mysql errors, i think.

this vbcronjob would delete and clean up all article, posts, subscriptions, and stuffs related to the users who have 0 posts. It's configurable btw.


<?php

error_reporting(E_ALL & ~E_NOTICE);

if (!is_object($DB_site))
{
exit;
}

// ############## cronjob settings ##############
$vbarticle = 'yes'; // delete users articles
$vbjournal = 'yes'; // delete users journal
$photopost = 'yes';
$lastactivity = '30'; // days since the user last visited forums
$totalpost = '0'; // delete users that has XX or less than XX post

// ############## start main script ##############
// no longer editting necessary below this

$getusers = $DB_site->query("
SELECT * FROM " . TABLE_PREFIX . "user
WHERE posts <= '" . $totalpost . "'
AND lastactivity <= '" . intval(TIMENOW - ($lastactivity * 86400)) . "'
");

while ($users = $DB_site->fetch_array($getusers))
{
$userid = $users['userid'];

// clean all subscription, log, text, info of the user
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "user WHERE userid=$userid"); flush();
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "userfield WHERE userid=$userid"); flush();
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "usertextfield WHERE userid=$userid"); flush();
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "subscribeforum WHERE userid=$userid"); flush();
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "subscribethread WHERE userid=$userid"); flush();
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "event WHERE userid=$userid"); flush();
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "customavatar WHERE userid=$userid");
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "access WHERE userid=$userid"); flush();
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "pm WHERE userid=$userid");
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "pmreceipt WHERE userid=$userid"); flush();
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "session WHERE userid=$userid"); flush();
if($vbarticle == 'yes'){$DB_site->query("DELETE FROM " . TABLE_PREFIX . "vbarticle WHERE userid=$userid");}
if($vbjournal == 'yes'){$DB_site->query("DELETE FROM " . TABLE_PREFIX . "journal WHERE userid=$userid");}
if($photopost == 'yes'){$DB_site->query("DELETE FROM " . TABLE_PREFIX . "photopost WHERE userid=$userid");}

}

// log actions
log_cron_action('Universal Cronjob Cleanup.', $nextitem);

?>


you can add email feature to email users before delete them as you like. You can read more of this thread, https://vborg.vbsupport.ru/showthread.php?s=&threadid=75740 for ref.

T3MEDIA
03-24-2005, 05:54 PM
woah nice action! can we release this? (we... lol you did the work.)
I have no quarms testing for you.
what errors you get so far?

tnguy3n
03-24-2005, 07:08 PM
that was just sample codes. I didn't test it cuz I don't have vbarticle nor vbjournal installed on my board as stated earlier. However, i can figure it out if i see the database structure of those 2 hacks.
Yeah, you can realease it as an add-on to that released hack if you like.

Revan
03-24-2005, 11:34 PM
Or, to make it even easier:
$DB_site->reporterror = 0;
// insert all the delete from hack table bullshide here
$DB_site->reporterror = 1;

T3MEDIA
03-25-2005, 12:30 PM
Or, to make it even easier:
$DB_site->reporterror = 0;
// insert all the delete from hack table bullshide here
$DB_site->reporterror = 1;
Where should this be placed? Im releasing it now.

Revan
03-26-2005, 11:10 AM
Replace the comment line with all the queries deleting from various tables. Like articles and the likes.
Oh, and you don't have to worry about RPG's tables, I am going to write a cleanup script for this myself ;)