CC-2612 : Upgrade: Push DB metadata into the file before upgrade

This commit is contained in:
Naomi Aro 2011-07-29 15:33:53 +02:00
parent c04c9e7294
commit 5a320aa225

View file

@ -582,20 +582,24 @@ class Airtime190Upgrade{
public static function backupFileInfoInStorToFile($values) {
echo "Save DbMd to File".PHP_EOL;
$stor_dir = realpath($values['general']['base_files_dir']."/stor");
$files = CcFilesQuery::create()
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
->find();
$dumpFile = "storDump.txt";
$dumpFile = __DIR__"/storDump.txt";
$fh = fopen($dumpFile, 'w') or die("can't open file to backup stor.");
$s = "SF_BACKUP";
foreach ($files as $file) {
if (substr($file->getDbFilepath, 0, strlen($stor_dir)) == $stor_dir) {
$filepath = $file->getDbFilepath();
if (substr($filepath, 0, strlen($stor_dir)) == $stor_dir) {
$recorded_show = CcShowInstancesQuery::create()
->filterByDbRecordedFile($file->getDbId())
@ -612,7 +616,7 @@ class Airtime190Upgrade{
//$start_time like yyyy-mm-dd-hh-MM-ss
list($yyyy, $mm, $dd, $hh, $MM, $ss) = explode("-", $start_time);
$data = "1$s$title$s$yyyy$s$mm$s$dd$s$hh$s$MM\n";
$data = "1$s$filepath$s$title$s$yyyy$s$mm$s$dd$s$hh$s$MM\n";
}
else {
@ -621,7 +625,7 @@ class Airtime190Upgrade{
$track = $file->getDbTrackNumber();
$title = $file->getDbTrackTitle();
$data = "0$s$title$s$artist$s$album$s$track\n";
$data = "0$s$filepath$s$title$s$artist$s$album$s$track\n";
}
fwrite($fh, $data);