Piwigo Bugtracker

Piwigo bug tracker has moved to Github

This bugtracker is kept to provide history on old issues.

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003194Piwigoalbumspublic2015.02.01 17:422015.02.01 17:42
Assigned To 
PlatformOSOS Version
Product Version2.7.3 
Target VersionFixed in Version 
Summary0003194: Initial albums sorting by synchronization
DescriptionWhen 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.
TagsNo tags attached.
Database engine and version
PHP version
Web serverany
Attached Filestxt file icon get_fs_dir.txt [^] (1,131 bytes) 2015.02.01 17:42 [Show Content]

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
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 - 2019 MantisBT Team
Powered by Mantis Bugtracker