Merge branch 'MDL-30619_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE
[moodle.git] / repository / upgrade.txt
blob2e34391e647fe89b3f4d06395aa8c192ee411a3c
1 This files describes API changes in /repository/ repository system,
2 information provided here is intended especially for developers. Full
3 details of the repository API are available on Moodle docs:
4 http://docs.moodle.org/dev/Repository_API
6 === 2.6 ===
8 * get_option() now always return null when the first parameter ($config) is not empty, and
9   no value was found for this $config. Previously this could sometimes return an empty array().
11 * The function repository_attach_id() was removed, it was never used and was not useful.
13 * New functions send_relative_file() and supports_relative_file() to allow sending relative linked
14   files - see filesystem repository for example.
16 * DB fields files.referencelifetime, files.referencelastsync and files_reference.lifetime
17   are deleted. The last synchronization time is stored only in files_reference.lastsync
18   and lifetime is not stored in DB any more, each repository must decide for itself
19   when to synchronize the file in function repository::sync_reference().
21 * The following methods in class repository are deprecated: sync_external_file(),
22   get_file_by_reference(), get_reference_file_lifetime(), sync_individual_file() and
23   reset_caches(). Instead there is one method repository::sync_reference() - this simplifies
24   the repositories API and reduces the number of DB queries.
26 * Deprecated const GETFILE_TIMEOUT, SYNCFILE_TIMEOUT and SYNCIMAGE_TIMEOUT and replaced them with
27   config variables repositorygetfiletimeout, repositorysyncfiletimeout and repositorysyncimagetimeout.
29 === 2.5 ===
31 * repository::append_suffix() has been deprecated, use repository::get_unused_filename() if you need
32   to get a file name which has not yet been used in the draft area.
34 * contains_private_data() is a new method to determine if a user 'logged in as' another user
35   can access the content of the repository. The default is to return True (no access).
37 * get_typename() returns the type of repository: dropbox, googledocs, etc...
39 * can_be_edited_by_user() encapsulates all the tests to make sure that the current user
40   has the rights to edit the instance of this repository.
42 * repository::get_instances() (used by filepicker and texteditor to populate the
43   list of available repositories) now calls repository constructor specifying the
44   context where repository will be used.
45   When checking permissions inside repository class use:
46   $this->instance->contextid - to find the context where repository was created;
47   $this->context - to find the current context where repository is used.
48   This also means that the same repository instance may now have different names when
49   called from different contexts.
50   Avoid calling repository::get_instance(), use repository::get_repository_by_id() instead.
52 === 2.4 ===
54 * copy_to_area() can receive a new parameter called $areamaxbytes which controls the maximum
55   size of the area the files will be stored in.
57 * the repositories using the upload() method should implement a check for $areamaxbytes,
58   see repository/upload/lib.php upload() and process_upload() for an example on how handling it.
60 === 2.3 ===
62 * instance_config_form() must now be declared static for php5.4 compatibility.
64 * get_listing() and search() file metadata details are now now more prominently
65   displayed in the interface. Dates and timestamos are now able to be sorted on in
66   the filepicker interface so plugin authors are asked to ensure:
67     - Dates are defined as UNIX timestamps
68     - Filesize is an integer in bytes
70 * It is recomended to define function get_file_source_info() to provide more rich
71   infromation about the source of a file.
73 * The API was extended to allow repositories can now support external references, please
74   see http://docs.moodle.org/dev/Repository_API for further details.