[Koha-bugs] [Bug 19318] Add ability to use custom file upload paths

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Sep 13 12:24:30 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19318

Julian Maurice <julian.maurice at biblibre.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #71017|0                           |1
        is obsolete|                            |

--- Comment #4 from Julian Maurice <julian.maurice at biblibre.com> ---
Created attachment 78620
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78620&action=edit
Bug 19318: Allow multiple storage spaces for file uploads

This patch allow to configure multiple storage spaces to be used when
uploading a file.

Configuration is done in $KOHA_CONF. Element 'upload_path' is replaced
by 'storage', which is repeatable and can contain the following
elements:
- name: The storage's identifier (also used for display)
- adapter: The storage's adapter is a Perl module who is responsible for
  actually writing in the storage (creating/deleting files/directories).
  There is actually only one adapter, 'directory', which writes directly
  on the filesystem.
- adapter_params: Additional parameters required for the storage's
  adapter
- hash_filename: Whether to prepend hashvalue to the filename or not
- temporary: Whether the storage is temporary or not
- baseurl: Base URL of the storage, if one doesn't want to (or can't)
  use opac-retrieve-file.pl
This is all documented in Koha::Storage

There is two built-in storages:
- 'TMP', the default temporary storage (not configurable)
- 'DEFAULT', the default persistent storage (configurable in $KOHA_CONF)

Note that if $KOHA_CONF is not updated, uploads should continues to work
(the 'DEFAULT' storage will use 'upload_path', if set)

This patch affects the following pages:
- Tools › Upload
- Tools › Upload local cover image (ZIP file upload)
- Tools › Stage MARC records for import
- Tools › Upload patron images
- Circulation › Offline circulation file upload
- Cataloguing plugin upload.pl

Test plan:
0. Before applying the patch, be sure to use the pages mentioned above
   and upload some files, those files should continue to be accessible
   after the patch
1. Apply the patch, run updatedatabase and update_dbix_class_files
2. Without modifying $KOHA_CONF, verify that files uploaded in step 0
   are still accessible (you can find them in tools/upload.pl)
3. Verify that you can still upload files using the pages mentioned
   above
4. Edit your $KOHA_CONF, copy the <storage> element from
   etc/koha-conf.xml in the source, set the <path> using the value of
   <upload_path> and remove <upload_path>
5. Verify that you can still upload files
6. Add another storage in $KOHA_CONF, set <hash_filename> to 0,
   and a <baseurl>. Now try to use the cataloguing plugin and see how
   the generated URL change. Also note that the files keep their
   original filename (without the hashvalue prepended)
7. Create some subdirectories under the main storage's path (using a
   shell). Try to upload a new files and see that these directories
   appear in a dropdown list. Select one, finish the upload and verify
   that the file has been uploaded to the selected subdirectory.
8. Run prove t/ImportBatch.t t/Koha/Storage.t
   t/db_dependent/ImportBatch.t t/db_dependent/Upload.t

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list