34 Commits

Author SHA1 Message Date
sam marshall
c858655dde MDL-41838 Files: Implement .tar.gz packer (1 of 2)
A new packer for .tar.gz files (MIME type application/x-gzip) has been
implemented, including unit tests.

This packer is intended for use during backup/restore only and is not
otherwise exposed in the user interface at present. However, it is
supposed to follow the (ancient) POSIX .tar standard; files created
with this packer will open in GNU tar.

There are restrictions in support corresponding to the POSIX standard:

- Non-ASCII filenames are not supported.
- Very long file/path names are not supported.
- Individual files within the .tar may not be more than 8GB.

Some of these limitations might need to be addressed in future changes
if the packer were to be used in areas other than backup/restore.
2013-10-08 13:04:48 +01:00
Petr Škoda
a9d2f1b414 MDL-41707 allow custom location of external test files used from unit tests 2013-09-27 10:47:56 +02:00
sam marshall
771e3f7cab MDL-41839 Files: Zip packer progress minor bugs
The progress variable wasn't always passed to recursive calls. This
caused a lack of progress() calls between files in subfolders. I
added a unit test for this situation.
2013-09-17 14:19:07 +01:00
sam marshall
71ab7e512b MDL-41151 Files: Zip packer should have way to indicate progress 2013-09-05 16:41:57 +01:00
Petr Škoda
5f15f7c9aa MDL-41022 cleanup core_files_zip_packer_testcase 2013-08-24 16:18:18 +02:00
Petr Škoda
4c34571b76 MDL-41022 cleanup core_files_file_storage_testcase 2013-08-24 16:18:18 +02:00
Petr Škoda
8252b7c291 MDL-40901 standardise core test case class and file names
This finally allows us to type only the class name when executing individual core test cases.
2013-08-04 22:10:31 +02:00
Paul Nicholls
81d9f3d536 MDL-39339 - Add test zips for OSX system files and Thumbs.db 2013-05-30 09:22:56 +12:00
Petr Škoda
fd4592bbbc MDL-36959 test reworked adding of files to sha1 content pool 2013-04-20 21:59:08 +02:00
David Mudrák
546b886416 MDL-39087 Delete all component files in uninstall_plugin() 2013-04-12 01:42:58 +02:00
Petr Škoda
689096bc26 MDL-38654 do not test $CFG->gdversion
GD PHP extension is now required. Add-ons need to remove $CFG->gdversion tests. The worst case regression is that add-on will think GD is not available.
2013-03-22 16:57:55 +01:00
Frederic Massart
3385a89c38 MDL-37641 files: Tests for draftfile_exists and get_unused_filename 2013-02-20 08:50:43 +08:00
Petr Škoda
96846ef18b MDL-37640 close all zip archives after use in unit tests 2013-01-25 12:46:58 +01:00
Petr Škoda
01b4040a27 MDL-37429 zipping improvements
Changes:
* zip_packer can create empty zip archives
* new option to ignore problematic files when creating archive
* detection of non-existent files
* debugging messages for opening of faulty zip archives
* coding style improvements
* no PHP 5.2 hacks
* more unit tests
2013-01-12 14:58:26 +01:00
Frederic Massart
1017426c26 MDL-32639 phpunit: Hack not to fail on debugging 2013-01-09 11:48:44 +08:00
Petr Škoda
65598feb36 MDL-36447 skip file preview test if GD not available 2012-12-09 19:22:01 +01:00
Frederic Massart
e462f46b77 MDL-35117 librairies: File Packer can only extract a specific list a files 2012-10-18 13:38:48 +08:00
Petr Škoda
060bb94d81 MDL-35479 fix zip packer tests to use debugging asserts 2012-09-17 12:00:02 +02:00
Petr Škoda
f6b49abf9b MDL-17830 fix zip_packer return status add debugging for invalid files and dirs 2012-07-29 16:09:18 +02:00
Petr Skoda
6fb8ae95f5 MDL-33753 support utf-8 filename unzipping 2012-07-06 08:03:38 +02:00
Petr Skoda
79c966cf21 MDL-33710, MDL-33710 add utf-8 flag to all zip files created in moodle and unzip from storage fix 2012-07-06 08:02:42 +02: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
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
David Mudrak
2d2c194bbe MDL-33587 Add unit tests for stored_file::delete_reference()
The first unit test forces the File API to be more picky as any sane
core API should be. The second one illustrates the buggy behaviour of
the current implementation of delete_reference(). They both fail at the
moment, of course...
2012-06-07 17:36:23 +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
Eloy Lafuente (stronk7)
294d976e28 MDL-33326 filestorage tests: Coding style fixes 2012-05-30 02:26:57 +02:00
Dan Poltawski
996f8b6442 MDL-33326 filestorage tests: Add more coverage 2012-05-30 02:26:46 +02:00
Dan Poltawski
7c89a18fca MDL-33326 filestorage tests: Actually verify results
Rather than the placeholder tests which were added before to trigger
DB incompatibilities
2012-05-30 02:26:36 +02:00
Dan Poltawski
ac29403e39 MDL-33172 - filestorage: Add unit test for breaking oracle functions 2012-05-25 11:17:56 +12:00
Dongsheng Cai
291a3d1fb6 MDL-33149 stored_file::repository should be private 2012-05-22 15:00:49 +08:00
Dongsheng Cai
61506a0af9 MDL-33032 Fixed issues for file integration
1. Added tracker issue number in comment
2. Fixed stored_file::delete_reference()
3. repository::send_file() will throw exception if not implemented by subclass
4. Fixed renaming unit test, added one unit test for deleting original file
5. Fixed copyright statement for googledoc and picasa repository plugin
6. Implemented stored_file::set_filesize()
2012-05-21 11:57:56 +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
David Mudrak
8f110835c1 MDL-32471 adding preview generation unit tests
The test image is a public domain file from
http://commons.wikimedia.org/wiki/File:Easter_eggs_-_onion_decoration.jpg
2012-04-25 11:42:17 +02:00