From 5a320aa225f1940db22e67e593b56091c8dcd86f Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Fri, 29 Jul 2011 15:33:53 +0200 Subject: [PATCH] CC-2612 : Upgrade: Push DB metadata into the file before upgrade --- .../upgrades/airtime-1.9.0/airtime-upgrade.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php b/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php index 6fe2b0c22..7df7f9240 100644 --- a/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php +++ b/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php @@ -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);