cc-2882: Airtime cannot delete watched folder when is been renamed
- initial commit Conflicts: airtime_mvc/application/models/MusicDir.php
This commit is contained in:
parent
6a0a739cef
commit
46146d1216
7 changed files with 104 additions and 5 deletions
|
@ -283,6 +283,14 @@ class MusicDir {
|
|||
|
||||
public static function removeWatchedDir($p_dir){
|
||||
$p_dir = realpath($p_dir)."/";
|
||||
$real_path = realpath($p_dir)."/";
|
||||
if($real_path != "/"){
|
||||
$p_dir = $real_path;
|
||||
}else{
|
||||
// this is the case where user removes watched directory on
|
||||
// the file system directly.
|
||||
$p_dir .= "/";
|
||||
}
|
||||
$dir = MusicDir::getDirByPath($p_dir);
|
||||
if($dir == NULL){
|
||||
return array("code"=>1,"error"=>"'$p_dir' doesn't exist in the watched list.");
|
||||
|
|
|
@ -576,6 +576,27 @@ class StoredFile {
|
|||
{
|
||||
return StoredFile::Recall(null, null, null, $p_filepath);
|
||||
}
|
||||
|
||||
public static function RecallByPartialFilepath($partial_path){
|
||||
$path_info = MusicDir::splitFilePath($partial_path);
|
||||
|
||||
if (is_null($path_info)) {
|
||||
return null;
|
||||
}
|
||||
$music_dir = MusicDir::getDirByPath($path_info[0]);
|
||||
|
||||
$files = CcFilesQuery::create()
|
||||
->filterByDbDirectory($music_dir->getId())
|
||||
->filterByDbFilepath("$path_info[1]%")
|
||||
->find();
|
||||
$res = array();
|
||||
foreach ($files as $file){
|
||||
$storedFile = new StoredFile();
|
||||
$storedFile->_file = $file;
|
||||
$res[] = $storedFile;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function searchFilesForPlaylistBuilder($datatables) {
|
||||
global $CC_CONFIG;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue