86 Commits

Author SHA1 Message Date
Sam Hemelryk
f18f96f767 Merge branch 'wip-MDL-42016-master' of git://github.com/marinaglancy/moodle
Conflicts:
	lib/db/install.xml
	lib/db/upgrade.php
	version.php
2013-10-09 15:58:45 +13:00
Sam Hemelryk
5dc361e16e MDL-31830 core_course: new course category management interface
* Implemented a new course and category management page.
* Deprecated the old management interface.
* Unit tests to cover the new API and core functions.
* Behat tests to cover the new interface.
2013-10-07 10:21:41 +13:00
Marina Glancy
873555604f MDL-42016 repository: Simplify API to sync external files
Too many functions, too different parameters, unnecessary DB queries.
All repositories developed for Moodle 2.3-2.5 will continue to work.

Also get rid of DB field files_reference.lifetime, it is not used by
anybody except repository itself.
2013-10-06 18:05:09 +11:00
Marina Glancy
e2a61ee3db MDL-33416 files: Remove unused reference fields in files table
Fields files.referencelastsync and files.referencelifetime just waste the space and actually duplicate the fields
files_reference.lifetime and files_reference.lastsync
2013-09-27 16:50:08 +10:00
Petr Škoda
96f81ea385 MDL-39474 introduce $CFG->debugdeveloper and cleanup $CFG init 2013-08-12 13:01:47 +02:00
Sam Hemelryk
823c0c80e9 Merge branch 'MDL-40086-master' of git://github.com/FMCorz/moodle
Conflicts:
	lib/filestorage/file_storage.php
2013-08-07 10:39:40 +12:00
Petr Škoda
2f1e464a88 MDL-40438 migrate all collatorlib:: and textlib:: uses 2013-08-06 21:04:35 +02:00
Frederic Massart
bc42e97989 MDL-40086 file: Correct ordering of subdirectories
Thanks to Mohamed Alsharaf for the proposed solution.
2013-08-06 13:53:54 +08:00
Petr Škoda
eb459f7192 MDL-40642 set more restrictive umask and use proper permission for new dirs and files 2013-07-19 09:18:44 +02:00
Marina Glancy
da4b1ee480 MDL-39177 New function file_storage::get_unused_dirname() 2013-05-17 13:43:45 +10:00
Damyon Wiese
946f2b0826 MDL-36959 file_storage: Preserve each file in a hash collision 2013-04-22 12:07:43 +08:00
Petr Škoda
d91e2c15db MDL-36959 rework adding of content files to the file pool
This patch includes refreshing of borked files in file pool and basic prevention of race conditions. It also helps with diagnosing of file pool permission problems, detects coding errors and some other type of problems including sha1 collision jackpot.
2013-04-20 21:41:41 +02:00
David Mudrák
bfaed43214 MDL-39087 Fix missing cronlib inclusion in file_storage::cron()
This is not actually related to MDL-38259 but it was discovered while
running unit tests for file_storage. When running the tests for this
class separately, the cronlib.php was not included (it is included
when this method is normally called during cron execution).
2013-04-12 01:42:58 +02:00
David Mudrák
546b886416 MDL-39087 Delete all component files in uninstall_plugin() 2013-04-12 01:42:58 +02:00
Tim Hunt
658b9372ee MDL-38212 cron: display time and memory usage before each task.
This helps diagnose problems.

Also, call gc_collect_cycles between tasks, which may reduce the
frequency of out-of-memory errors.
2013-03-08 10:24:41 +00:00
David Mudrák
8f5cbbd6c8 MDL-38261 Add a new file preview mode for bigger thumbnails 2013-02-28 18:53:37 +01:00
Dan Poltawski
d28d214167 Merge branch 'w08_MDL-38154_m25_delperf' of git://github.com/skodak/moodle 2013-02-26 11:08:52 +08:00
Petr Škoda
18fa4f4745 MDL-38154 do not hardcode sha1 hash of empty string 2013-02-25 10:10:57 +01:00
Damyon Wiese
61725199a9 Merge branch 'MDL-37641-master' of git://github.com/FMCorz/moodle 2013-02-25 15:23:19 +08:00
Petr Škoda
e029dff4cd MDL-38154 improve dir delete performance 2013-02-23 15:10:48 +01:00
Marina Glancy
898d4975cb MDL-38091 fixed bug with SQL query on Oracle 2013-02-23 12:06:21 +11:00
Frederic Massart
d7d69396b0 MDL-37641 files: Improve file name suggestion and performance 2013-02-20 08:50:40 +08:00
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