2 include("t_config.php");
6 <title>strip old versions of ewiki pages</title>
7 <link rel="stylesheet" type="text/css" href="t_config.css">
8 <script language="JavaScript">
10 var ls = document.forms[0].elements; // getElementsByTagName("input");
11 for (var i=0; i<ls.count(); i++) {
12 if (ls[i].type == "checkbox") {
13 ls[i].checked = ! ls[i].checked;
19 <body bgcolor="#ffffff" text="#000000">
20 <h1>create page version holes</h1>
24 define("N_PAGE_VERSIONS", 1);
27 if (empty($_REQUEST["range"])) {
30 This tool can be used to remove old page versions from the database, if
31 they just slow down your wiki. For a db_flat_files/db_fast_files powered
32 ewiki you could just delete the files from the database directory.
34 Please note, that the right number is always treated as count from the
35 last existing version. So "2..-10" would delete anything from the 2nd to
36 the "LAST minus 10"-th version.
38 <form action="t_holes.php" method="POST">
39 <table class="list" border="0" cellpadding="2" cellspacing="3">
42 $result = ewiki_db::GETALL(array());
43 while ($row = $result->get()) {
45 if (($n=$row["version"]) >= N_PAGE_VERSIONS) {
50 echo "<td>".htmlentities($id)." (#$n)</td>";
52 echo '<td> <input type="checkbox" name="id['.rawurlencode($id).']" value="1">'.
54 '<input name="range['.rawurlencode($id).']" value="2..'.$n2.'" size="7"> </td>';
63 <br><input type="submit" value="strip page versions"><br>
66 [<a href="javascript:sel_all();">select all</a>]
69 Eventually you should consider using the <tt>ewikictl</tt> cmdline
70 utility in favour of this www script.
77 echo "purging page versions:<br>";
79 $range = $_REQUEST["range"];
81 foreach ($_REQUEST["id"] as $id_ue => $go) {
82 $id = rawurldecode($id_ue);
86 if (preg_match('/^(\d+)[-\s._:]+(\d+)$/', trim($range[$id_ue]), $uu)) {
90 echo "'".htmlentities($id)."' versions {$versA}..{$versZ}<br>\n";
92 for ($v=$versA; $v<=$versZ; $v++) {
94 ewiki_db::DELETE($id, $v);
101 echo "wrong range param for '$id'!<br>\n";