cc-4301: Fixed bug where owner_id would be null whenever show is recorded.
This commit is contained in:
parent
583d3837be
commit
7f66bdbb66
3 changed files with 19 additions and 4 deletions
|
@ -932,8 +932,14 @@ class Application_Model_StoredFile
|
|||
}
|
||||
|
||||
// Did all the checks for realz, now trying to copy
|
||||
$audio_stor = Application_Common_OsPath::join($stor, "organize", $fileName);
|
||||
$uid = Application_Model_User::getCurrentUser()->getId();
|
||||
$audio_stor = Application_Common_OsPath::join($stor, "organize",
|
||||
$fileName);
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
if (is_null($user)) {
|
||||
$uid = Application_Model_User::getFirstAdminId();
|
||||
} else {
|
||||
$uid = $user->getId();
|
||||
}
|
||||
$id_file = "$audio_stor.identifier";
|
||||
if (file_put_contents($id_file,$uid) === false) {
|
||||
Logging::info("Could not write file to identify user: '$uid'");
|
||||
|
|
|
@ -241,6 +241,15 @@ class Application_Model_User
|
|||
public static function getUsersOfType($type) {
|
||||
return CcSubjsQuery::create()->filterByDbType($type)->find();
|
||||
}
|
||||
public static function getFirstAdminId() {
|
||||
$admins = Application_Model_User::getUsersOfType('A');
|
||||
if (count($admins) > 0) { // found admin => pick first one
|
||||
return $admins[0]->getDbId();
|
||||
} else {
|
||||
Logging::warn("Warning. no admins found in database");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static function getUsers(array $type, $search=null)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
@ -342,7 +351,6 @@ class Application_Model_User
|
|||
public static function getCurrentUser()
|
||||
{
|
||||
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
if (is_null($userinfo)) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue