Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
7 - 3 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: Purging notifications and PMs from the database: How
by rpilney on 2007/7/11 15:25:19

this is how it should look if you use XOOPS care and it does work :) You do have to edit the user, pass, host and DB but that information is found in your mainfile.php file

Quote:


define("user", "dbuser");
define("pass", "dbpass");
define("host", "localhost");
define("db", "dbname");
$cxn = mysql_connect(host ,user, pass);
mysql_select_db(db);
$delete_time = time(30) - ( 30 * 24 * 60 * 60 ); // 30 days/month * 24 hrs/day
// * 60 minutes/hour * 60 seconds/min.

$sql = "DELETE from `xoops_priv_msgs` WHERE `read_msg` = '0' AND `msg_time` < '$delete_time'";
//This script would delete everything older than 30 days that has been not read.

$result = mysql_query($sql, $cxn);







Re: Purging notifications and PMs from the database: How
by rpilney on 2007/7/11 12:50:16

cool. I was thinking the same last night. So I pasted in the code just as it is here and saved settings then clicked the do it now link but nothing changed on the PM data size so I know I did something wrong. Do I have to put in my database name, user name etc where it has that listed or just copy and paste as is? Thanks!

just hit edit to add what I saw below lol

For the following, I assume we add our own information?
define("user", "dbuser");
define("pass", "dbpass");
define("host", "localhost");
define("db", "dbname");

FYI I tried adding in the information above, saved settings and then ran it. Did not change. So I wonder where / how I set the time setting i.e. 30 days etc?

I put in 30 in the $delete_time = time() area i.e. time(30) but that did not do it either.

Ideas?

My hosting company does not have CRON jobs for shared servers. only thing I could find is flush the table for PM.

I am assuming that deletes them all which is not what I want. I just want to clean out all the unread ones. I have a few I want to save myself.

Should the "?" be there in front of php? ie <?php
Re: Purging notifications and PMs from the database: How
by debianus on 2007/7/11 10:02:19

It is possible to use xoopscare too; It allows to execute php code and set the time for that
Re: Purging notifications and PMs from the database: How
by MadFish on 2007/7/11 6:57:23

Quote:
where would I or how do I use this script? This is what I need but not sure how to go about doing it.


If you have cpanel on your hosting account, look for a section called 'cron jobs', you can probably run it from there. I am pretty sure you could run it with xoopscare, but haven't tried yet.

Otherwise, you can achieve the same thing manually by deleting the contents of the relevant tables, as noted above. But please don't mess around with your database until you have made a backup!
Re: Purging notifications and PMs from the database: How
by Cuidiu on 2007/7/11 6:49:30

I am interested as well. I'd also like to know if we can use it in the XOOPS Care module by adding the script to the "Execute Php code" area.

For the following, I assume we add our own information?
define("user", "dbuser");
define("pass", "dbpass");
define("host", "localhost");
define("db", "dbname");

Would it be "dbuser", "dbpass", "localhost", "dbname" that needs modifying? Other than that, anything else?

Thanks...

Quote:
where would I or how do I use this script? This is what I need but not sure how to go about doing it.

Who's Online

138 user(s) are online (94 user(s) are browsing Support Forums)


Members: 0


Guests: 138


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits