CC-1434 && CC-1373

Won't delete a file that's scheduled or contained in a playlist.
This commit is contained in:
naomiaro 2010-09-13 14:05:45 -04:00
parent 51436f76b8
commit 4d3b90621e
2 changed files with 87 additions and 11 deletions

View file

@ -331,7 +331,7 @@ class StoredFile {
* @var int
*/
private $currentlyaccessing;
/**
* @var int
*/
@ -1086,6 +1086,35 @@ class StoredFile {
}
return TRUE;
}
/**
* Returns gunIds of the playlists the stored file is in.
*/
public function getPlaylists() {
global $CC_CONFIG, $CC_DBC;
$_SESSION['delete'] = "gunid: " . $this->gunid;
$sql = "SELECT gunid "
." FROM ".$CC_CONFIG['mdataTable']
." WHERE object='{$this->gunid}'";
$_SESSION['delete'] = $sql;
$playlists = $CC_DBC->getAll($sql);
return $playlists;
}
public function isScheduled() {
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT * "
." FROM ".$CC_CONFIG['scheduleTable']
." WHERE ends > now() and playlist=x'{$this->gunid}'::bigint";
$scheduled = $CC_DBC->getAll($sql);
return $scheduled;
}
/**