64 Commits

Author SHA1 Message Date
Dan Poltawski
0e35ba6ffc MDL-36357 cleanup - remove double semicolons 2012-11-15 09:51:26 +08:00
Sam Hemelryk
52ebfade63 Merge branch 'MDL-34607-master' of git://github.com/FMCorz/moodle
Conflicts:
	lib/db/upgrade.php
	version.php
2012-09-25 09:51:28 +12:00
Frederic Massart
db232bb0f4 MDL-34607 File API: Natural sort on area tree files 2012-09-21 10:08:46 +08:00
Rex Lorenzo
ff37d63c1b MDL-35376 - Shortcut/alias not working for Private file repo 2012-09-11 14:23:12 -07:00
Marina Glancy
42aa6e15bb MDL-34290, MDL-33416 prepare to deprecate fields files.referencelastsync and referencelifetime 2012-08-29 11:56:18 +08:00
Marina Glancy
437f5dc4cf MDL-34290 Auto synchronise newly created references when possible 2012-08-29 11:56:17 +08:00
Marina Glancy
bc6f241ca2 MDL-34290 repository API: add repository function to import referenced file
it must be independed from sync_external_file because sync often does not actually download contents, it is used just to retrieve
the size of the file. Besides the timeouts for get_file and sync requests are very different.

Also add option to send_stored_file() to ignore reference and send cached contents
2012-08-29 11:56:15 +08:00
Marina Glancy
14b7e50001 MDL-34290 update all references after the source is changed
- When several records in {files} have the same record in {files_reference} and the synchronisation is performed, we need to update
all records in {files} so all files know if source is changed and that sync was performed;
- also when local moodle file content is changed we immediately update all files referencing to it (therefore sync of references
to the local files is unnecessary);
2012-08-29 11:56:00 +08:00
David Mudrák
483afa446d MDL-33453 Make it clear what search_references() and search_references_count() are good for
Initially it was not clear enough that these two methods are supposed to
be used for looking for references to a stored_file only. So the docs
comments are improved and unittests added to illustrate the usage.

The patch also removes the unittest for get_references_by_storedfile()
as its usage is already covered in other test methods.
2012-07-05 17:15:37 +02:00
David Mudrák
6feae1d256 MDL-33430 Make file_storage::unpack_reference() more picky on what it gets 2012-06-21 01:32:24 +02:00
Marina Glancy
cfc4db405c MDL-33550 Set default status for file =0 and correct setting user in phpunit test 2012-06-14 14:52:31 +08:00
Marina Glancy
0b2bfbd1c6 MDL-33550 Correctly process situation when file reference source is missing
- do not die with fatal error if source file in moodle internal repository is missing;
- moved code duplication for moodle repositories into class repository (functions send_file, get_reference_details, get_file_by_reference, get_file_reference);
- update file status after repository::sync_external_file so we know that it is missing (or not missing anymore). Do not run this function more than once for file within one request;
- display readable name for Private Files and Server files with the new format;
- display broken icon in filemanager if we know that source is missing, display information (for admin) where it was located before: see repository::get_reference_details() and extending classes;
- removed unnecessary queries in stored_file::sync_external_file();
- syncronize files before displaying it's size in mod_resource, do not query  directly
2012-06-13 12:11:06 +08:00
David Mudrak
0ad654dc8b MDL-33330 Use the referencehash when searching for references
Together with this, refactoring and cleanup of search_references() and
similar methods was done. SQL was improved to use the INNER JOIN instead
of the LEFT JOIN as we are really interested in records that have a
reference. Also, joining the {repository_instances} table assures that
only references with valid repository_instance are returned (the check
against is_external_file() can't be applied to the methods that return
the count of references so I dropped it completely).
2012-06-05 14:07:25 +02:00
David Mudrak
dccba8bcc9 MDL-33330 Populate referencehash field values 2012-06-05 14:07:24 +02:00
David Mudrak
d83ce95322 MDL-33330 improved {files_reference} records creation
This patch unifies the way how records in {files_reference} get created.
Previously, each reference file (i.e. a file with referencefileid set)
created its own record in {files_reference}. This patch makes sure that
existing record is reused if possible.

Bye bye 1:1 relationships, you suck!
2012-06-05 13:39:09 +02:00
Dan Poltawski
e73b42ca57 Merge branch 'wip-MDL-33399-m23' of git://github.com/samhemelryk/moodle 2012-05-29 14:57:05 +08:00
Sam Hemelryk
9f4789b842 MDL-33399 files: Fixed up handling of empty sort in File API methods.
The following three methods of file_storage have been patched:
* get_external_files
* get_area_files
* get_directory_files
2012-05-29 16:38:47 +12:00
Dan Poltawski
995e479067 Merge branch 'wip-MDL-33338-master' of git://github.com/marinaglancy/moodle 2012-05-28 15:43:33 +08:00
Marina Glancy
4c2fcbfc85 MDL-33338 recognising the mimetype for uploaded files
- when file is uploaded in php, the tmpname does not have initial extension and mimetype recognition by extension fails
- another issue is that import form for questions fails with fatal error when it should just say that field is required
2012-05-28 15:19:41 +08:00
Sam Hemelryk
63f2813497 Merge branch 'dev_MDL-33147_transaction' of git://github.com/dongsheng/moodle 2012-05-28 11:04:43 +12:00
Sam Hemelryk
6347a6216d MDL-33172: Fixed whitespace 2012-05-25 11:37:07 +12:00
Dan Poltawski
3447100cdb MDL-33172 - filestorage: Fix oracle incompatibilites
Fixes the following problems:

* When we select from two tables with the same named fields (id)
  and ask to sort by that field, Oracle doesn't know which table to
  sort frm unless that field is named in the SELECT. Here we do that
  by explicitly naming the fields. This keeps compatibility with before
  the reference table was added.

* Text comparisong without sql_compare_text
2012-05-25 11:17:56 +12:00
Marina Glancy
ae7f35b934 MDL-33144 display filetype icon and mimetype based on extension
- use finfo to determine mimetype of a file only when it is unknown from file extension
- display filetype icon and mimetype in filemanager based on file extension
- fixed a small issue with specifying extension instead of group in file_get_typegroup()
- allow only web-compartible image types when embedding into editor or using in database field
- created new groups web_video and web_audio to use in resource module
2012-05-23 14:51:55 +08:00
Dongsheng Cai
e3c0211879 MDL-33147 Added transaction support for some Files APIs 2012-05-22 13:51:04 +08:00
David Mudrak
10f0978bff MDL-32471 redefining the tinyicon thumbnail size to 24x24
As requested by the Files 2.3 UI team.
2012-05-21 11:37:29 +02:00
Marina Glancy
a8d6dda4f2 MDL-32247 fixed bug with displaying icon for unknown filetype, fixed merge mistakes 2012-05-21 17:12:55 +08:00
Dongsheng Cai
8177b7b9f0 MDL-33082 Detecting mimetype based on content bytes 2012-05-21 15:26:39 +08:00
Dongsheng Cai
fc4e8034fc MDL-32867 filemanager and repository
1. Allowing "." as filename, so filemanager can rename folder
2. Fixed import_external_file method
3. Disallow recent repository to list file references
2012-05-21 11:57:55 +08:00
Dongsheng Cai
04e3b007c2 MDL-28666 phpdoc improvements 2012-05-21 11:57:54 +08:00
Dongsheng Cai
462c4955f4 MDL-28666 file_storage::get_directory_files() supports references 2012-05-21 11:57:54 +08:00
Dongsheng Cai
7051415cca MDL-28666 Files API and db changes
1. Fix db regression
2. Unit tests for is_external_file() and rename exception
3. Searching reference method exclude draft files
2012-05-21 11:57:54 +08:00
Dongsheng Cai
6723372514 MDL-28666 Extends repository to support references
1. Allow repository to create references to external contents
2. Extends files API to handle file references
3. Generic file caching
4. Backup/restore file references
5. Download external contents if repository uninstalled
6. Allow filepicker to display iframe
7. PHPUnit test suits
2012-05-21 11:57:51 +08:00
Petr Skoda
d5dd0540c2 MDL-26028 send_file performance improvements
Includes X-Sendfile support, ETags for stored_files and general cleanup.
2012-04-29 18:27:23 +02:00
David Mudrak
f7eec6ce79 MDL-32471 improved SQL to prevent potential full table scans 2012-04-25 13:44:36 +02:00
David Mudrak
94d104172e MDL-32471 just a trivial change to prevent eventual issues with various preview modes 2012-04-25 11:53:57 +02:00
David Mudrak
fe68aac7d9 MDL-32471 using === for string comparison
Thanks to Petr Skoda for spotting this during the peer-review.
2012-04-24 16:10:46 +02:00
David Mudrak
9120a46257 MDL-32471 remove orphaned preview files via cron 2012-04-24 15:14:09 +02:00
David Mudrak
c4d19c5a07 MDL-32471 introducing file_storage::get_file_preview() method 2012-04-24 12:09:45 +02:00
Petr Skoda
f8311defeb MDL-31301 use static textlib methods 2012-03-03 11:46:13 +01:00
Dongsheng Cai
d2b7803e5a MDL-30973 Files API, check and update DocBlock 2012-02-15 12:48:57 +08:00
Aparup Banerjee
357317fb6e Merge branch 'MDL-27432_gd_error' of git://github.com/andyjdavis/moodle 2011-12-08 13:56:51 +08:00
Andrew Davis
6b2f218473 MDL-27432 mod_data: improved handling of the absence of the GD php extension 2011-11-28 12:58:44 +08:00
Aparup Banerjee
4cff8cb550 Merge branch 'MDL-28562_wip' of https://github.com/jamiepratt/moodle 2011-11-23 12:36:35 +08:00
Petr Skoda
260c4a5b09 MDL-29773 prevent negative unix timestamps in the files table 2011-10-14 15:52:49 +02:00
Petr Skoda
694f3b74c7 MDL-29773 use db debuginfo when file record insertion fails 2011-10-14 15:30:54 +02:00
Petr Skoda
65e9eac0d1 MDL-29401 fix forgotten area
Thanks Eloy!
2011-09-26 02:16:31 +02:00
Petr Skoda
aff24313be MDL-29401 introduce new frankenstyle PARAM types
New PARAM_COMPONENT, PARAM_AREA and PARAM_PLUGIN + fixing of hopefully all current incorrect parameter types. This should help with diagnosing of incorrectly named 3rd party plugins too.
2011-09-25 09:59:55 +02:00
Jamie Pratt
0ea7fc2587 MDL-28562 "automatic naming of file in convert_image not working"
there is an obvious typo in the code causing the problem. The use of 
an equality check instead of the intended assignment.
2011-08-01 22:43:37 +07:00
Tim Hunt
d610cb8980 MDL-27915 improved debuginfo for some file exceptions. 2011-06-17 19:46:09 +01:00
Sam Hemelryk
5f1c825dfa Merged MDL-27251 Fixed up whitespace, Fixed broken string, reworded new strings 2011-05-03 10:51:06 +08:00