11
debianus
Re: Purging notifications and PMs from the database: How
  • 2007/7/11 10:02

  • debianus

  • Not too shy to talk

  • Posts: 179

  • Since: 2006/12/17


It is possible to use xoopscare too; It allows to execute php code and set the time for that

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

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


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

13
rpilney
Re: Purging notifications and PMs from the database: How
  • 2007/7/11 15:25

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


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);








Login

Who's Online

230 user(s) are online (165 user(s) are browsing Support Forums)


Members: 0


Guests: 230


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits