TM-FORUM

The TrackMania universal forum ^_^
It is currently 21 Feb 2017 13:18

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Delete dead records
PostPosted: 05 Feb 2017 12:52 
Offline
highway camper
highway camper

Joined: 10 Dec 2015 22:11
Posts: 2
Owned TM-games: tmuf, + all tm2
Hi!
I looking one plugin whitch can delete all local records older than 30 days.
example: who not rejoined to the server more than 30 days, they locals will be deleted by the plugin.
i will keep my db clean and up to date.

i found an old script (prunerecs), but its not working above php 5.4.


Top
 Profile  
 
 Post subject: Re: Delete dead records
PostPosted: 06 Feb 2017 11:52 
Offline
wheelbarrow operator
wheelbarrow operator

Joined: 12 Mar 2013 10:58
Posts: 18
Owned TM-games: TMU, TM2
A really bad idea to do this. The only important ist that recs form deleted maps are pruned automatically, this is already done by aseco on restart.


Top
 Profile  
 
 Post subject: Re: Delete dead records
PostPosted: 07 Feb 2017 20:19 
Offline
highway camper
highway camper

Joined: 10 Dec 2015 22:11
Posts: 2
Owned TM-games: tmuf, + all tm2
and how can i remove the login names who dont have local records? in my server have over 1500...
i dont like remove all with my fingers :)


Top
 Profile  
 
 Post subject: Re: Delete dead records
PostPosted: 11 Feb 2017 09:40 
Offline
happy cruiser
happy cruiser
User avatar

Joined: 05 Sep 2007 14:55
Posts: 128
Location: Sweden
Owned TM-games: TMUF
Manialink(s): woa
This script deletes all players who dont have a rank on the server ...

Code:
<?php
   $connectionid = mysql_connect ("dbhost", "dbuser", "dbpw");
   if (!mysql_select_db ("dbname", $connectionid))
      {
      die("no connection to database");
      }
   $sql = "SELECT * FROM players WHERE Id NOT IN (SELECT playerID FROM rs_rank)";
   $result = mysql_query($sql);
   $anzahl = 0;
      while ($row = mysql_fetch_array($result)) {
         $playerid = $row['Id'];
         $playerlogin = $row['Login'];
         $anzahl = $anzahl+1;
         $query = mysql_query("DELETE FROM `players` WHERE `Id`='". $playerid."';");
         $query = mysql_query("DELETE FROM `players_extra` WHERE `playerID`='". $playerid."';");
         $query = mysql_query("DELETE FROM `records` WHERE `PlayerId`='". $playerid."';");
         $query = mysql_query("DELETE FROM `rs_karma` WHERE `PlayerId`='". $playerid."';");
         $query = mysql_query("DELETE FROM `rs_rank` WHERE `playerID`='". $playerid."';");
         $query = mysql_query("DELETE FROM `rs_times` WHERE `playerID`='". $playerid."';");
         mysql_query($query);
      }
      if (mysql_num_rows($result) > 0) {
         if ($anzahl == 1) {
            $players = 'player';
         } else {
            $players = 'players';
         }
         $message = 'Note: '.$anzahl.' inactive '.players.' have been deleted from the Database!';
      } else {
         $message = 'Note: no inactive player(s) found.';
      }
      echo $message;
      //Optimierung
      $query = mysql_query("OPTIMIZE TABLE `players`" );
      $query = mysql_query("OPTIMIZE TABLE `players_extra`" );
      $query = mysql_query("OPTIMIZE TABLE `records`" );
      $query = mysql_query("OPTIMIZE TABLE `rs_karma`" );
      $query = mysql_query("OPTIMIZE TABLE `rs_rank`" );
      $query = mysql_query("OPTIMIZE TABLE `rs_times`" );
      mysql_query($query);
?>


Top
 Profile  
 
 Post subject: Re: Delete dead records
PostPosted: 11 Feb 2017 18:47 
Offline
Pit Crew
Pit Crew
User avatar

Joined: 31 Aug 2009 19:38
Posts: 1300
Location: Germany
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
Maybe this plugin will help you: http://plugins.xaseco.org/info.php?id=130

_________________
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group