The admin tools (try loading admin.php) offered a way of doing this, by dumping the Wiki out as a zip file, and then reloading the zip file. It hasn't been tested recently and you have to have zip support compiled into PHP.
~swain
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Q2: how to effectively load a dir of flatfiles into my db (mysql), as current user? Those are much easier to maintain and write in the first instance.
To import it as phpwiki admin I simply put them
into pgsrc and drop the tables by
$mysql <schemas/schema.mysql
but I want them to appear under my name :)
Some kind of LoadFlatDir as combination of
lib/setupwiki.php and admin/loadserial.php
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry, just found the answers to both questions:
Load setupwiki.php with WIKI_PGSRC set to the directory.
this is quite dirty btw.
one should be able to load setupwiki.php to get the functions without loading pgsrc
I just have to find out now, how to use
LoadZipOrDir($dbi, $mydir) as admin author.
I know, it's easy, but this will need a bigger patch to setupwiki.php and all its loaders.
I've made this minor convenience patch:
--- phpwiki/lib/setupwiki.php~ Sun Oct 22 19:33:35 2000
+++ phpwiki/lib/setupwiki.php Fri Feb 9 23:51:05 2001
@@ -87,10 +87,12 @@
{
$handle = opendir($dir = $zip_or_dir);
Yes this is a little clumsy and non-obvious.
I'm currently working on making it better (at least
in the development branch.)
In the mean time, here's how I suggest you
Get either a zip dump, or a serialized dump from your
old wiki.
(If your using a zip dump, it must (for now) be
on the server machine. Copy it there if it's not
there yet.)
Edit lib/config.php in the new wiki and set WIKI_PGSRC
to point either to your zip file, or the the serialized
dump directory.
Blow away the database of your new wiki.
(Delete the db files for a db base wiki,
or do something like:
mysql -u <user> -p <database> < schemas/schema.mysql
to blow away a mysql based wiki.
Now with your web browser, go browse to
the FrontPage of your new wiki. It will detect
that it's working with a virgin database and
will pull in the pages from the source
specified in WIKI_PGSRC.
Jeff
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I want to upgrade phpWiki to 1.19 and use mySql to store the data. I am currently using the build dbm. How can I populate the data from dbm to mySql
The admin tools (try loading admin.php) offered a way of doing this, by dumping the Wiki out as a zip file, and then reloading the zip file. It hasn't been tested recently and you have to have zip support compiled into PHP.
~swain
>dumping the Wiki out as a zip file, and
>then reloading the zip file.
I have now the zip as mail archive and the serialized dump in a seperate directory.
(just added these lines to browse.html)
###IF:ADMIN###
<form action="###SCRIPTURL###" method=POST>
<input type=text name=dumpserial><input type=submit value=Dump></form>
<form action="###SCRIPTURL###" method=POST>
<input type=text name=loadserial><input type=submit value=Load></form>
[<a href="###SCRIPTURL###?zip=all">Zip as mailarchive</A>]
###ENDIF:ADMIN###
Q1: how to import the zip? I see no mail reader.
Q2: how to effectively load a dir of flatfiles into my db (mysql), as current user? Those are much easier to maintain and write in the first instance.
To import it as phpwiki admin I simply put them
into pgsrc and drop the tables by
$mysql <schemas/schema.mysql
but I want them to appear under my name :)
Some kind of LoadFlatDir as combination of
lib/setupwiki.php and admin/loadserial.php
Sorry, just found the answers to both questions:
Load setupwiki.php with WIKI_PGSRC set to the directory.
this is quite dirty btw.
one should be able to load setupwiki.php to get the functions without loading pgsrc
I just have to find out now, how to use
LoadZipOrDir($dbi, $mydir) as admin author.
I know, it's easy, but this will need a bigger patch to setupwiki.php and all its loaders.
I've made this minor convenience patch:
--- phpwiki/lib/setupwiki.php~ Sun Oct 22 19:33:35 2000
+++ phpwiki/lib/setupwiki.php Fri Feb 9 23:51:05 2001
@@ -87,10 +87,12 @@
{
$handle = opendir($dir = $zip_or_dir);
- // load default pages
+ // load default pages, ignore backup's
while ($fn = readdir($handle))
{
if (filetype("$dir/$fn") != 'file')
+ continue;
+ if (substr("$fn",-1) == "~")
continue;
$stat = stat("$dir/$fn");
$mtime = $stat[9];
Yes this is a little clumsy and non-obvious.
I'm currently working on making it better (at least
in the development branch.)
In the mean time, here's how I suggest you
Get either a zip dump, or a serialized dump from your
old wiki.
(If your using a zip dump, it must (for now) be
on the server machine. Copy it there if it's not
there yet.)
Edit lib/config.php in the new wiki and set WIKI_PGSRC
to point either to your zip file, or the the serialized
dump directory.
Blow away the database of your new wiki.
(Delete the db files for a db base wiki,
or do something like:
mysql -u <user> -p <database> < schemas/schema.mysql
to blow away a mysql based wiki.
Now with your web browser, go browse to
the FrontPage of your new wiki. It will detect
that it's working with a virgin database and
will pull in the pages from the source
specified in WIKI_PGSRC.
Jeff
Alternatively to Steve's suggestion, you can
use the dump & load serialized pages functions.
Furthermore, I suggest using the latest nightly tarball instead of 1.1.9. There were some important bug fixes since then.
/Arno