From 8d7f3817ec4999b91eccba3053c83ed0c620558f Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 27 Aug 2012 15:09:55 -0400 Subject: [PATCH] cc-3936: Fixed bug where setDbColMetadata to use airtime metadata key names. --- airtime_mvc/application/models/StoredFile.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 9dc347f39..c3ec5daca 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -155,7 +155,7 @@ class Application_Model_StoredFile if(!$owner) { // no owner detected, we try to assign one. // if MDATA_OWNER_ID is not set then we default to the // first admin user we find - if (!array_key_exists('MDATA_KEY_OWNER_ID', $p_md)) { + if (!array_key_exists('owner_id', $p_md)) { //$admins = Application_Model_User::getUsers(array('A')); $admins = Application_Model_User::getUsersOfType('A'); if (count($admins) > 0) { // found admin => pick first one @@ -165,7 +165,7 @@ class Application_Model_StoredFile // get the user by id and set it like that else { $user = CcSubjsQuery::create() - ->findPk($p_md['MDATA_OWNER_ID']); + ->findPk($p_md['owner_id']); if ($user) { $owner = $user; } @@ -178,6 +178,12 @@ class Application_Model_StoredFile '".$p_md['MDATA_KEY_FILEPATH']."'"); } } + # We don't want to process owner_id in bulk because we already + # processed it in the code above. This is done because owner_id + # needs special handling + if (array_key_exists('owner_id', $p_md)) { + unset($p_md['owner_id']); + } foreach ($p_md as $dbColumn => $mdValue) { // don't blank out name, defaults to original filename on first // insertion to database. @@ -797,6 +803,8 @@ class Application_Model_StoredFile $chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0; $chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0; $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : ''; + # TODO : should not log __FILE__ itself. there is general logging for + # this Logging::info(__FILE__.":uploadFile(): filename=$fileName to $p_targetDir"); // Clean the fileName for security reasons //this needs fixing for songs not in ascii.