36799749483c238ecdca99f1f3d9cfcbc02949d2
[atutor.git] / mods / wiki / tools / t_restore.php
1 <?php
2
3   include("t_config.php");
4   ob_start(); include($lib="ewikictl"); ob_end_clean();
5
6 ?>
7 <html>
8 <head>
9  <title>restore database entries from backup</title>
10  <link rel="stylesheet" type="text/css" href="t_config.css">
11 </head>
12 <body bgcolor="#ffffff" text="#000000">
13 <h1>restore database</h1>
14
15 <?php
16
17   if (empty($_REQUEST["restore"])) {
18
19     ?>
20
21     This is a wrapper script around <b>ewikictl</b> to reinsert saved
22     database entries back into the database. It also incorporates functions
23     from the previous "backdown" utility.
24     <br>
25     To use it you must first upload a bunch of db files to a directory on
26     your webserver you have access to.
27
28     <br><br>
29
30     <form action="t_restore.php" method="get">
31
32      <b>directory</b> containing backup files:<br>
33      <input type="text" name="incoming" value="/var/backup/ewiki/">
34      <br><small>(either absolute or relative to location of ewiki.php)</small><br>
35      <br>
36
37      backup <b>format</b>:<br>
38      <select name="format" size="3">
39        <option value="plain">plain text files</option>
40        <option value="flat" selected="selected">flat files (message/http)</option>
41        <option value="fast">fast files (serialized)</option>
42      </select><br>
43      <br>
44
45      <b>versions</b> insert behaviour:<br>
46      <select name="behaviour" size="3">
47        <option value="all" selected="selected">files come in multiple versions (.NNN extensions)</option>
48        <option value="initial">single version, insert only if not already in db</option>
49        <option value="append">single version, append as last entry</option>
50      </select><br>
51      <br>
52
53      other settings:<br>
54
55      <input type="checkbox" name="overwrite" value="1"> <b>overwrite</b>,
56         replace existing versions (see multiple versions above) <br>
57
58      <input type="checkbox" name="urlencode" value="1"> <b>urldecode</b>,
59         read dbff-filenames assuming DOS filesystem restrictions<br>
60         <small>(only matters for plain text files, because dbff files
61         always carry an unencoded $id inside)</small> <br>
62
63      <input type="checkbox" name="force" value="1"> <b>enforce</b>,
64         override problems (use this only if first try failed)<br>
65
66      <br>
67
68      <input type="submit" name="restore" value="restore">
69      <br><br>
70
71     </form>
72
73     <?php
74
75   }
76
77   else {
78
79      echo "<b>ewikictl</b>:<pre width=\"60\">";
80
81      $config["dest"] = $_REQUEST["incoming"];
82      $config["format"] = $_REQUEST["format"];
83      $config["force"] = $_REQUEST["force"];
84      $config["urlencode"] = $_REQUEST["urlencode"];
85      $config["insert"] = "1";
86
87      if ($_REQUEST["behaviour"]=="all") {
88         $config["all"] = 1;
89         $config["keep"] = (!$_REQUEST["overwrite"]);
90      }
91      else {
92         $config["all"] = 0;
93         $config["keep"] = ($_REQUEST["behaviour"] != "append");
94      }
95
96      set_options_global();
97
98      command_insert();
99
100      echo "</pre>";
101
102   }
103
104 ?>
105
106 </body>
107 </html>