1 <!-- $Id: loadserial.php,v 1.1.2.1.2.2 2005-01-07 13:59:57 rurban Exp $ -->
4 Load a set of pages that have been serialized with
7 if (!defined('WIKI_ADMIN'))
8 die("You must be logged in as the administrator to load serialized pages.");
10 $directory = $loadserial;
11 $html = "Loading serialized pages from '$directory'.<p>\n";
13 if (! file_exists($directory)) {
14 echo "No such directory '$directory'.<br>\n";
18 $handle = opendir($directory);
20 while ($file = readdir($handle)) {
25 $html .= "Reading '$file'...<br>\n";
27 $data = implode("", file("$directory/$file"));
28 $pagehash = unserialize($data);
30 // at this point there needs to be some form of verification
31 // that we are about to insert a page.
33 $pagename = rawurldecode($file);
34 $html .= "inserting file '".htmlspecialchars($pagename)."' into the database...<br>\n";
35 InsertPage($dbi, $pagename, $pagehash);
39 $html .= "<p><b>Load complete.</b>";
40 GeneratePage('MESSAGE', $html, 'Load serialized pages', 0);