5 * Data migration for the doc_manager - between pre6 and pre7
7 * Copyright 2002 (c) GFORGE LLC
10 require_once dirname(__FILE__).'/../www/env.inc.php';
11 require_once $gfcommon.'include/pre.php';
13 @ini_set('memory_limit', '128M');
15 // drop and recreate page cache
17 //SELECT * FROM doc_data WHERE filename is null;
20 $res=db_query_params ('SELECT * FROM doc_data WHERE filename IS NULL',
28 $rows=db_numrows($res);
30 for ($i=0; $i<$rows; $i++) {
31 $res2 = db_query_params ('UPDATE doc_data SET data=$1,filename=$2,filetype=$3 WHERE docid=$4',
32 array (base64_encode( util_unconvert_htmlspecialchars( db_result($res,$i,'data'))),
33 'file'.db_result($res,$i,'docid').'.html',
35 db_result($res,$i,'docid'))) ;
36 if (!$res2 || db_affected_rows($res2) < 1) {
37 echo 'DB ERROR'.db_error();
48 // c-file-style: "bsd"