CC-2279: Upgrade script for converting stor directory to new format
-escape strings before inserting into database
This commit is contained in:
parent
07b1686643
commit
ec75af194b
|
@ -430,9 +430,9 @@ $oldAndNewFileNames = json_decode($output[0]);
|
||||||
print_r($oldAndNewFileNames);
|
print_r($oldAndNewFileNames);
|
||||||
|
|
||||||
foreach ($oldAndNewFileNames as $pair){
|
foreach ($oldAndNewFileNames as $pair){
|
||||||
$relPathNew = substr($pair[1], strlen($stor_dir));
|
$relPathNew = pg_escape_string(substr($pair[1], strlen($stor_dir)));
|
||||||
$absPathOld = $pair[0];
|
$absPathOld = pg_escape_string($pair[0]);
|
||||||
$sql = "UPDATE cc_files SET filepath = \"$relPathNew\", directory=1 WHERE filepath = \"$absPathOld\"";
|
$sql = "UPDATE cc_files SET filepath = '$relPathNew', directory=1 WHERE filepath = '$absPathOld'";
|
||||||
echo $sql.PHP_EOL;
|
echo $sql.PHP_EOL;
|
||||||
execSqlQuery($sql);
|
execSqlQuery($sql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ class MediaMonitorCommon:
|
||||||
filepath = self.create_file_path(pathname, file_md)
|
filepath = self.create_file_path(pathname, file_md)
|
||||||
|
|
||||||
self.logger.debug(u"Moving from %s to %s", pathname, filepath)
|
self.logger.debug(u"Moving from %s to %s", pathname, filepath)
|
||||||
#self.move_file(pathname, filepath)
|
self.move_file(pathname, filepath)
|
||||||
else:
|
else:
|
||||||
filepath = None
|
filepath = None
|
||||||
self.logger.warn("File %s, has invalid metadata", pathname)
|
self.logger.warn("File %s, has invalid metadata", pathname)
|
||||||
|
|
Loading…
Reference in New Issue