cc-4274: implemented james' hack to fix this issue.

This commit is contained in:
Rudi Grinberg 2012-08-28 12:35:19 -04:00
parent 0517e674bd
commit 33bb4e600c
2 changed files with 8 additions and 4 deletions

View File

@ -689,7 +689,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$dir_id = $request->getParam('dir_id');
$this->view->files = Application_Model_StoredFile::listAllFiles($dir_id);
$this->view->files =
Application_Model_StoredFile::listAllFiles($dir_id, $all=true);
}
public function listAllWatchedDirsAction()

View File

@ -1003,19 +1003,22 @@ class Application_Model_StoredFile
* @param $dir_id - if this is not provided, it returns all files with full path constructed.
* @param $propelObj - if this is true, it returns array of proepl obj
*/
public static function listAllFiles($dir_id=null, $propelObj=false)
public static function listAllFiles($dir_id=null, $propelObj=false,
$all=false)
{
$con = Propel::getConnection();
$file_exists = $all ? "" : "and f.file_exists = 'TRUE'";
if ($propelObj) {
$sql = "SELECT m.directory || f.filepath as fp"
." FROM CC_MUSIC_DIRS m"
." LEFT JOIN CC_FILES f"
." ON m.id = f.directory WHERE m.id = $dir_id and f.file_exists = 'TRUE'";
." ON m.id = f.directory WHERE m.id = $dir_id $file_exists";
} else {
$sql = "SELECT filepath as fp"
." FROM CC_FILES"
." WHERE directory = $dir_id and file_exists = 'TRUE'";
." WHERE directory = $dir_id $file_exists";
}
$rows = $con->query($sql)->fetchAll();