From 65e771d189d9ab2fe72a331d168bcb8ee97aaee9 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 4 May 2012 12:02:42 -0400 Subject: [PATCH] CC-3756: Cannot download/preview tracks in Media Library -Fixed --- airtime_mvc/application/models/StoredFile.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index a832913b8..886f9a8ba 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -46,7 +46,7 @@ class Application_Model_StoredFile { "md5" => "DbMd5", "ftype" => "DbFtype", "language" => "DbLanguage", - "filepath" => "DbFilepath", + //"filepath" => "DbFilepath", "directory" => "DbDirectory" ); @@ -221,10 +221,20 @@ class Application_Model_StoredFile { { $c = get_defined_constants(true); $md = array(); + + /* Create a copy of dbMD here and create a "filepath" key inside of + * it. The reason we do this here, instead of creating this key inside + * dbMD is because "filepath" isn't really metadata, and we don't want + * filepath updated everytime the metadata changes. Also it needs extra + * processing before we can write it to the database (needs to be split + * into base and relative path) + * */ + $dbmd_copy = $this->_dbMD; + $dbmd_copy["filepath"] = "DbFilepath"; foreach ($c['user'] as $constant => $value) { if (preg_match('/^MDATA_KEY/', $constant)) { - if (isset($this->_dbMD[$value])) { + if (isset($dbmd_copy[$value])) { $md[$constant] = $this->getDbColMetadataValue($value); } } @@ -450,7 +460,7 @@ Logging::log("getting media! - 2"); if(isset($md)) { $storedFile->setMetadata($md); - } + } return $storedFile; }