This bugtracker is kept to provide history on old issues.
|Anonymous | Login | Signup for a new account||2018.12.15 23:03 CET|
|My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0003194||Piwigo||albums||public||2015.02.01 17:42||2015.02.01 17:42|
|Target Version||Fixed in Version|
|Summary||0003194: Initial albums sorting by synchronization|
|Description||When synchronization running a new directories/albums are learnt from filesystem by get_fs_directories function in admin/include/functions.php. It use readdir PHP function without any type of sorting. I tested it for some time and order of this dirs is pretty mysterious. My tests was based on three directories (rok_01, rok_02, rok_03) and some experiments with mtimes, ctimes, inode numbers of directories and files. In all my tests i had rok_02 before rok_01. Don't know why, but i figured out how to do it better.|
I changed get_fs_directories function to use glob PHP function instead of opendir/readdir/closedir. There is also usort, which sorts new categories by mtime (modify time) of corresponding directories.
Tested dot (hidden) directories and performance too. Speed is roughly the same (about 80 milliseconds for my 500 albums).
I think this is more logical and also very useful when importing a huge number of albums. For example i plan to change mtime of every dir based on information from Gallery2 SQL table so with some luck i will have the same album order like in original gallery.
Full function code attached and pasted to http://pastebin.com/TaPvryyh [^] too.
|Tags||No tags attached.|
|Database engine and version|
|Attached Files||get_fs_dir.txt [^] (1,131 bytes) 2015.02.01 17:42 [Show Content]|
|2015.02.01 17:42||jc||New Issue|
|2015.02.01 17:42||jc||File Added: get_fs_dir.txt|
|2015.02.01 17:42||jc||browser||=> any|
|2015.02.01 17:42||jc||Web server||=> any|
|Copyright © 2000 - 2018 MantisBT Team Contact|