139 Commits

Author SHA1 Message Date
Brendan Heywood
5bf5a7aaeb MDL-68342 files: Add a faster xsendfile method to avoid db lookups 2020-04-27 16:11:34 +10:00
Brendan Heywood
2d98ebb9de MDL-67635 file_storage: Speedup file storage cleanup cron 2020-01-08 14:00:48 +11:00
Mikhail Golenkov
1a15925240 MDL-66304 files: Allow xsendfile support in alternative file system. 2019-09-30 09:00:57 +10:00
Matt Porritt
d7e4481e98 MDL-35773 Backup: API should have option to not backup files
Allow both UI and automated backups to be created without
including files.  Instead include only file references.
This is essentially implementing "SAMESITE" to backup files
instead of only for import and export functionality.
A new backup setting to include files (defaults to yes)
has been included.

The restore process will also look for and attempt to
restore files from the trashdir as part of restoring
backups.  Additionally to support this process the
ammount of time files are kept in trashdir before they
are cleaned up via cron is also adjustable via admin
setting.
2019-07-26 11:59:56 +08:00
Ryan Wyllie
cba111b376 MDL-64820 filestorage: add multi item support to get_area_files 2019-03-22 09:24:04 +08:00
Tim Hunt
27d625a863 MDL-62482 file_storage: may have many files with same content hash 2018-05-17 11:24:33 +01:00
sam marshall
a938e4096c MDL-60174 core_dml: fix miscellaneous incorrect recordset usage
The new recordset support for Postgres requires transactions and
will cause errors if recordsets are not closed correctly. This
commit fixes problems that were identified during unit tests, and
via some basic code analysis, across all core code. Most of these
are incorrect usage of recordset (forgetting to close them).
2017-11-27 11:10:33 +00:00
Matteo Scaramuccia
5ca85a1efe MDL-60318 filestorage: Fixed undefined method move_to_trash() 2017-10-02 22:49:42 +02:00
Cameron Ball
03756f0bdb
MDL-59700 filestorage: Rework repositories to avoid add_file_to_pool
For historical reasons repositories need to call add_file_to_pool
to sync file records. However now that a before_file_created hook
has been added additional information is needed by add_file_to_pool.

Ideally add_file_to_pool and friends will become private/protected,
so we need to remove all uses of it in core.

This patch adds some new methods to the file class to allow syncing
to be managed internally by the file and the file_storage class.
2017-08-07 15:50:15 +08:00
Cameron Ball
8243706542
MDL-59700 filestorage: Add before_file_created hook 2017-08-07 12:27:04 +08:00
gthomas2
023037dc9e MDL-57476 file: Add CUD callbacks 2017-07-14 13:51:51 +01:00
Jake Dallimore
84fb93a77e Merge branch 'MDL-58297-master' of git://github.com/andrewnicols/moodle 2017-04-11 10:49:07 +08:00
Andrew Nicols
a30a04fa01 MDL-58297 filestorage: New functions for hash calculation 2017-04-07 10:40:23 +08:00
Damyon Wiese
13b449f4a5 MDL-58220 oauth2: cibot cleanups 2017-04-03 13:43:25 +08:00
Damyon Wiese
141ee541ca MDL-58219 repository: Change how controlled links work
Files are copied to the system user as soon as they are uploaded. Write access is then controlled when
serving links to the file.

Part of MDL-58220
2017-04-03 13:41:19 +08:00
Damyon Wiese
151b0f9409 MDL-58132 repositories: Controlled link file type
This introduces a new "controlled link" file type where the file is not
stored in Moodle - but Moodle will control the access permissions on the file.

Plugins can "freeze" a filearea which means Moodle will take ownership of all the remote
files of this type.

When accessing a file, if the "filebrowser" infomation indicates the current user can write to the file, they
will be granted temporary write access.

Part of MDL-58220
2017-04-03 13:40:13 +08:00
Andrew Nicols
1568168717 MDL-55528 fileconverter_unoconv: Add new unoconv plugin
AMOS BEGIN
 MOV [pathtounoconv,admin],[pathtounoconv,fileconverter_unoconv]
 MOV [pathtounoconv_help,admin],[pathtounoconv_help,fileconv_helperter_unoconv_help]
 MOV [unoconvwarning,admin],[unoconvwarning,fileconverter_unoconv]
 MOV [test_unoconv,assignfeedback_editpdf],[test_unoconv,fileconverter_unoconv]
 MOV [test_unoconvempty,assignfeedback_editpdf],[test_unoconvempty,fileconverter_unoconv]
 MOV [test_unoconvdoesnotexist,assignfeedback_editpdf],[test_unoconvdoesnotexist,fileconverter_unoconv]
 MOV [test_unoconvdownload,assignfeedback_editpdf],[test_unoconvdownload,fileconverter_unoconv]
 MOV [test_unoconvisdir,assignfeedback_editpdf],[test_unoconvisdir,fileconverter_unoconv]
 MOV [test_unoconvnotestfile,assignfeedback_editpdf],[test_unoconvnotestfile,fileconverter_unoconv]
 MOV [test_unoconvnotexecutable,assignfeedback_editpdf],[test_unoconvnotexecutable,fileconverter_unoconv]
 MOV [test_unoconvok,assignfeedback_editpdf],[test_unoconvok,fileconverter_unoconv]
 MOV [test_unoconvversionnotsupported,assignfeedback_editpdf],[test_unoconvversionnotsupported,fileconverter_unoconv]
AMOS END
2017-03-10 10:45:46 +08:00
Andrew Nicols
16a34ae189 MDL-46375 core_files: Split parts of file_storage into new file system
This change moves all operations which deal with the fetching/updating, or
setting of files from the file_storage class into a new file_system class.

A new file_system can be specified in the config.php and used to replace
all relevant methods in order to move the file system component to an
alternative solution.
2017-02-14 08:42:28 +08:00
sam marshall
66234de24c MDL-57515 Resource: 'not very efficient' with a large number of files
Fixes bug where the resource module loads metadata for all files while
building course modinfo, even though it only needs the first file.
(This causes problems if you have ~10k files.)
2017-01-10 17:43:46 +00:00
David Monllao
c9af13123d MDL-54751 course_modules: New major upgrade point
Also trailing whitespace cleaned.
2016-11-07 08:59:04 +08:00
Jake Dallimore
3869d77411 MDL-54751 core_course: Edit course libs to support deletion flag
Changed the course libs such that module and section deletion is now
handed off to relevant functions in the util class and exempted
modules scheduled for deletion from the course backups.
2016-11-07 07:41:59 +08:00
Russell Smith
cebce76f61 MDL-56307 course: Refactor file_storage 2016-10-25 10:10:53 +01:00
Juan Leyva
1896b8009a MDL-56307 course: API changes to support retrieve by time 2016-10-25 10:10:52 +01:00
Andrew Nicols
0a0eaa7dfc Merge branch 'MDL-54647-master' of git://github.com/damyon/moodle 2016-08-16 08:01:47 +08:00
Damyon Wiese
300852ee30 MDL-54647 file_storage: Redo the test pdf every time it's viewed 2016-08-15 16:32:21 +08:00
Andrew Nicols
40cc0ba04e Merge branch 'MDL-55513-master' of https://github.com/lucisgit/moodle 2016-08-15 14:07:41 +08:00
Tony Butler
2ee668ec56 MDL-55513 core_filestorage: Touch and test size instead of file_exists()
file_exists() can return false when file exists (in certain scenarios)
2016-08-10 09:35:23 +01:00
Tony Butler
e98483d748 MDL-55513 core_filestorage: Pass full path of temp dir to remove_dir() 2016-08-10 09:35:23 +01:00
Matt Davidson
826bb3547b MDL-55246 assign: convert files with spaces
If a file is sent to unoconv with a filename that contains spaces,
unoconv will fail to produce the intended results.
2016-08-05 08:14:20 -04:00
Simey Lameze
37eafbb6dc MDL-54948 core_files: return false if theres no output from unoconv 2016-06-23 08:37:23 +08:00
Simey Lameze
9254ba09e8 MDL-54948 core_files: make the check consistent on unoconv test page 2016-06-21 09:36:44 +08:00
David Monllao
50c338b84b Merge branch 'MDL-54544-master' of git://github.com/damyon/moodle 2016-05-18 13:55:05 +08:00
Damyon Wiese
4f54bdc733 MDL-54544 files: Better error handling in $fs->create_converted_document() 2016-05-18 13:44:13 +08:00
Damyon Wiese
5620177efd MDL-54544 file: Use shared tmp storage for unoconv document conversions 2016-05-17 10:58:25 +08:00
Adrian Greeve
0eecf87687 MDL-53923 mod_assign: Movement of functions to file_storage. 2016-05-16 14:32:54 +08:00
Matteo Scaramuccia
bc219382b7 MDL-53837 assign: Fix executable check for 'unoconv.py' on Windows. 2016-04-17 22:35:13 +02:00
Damyon Wiese
6853cd5ed4 MDL-52954 assign: Fix the reasonable cibot warnings. 2016-03-30 14:07:28 +08:00
Damyon Wiese
bb690849c9 MDL-52954 assign: Rebuild the assignment single grade page. 2016-03-30 13:47:21 +08:00
Damyon Wiese
1356d85151 MDL-52954 core: Change from pandoc to unoconv - it gives better results
Most importantly it retains formatting better, and supports different charsets far better than pandoc.
2016-03-30 11:48:39 +08:00
Damyon Wiese
2e76c14e11 MDL-52954 core: Add a document converter to file_storage
This lets us convert between common office formats. E.g. docx -> pdf
html -> pdf, html -> ods.

This commit also updates assignment editpdf plugin to use this converter
on all compatible submission files.
2016-03-30 11:48:39 +08:00
Eloy Lafuente (stronk7)
b4153ff09d Merge branch 'wip-MDL-51985-master' of https://github.com/marinaglancy/moodle 2015-12-03 11:16:34 +01:00
Jun Pataleta
a33e5debe9 MDL-37308 files: Additional fixes for transparency
Fixed transparency support when resizing and when not resizing.
2015-11-29 20:28:19 -06:00
Jetha Chan
623c947f2b MDL-37308 files: support transparency when not resizing; new unit test 2015-11-29 20:28:19 -06:00
Adrian Greeve
e245843193 MDL-37308 files: convert_image() now supports transparency. 2015-11-29 20:28:18 -06:00
Marina Glancy
58e5ab1bac MDL-51985 files: sync timemodified when possible 2015-10-30 14:46:09 +08:00
Andrew Nicols
2b53b13ff7 MDL-49627 core: Update uses of generate_image_thumbnail
This removes the need to write tempfiles in these locations.
2015-04-01 11:05:19 +08:00
David Monllao
47d333857d Merge branch 'MDL-23296-master' of git://github.com/FMCorz/moodle 2015-04-01 10:41:41 +08:00
Dan Poltawski
6cb65683d1 Merge branch 'MDL-49598-master' of git://github.com/andrewnicols/moodle 2015-03-31 14:21:37 +01:00
Jordi Pujol Ahulló
d5f596589b MDL-49641 repository_dropbox: preventing poor performance.
emptied sort default value at get_external_files to prevent poor performance.
2015-03-25 08:00:27 +01:00
Andrew Nicols
5d70615157 MDL-49598 files: getimagesize -> getimagesizefromstring 2015-03-20 10:16:36 +08:00