UpdraftPlus provides two filter hooks to exclude files and directories programmatically: ‘updraftplus_exclude_file’ and ‘updraftplus_exclude_directory’
The hooks work as expected and are very helpful to exclude files and directories conditionally. For example if you don’t want to work with incremental backups due to the lack of fine tuning but you don’t want to backup thousands of images from past years every day you can use those filter hooks to exclude past years (2010, 2012, 2012 etc.) from the uploads directory except on the 1st day of a month. This dramatically reduces backup time and drive space. So far thank you again for providing developers this wonderful feature.
Unfortunately both filter hooks run late from the method ‘UpdraftPlus_Backup->makezip_recursive_add’. This means although those files and directories shall be excluded from the backup they get touched (taken into account, considered for a backup … hope you understand what I try to say) i the first place. Imho the hooks should run early like it is done with the exclusions from the settings screen (e.g. UpdraftPlus_Options::get_updraft_option(‘updraft_include_uploads_exclude’, UPDRAFT_DEFAULT_UPLOADS_EXCLUDE);).
Think about my example above. I have customers with 500.000 and more images from 10 years running a website. If I exclude all directories from the past 9 years why would I first scan them and build a filelist for them? Imho a better approach would be to move the hooks (or introduce new ones if the work flow demands that) into the method ‘UpdraftPlus->compile_folder_list_for_backup’.
To be honest I have not read the whole source code just the part dealing with the exclusion of directories. Saying this talking about the exclusion of files and directories might be wrong. Forgive me in that case. I just wanted to make sure my intention gets clear to skip excluded files and directories as early as possible to save valuable time if it comes to millions of files on a hosting server with dozens of customers.
What do you think? May we sea such an enhancement in a future update?
Kind regards
Michael