http://opensimulator.org/index.php?title=Pruneterrain.php&feed=atom&action=historyPruneterrain.php - Revision history2024-03-29T11:59:13ZRevision history for this page on the wikiMediaWiki 1.19.9http://opensimulator.org/index.php?title=Pruneterrain.php&diff=28429&oldid=prevMakoBot: Robot: Cosmetic changes2012-03-04T04:01:21Z<p>Robot: Cosmetic changes</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 04:01, 4 March 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 3:</td>
<td colspan="2" class="diff-lineno">Line 3:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><br /></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><br /></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>==Description==</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>== Description ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Currently, the terrain revision table in the mysql database gets too big after a while(more than 1gb is no exception), so backups slow down greatly. This script prunes the revisions per region, thus limiting the maximum space which this table occupies.  </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Currently, the terrain revision table in the mysql database gets too big after a while(more than 1gb is no exception), so backups slow down greatly. This script prunes the revisions per region, thus limiting the maximum space which this table occupies.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>==Usage==</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>== Usage ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Save the script in your scripts directory, make it executable(chmod +x) and fire up like:</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Save the script in your scripts directory, make it executable(chmod +x) and fire up like:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  ./pruneterrain.php sqlhostname sqluser sqlpw sqldb prunelimit</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  ./pruneterrain.php sqlhostname sqluser sqlpw sqldb prunelimit</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>The prunelimit cuts off every revision after the amount you give(1-x).  </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>The prunelimit cuts off every revision after the amount you give(1-x).  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>==Souce==</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>== Souce ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="php"></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="php"></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>#!/usr/bin/php</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>#!/usr/bin/php</div></td></tr>
</table>MakoBothttp://opensimulator.org/index.php?title=Pruneterrain.php&diff=23606&oldid=prevMakoBot: Removed 'Template:' prefix from template includings and/or changed external-link into internal-link2011-06-10T23:35:09Z<p>Removed 'Template:' prefix from template includings and/or changed external-link into internal-link</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 23:35, 10 June 2011</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>__NOTOC__</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>__NOTOC__</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>{{<del class="diffchange diffchange-inline">Template:</del>Quicklinks}}</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>{{Quicklinks}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><br /></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><br /></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
</table>MakoBothttp://opensimulator.org/index.php?title=Pruneterrain.php&diff=13366&oldid=prevIdeia Boa at 23:57, 21 May 20092009-05-21T23:57:43Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 23:57, 21 May 2009</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">__NOTOC__</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">{{Template:Quicklinks}}</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"><br /></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>==Description==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>==Description==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Currently, the terrain revision table in the mysql database gets too big after a while(more than 1gb is no exception), so backups slow down greatly. This script prunes the revisions per region, thus limiting the maximum space which this table occupies.  </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Currently, the terrain revision table in the mysql database gets too big after a while(more than 1gb is no exception), so backups slow down greatly. This script prunes the revisions per region, thus limiting the maximum space which this table occupies.  </div></td></tr>
</table>Ideia Boahttp://opensimulator.org/index.php?title=Pruneterrain.php&diff=6040&oldid=prevPhrearch: Prune Terrain moved to Pruneterrain.php: using filenames is better2008-05-20T14:42:51Z<p><a href="/wiki/Prune_Terrain" class="mw-redirect" title="Prune Terrain">Prune Terrain</a> moved to <a href="/wiki/Pruneterrain.php" title="Pruneterrain.php">Pruneterrain.php</a>: using filenames is better</p>
<table class='diff diff-contentalign-left'>
<tr valign='top'>
<td colspan='1' style="background-color: white; color:black;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black;">Revision as of 14:42, 20 May 2008</td>
</tr></table>Phrearchhttp://opensimulator.org/index.php?title=Pruneterrain.php&diff=6039&oldid=prevPhrearch: New page: ==Description== Currently, the terrain revision table in the mysql database gets too big after a while(more than 1gb is no exception), so backups slow down greatly. This script prunes the ...2008-05-20T14:42:16Z<p>New page: ==Description== Currently, the terrain revision table in the mysql database gets too big after a while(more than 1gb is no exception), so backups slow down greatly. This script prunes the ...</p>
<p><b>New page</b></p><div>==Description==<br />
Currently, the terrain revision table in the mysql database gets too big after a while(more than 1gb is no exception), so backups slow down greatly. This script prunes the revisions per region, thus limiting the maximum space which this table occupies. <br />
<br />
==Usage==<br />
Save the script in your scripts directory, make it executable(chmod +x) and fire up like:<br />
./pruneterrain.php sqlhostname sqluser sqlpw sqldb prunelimit<br />
The prunelimit cuts off every revision after the amount you give(1-x). <br />
<br />
==Souce==<br />
<source lang="php"><br />
#!/usr/bin/php<br />
<?php<br />
//First do some basic parameter checking<br />
if (sizeof($argv)!=6) {<br />
echo "\nInvalid amount of parameters!\nUsage:".$argv[0]." host user pw db limit\n";<br />
die;<br />
}<br />
else {<br />
foreach($argv as $arg){<br />
if(empty($arg)){<br />
echo "\nInvalid parameter input!\nUsage:".$argv[0]." host user pw db limit\n";<br />
die;<br />
}<br />
}<br />
$host = $argv[1];<br />
$username = $argv[2];<br />
$password = $argv[3];<br />
$database = $argv[4];<br />
if(intval($argv[5]) > 0) {<br />
$prunelimit = $argv[5];<br />
}<br />
else {<br />
echo "Enter a valid Prune-limit!(> 1). You don't want to loose your work do you?\n";<br />
die;<br />
}<br />
}<br />
<br />
$connect = mysql_connect($host, $username, $password);<br />
if (!$connect) {<br />
die('Could not connect: ' . mysql_error());<br />
}<br />
mysql_select_db($database);<br />
//Get unique regions from terrain table<br />
$query = "SELECT uuid,regionName from regions";<br />
$result = mysql_query($query);<br />
if(!$result) die("Query Failed.");<br />
//For every unique Region<br />
$tempspace = 0;<br />
$space = 0;<br />
while ($row = mysql_fetch_assoc($result)) {<br />
$query = "SELECT RegionUUID,Revision from terrain WHERE RegionUUID = '".ereg_replace("-", "", $row['uuid'])."' ORDER BY Revision DESC";<br />
$nextresult = mysql_query($query);<br />
//Get the amount of revisions<br />
$revnum = mysql_num_rows($nextresult);<br />
//If revision amount exceeds the prune-limit<br />
if($revnum > $prunelimit) {<br />
$tempspace = (($revnum - $prunelimit) / 2);<br />
echo "Freeing ".$tempspace."MB of data from ".$row['regionName']."\n";<br />
mysql_data_seek($nextresult, ($prunelimit));<br />
if($lastrow = mysql_fetch_assoc($nextresult)) {<br />
$query = "DELETE FROM terrain WHERE Revision <= '".$lastrow['Revision']."'";<br />
mysql_query($query) or die (mysql_error());<br />
$space += $tempspace;<br />
}<br />
}<br />
<br />
}<br />
echo "Totally removed ".$space."MB of terrain-revision data...\n";<br />
mysql_close($connect);<br />
?><br />
</source></div>Phrearch