Menu

How to migrate Wiki from flat file to MySql

Help
2005-03-09
2012-10-11
  • Mike Pullen

    Mike Pullen - 2005-03-09

    I have installed phpwiki using flat files and been using it successfully for a while. I want to incorporate MySql now as the storage method.

    How do I move the Wiki user info and pages from Windows flat files into MySql DB?


    MikeP

     
    • Reini Urban

      Reini Urban - 2005-03-13

      PhpWikiAdministration
      Backup / Restore.

      easiest as zip

       
    • Don Kinzer

      Don Kinzer - 2005-09-08

      I'm trying to do the same thing. I have a 1.2.7 wiki running in flat-file mode. I did a dump of the pages and copied them to separate directory on the new server. I prepared the mySQL database using the provided schema.

      When the new wiki came up, I went to admin mode and tried to load the dumped pages. I got the following error:

      Error writing page 'FrontPage'
      MySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 0, 1121903652, 'FrontPage', 'a:0:{}', 67)' at line 1

      The dumped FrontPage file contains (in part):
      a:5:{s:8:"pagename";s:9:"FrontPage";s:12:"lastmodified";i:1121903652;s:7:"version"

      I can operate the new wiki just fine - edit pages, add pages, etc. so I know that the mySQL database is set up correctly.

      I also tried loading the same pages in a 1.2.10 wiki using mySQL - same problem.

      Any ideas?

       
      • Mike Pullen

        Mike Pullen - 2005-09-08

        I gave up trying. I spent two weeks attempting to transfer the material into MySQL without success.

        I'm running my site in flatfile mode still.

        If you crack this nut, please post the solution here.


        Mike P

         
    • Don Kinzer

      Don Kinzer - 2005-09-08

      Success!

      I cheated and modified the serial dump function to produce files that are similar to the files found in ./pgsrc. To do this I changed admin/dumpserial.php on my original installation as follows:

      // $data = serialize(RetrievePage($dbi, $pages[$x], $WikiPageStore));
      $pagehash = RetrievePage($dbi, $pages[$x], $WikiPageStore);
      $data = implode("\n", $pagehash["content"]);

      The line commented out is around line 32 in v1.2.7.

      After this change, I used the Dump Serialized Pages function on the administration page. Examination of the resulting files confirmed that they are similar to those in ./pgsrc.

      To import these pages on a new server start by wiping out the existing data. If you're using mySQL just redo the query that creates the tables. Next, modify lib/config.php to define WIKI_PGSRC to point to the directory containing the files produced in the step above. When you start the wiki for the first time it will load up all of your pages.

      Don

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.