CC-2279: Upgrade script for converting stor directory to new format

-escape strings before inserting into database
This commit is contained in:
martin 2011-07-14 21:31:02 -04:00
parent 07b1686643
commit ec75af194b
2 changed files with 4 additions and 4 deletions

View file

@ -430,9 +430,9 @@ $oldAndNewFileNames = json_decode($output[0]);
print_r($oldAndNewFileNames);
foreach ($oldAndNewFileNames as $pair){
$relPathNew = substr($pair[1], strlen($stor_dir));
$absPathOld = $pair[0];
$sql = "UPDATE cc_files SET filepath = \"$relPathNew\", directory=1 WHERE filepath = \"$absPathOld\"";
$relPathNew = pg_escape_string(substr($pair[1], strlen($stor_dir)));
$absPathOld = pg_escape_string($pair[0]);
$sql = "UPDATE cc_files SET filepath = '$relPathNew', directory=1 WHERE filepath = '$absPathOld'";
echo $sql.PHP_EOL;
execSqlQuery($sql);
}