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.
Delete dead records
-
- highway camper
- Posts: 3
- Joined: 10 Dec 2015 21:11
- Owned TM-games: tmuf, + all tm2
-
- wheelbarrow operator
- Posts: 19
- Joined: 12 Mar 2013 09:58
- Owned TM-games: TMU, TM2
Re: Delete dead records
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.
-
- highway camper
- Posts: 3
- Joined: 10 Dec 2015 21:11
- Owned TM-games: tmuf, + all tm2
Re: Delete dead records
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
i dont like remove all with my fingers

- L3cKy
- happy cruiser
- Posts: 147
- Joined: 05 Sep 2007 13:55
- Owned TM-games: TMUF
- Location: Berlin
- Contact:
Re: Delete dead records
This scripts deletes all players who dont have a rank on the server ...
As standalone .php script
Or as chat command for xaseco
Edit chat.admin.php (located in xaseco/plugins)
Add before:
following code:
and add before
Inagem Usage: /admin delghosts
Greetings L3cKy
As standalone .php script
Code: Select all
<?php
//dbhost = database host
//dbuser = database user
//dbpw = database password
//dbname = database table
$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);
?>
Or as chat command for xaseco
Edit chat.admin.php (located in xaseco/plugins)
Add before:
Code: Select all
global $pmbuf; // pm history buffer
Code: Select all
Aseco::addChatCommand('delghosts', 'Deletes inactive players from database', true);
Code: Select all
/**
* Shuts down XASECO.
*/
Code: Select all
/**
* Deltes old players
*/
} elseif ($command['params'][0] == 'delghosts') {
$sql = "SELECT Id, Login 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);
// check for table bestsecs
$check = 'SELECT PlayerNick FROM secrecs_all WHERE PlayerNick = "'.$playerlogin.'"';
$answer = mysql_query($check);
if ($answer) {
$query = mysql_query("DELETE FROM `secrecs_all` WHERE `PlayerNick`='". $playerlogin."';");
$query = mysql_query("DELETE FROM `secrecs_own` WHERE `PlayerNick`='". $playerlogin."';");
mysql_query($query);
}
}
if (mysql_num_rows($result) > 0) {
if ($anzahl == 1) {
$players = 'player';
} else {
$players = 'players';
}
$message = '$z$s$f00Note: $fff'.$anzahl.' inactive '.$players.' have been deleted from the Database!';
} else {
$message = '$z$s$f00Note: $fffno inactive player(s) found.';
}
$aseco->client->query('ChatSendServerMessage', $aseco->formatColors($message));
Greetings L3cKy
Last edited by L3cKy on 12 Apr 2018 18:42, edited 4 times in total.
- undef.de
- Pit Crew
- Posts: 1317
- Joined: 31 Aug 2009 18:38
- Owned TM-games: TMF, TM2C/S/V, SM
- Manialink(s): undef, tmkarma
- Location: Germany
- Contact:
Re: Delete dead records
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
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name
Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm