change gallary scanning to support gallaries inside archives
This commit is contained in:
parent
a5df3f8ea7
commit
af214d9dcd
3 changed files with 13 additions and 18 deletions
|
@ -62,7 +62,7 @@ function handleFilescan($cleanup) {
|
|||
|
||||
function handlePartialCreate($path) {
|
||||
if (empty($path)) OC_JSON::error(array('cause' => 'No path specified'));
|
||||
if (!OC_Filesystem::is_dir($path)) OC_JSON::error(array('cause' => 'Invalid path given'));
|
||||
if (!OC_Filesystem::is_dir($path.'/')) OC_JSON::error(array('cause' => 'Invalid path given'));
|
||||
|
||||
$album = OC_Gallery_Album::find(OC_User::getUser(), null, $path);
|
||||
$albums = array();
|
||||
|
|
|
@ -53,7 +53,7 @@ function scanForAlbums(cleanup) {
|
|||
}
|
||||
$('#scanprogressbar').progressbar({ value: (albumCounter/totalAlbums)*100 }).fadeIn();
|
||||
for(var a in r.paths) {
|
||||
$.getJSON('ajax/galleryOp.php?operation=partial_create&path='+r.paths[a], function(r) {
|
||||
$.getJSON('ajax/galleryOp.php',{operation:'partial_create','path':r.paths[a]}, function(r) {
|
||||
|
||||
if (r.status == 'success') {
|
||||
Albums.add(r.album_details.albumName, r.album_details.imagesCount);
|
||||
|
|
|
@ -53,7 +53,7 @@ class OC_Gallery_Scanner {
|
|||
$current_album = array('name'=> $path, 'imagesCount' => 0, 'images' => array());
|
||||
$current_album['name'] = self::createName($current_album['name']);
|
||||
|
||||
if ($dh = OC_Filesystem::opendir($path)) {
|
||||
if ($dh = OC_Filesystem::opendir($path.'/')) {
|
||||
while (($filename = readdir($dh)) !== false) {
|
||||
$filepath = ($path[strlen($path)-1]=='/'?$path:$path.'/').$filename;
|
||||
if (substr($filename, 0, 1) == '.') continue;
|
||||
|
@ -103,21 +103,16 @@ class OC_Gallery_Scanner {
|
|||
}
|
||||
|
||||
public static function find_paths($path) {
|
||||
$ret = array();
|
||||
$dirres;
|
||||
$addpath = FALSE;
|
||||
if (($dirres = OC_Filesystem::opendir($path)) == FALSE) return $ret;
|
||||
|
||||
while (($file = readdir($dirres)) != FALSE) {
|
||||
if ($file[0] == '.') continue;
|
||||
if (OC_Filesystem::is_dir($path.$file))
|
||||
$ret = array_merge($ret, self::find_paths($path.$file.'/'));
|
||||
if (self::isPhoto($path.$file)) $addpath = TRUE;
|
||||
}
|
||||
|
||||
if ($addpath) $ret[] = urlencode($path);
|
||||
|
||||
return $ret;
|
||||
$images=OC_FileCache::searchByMime('image');
|
||||
$paths=array();
|
||||
foreach($images as $image){
|
||||
$path=dirname($image);
|
||||
if(array_search($path,$paths)===false){
|
||||
error_log($path);
|
||||
$paths[]=$path;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue