1587 Commits

Author SHA1 Message Date
David Mudrak
d73c82e791 MDL-22414 Getting rid of a relict method copied from restore subsystem 2011-06-04 11:46:31 +02:00
David Mudrak
a78b139ce6 Merge branch 'master' into backup-convert 2011-06-03 23:22:23 +02:00
David Mudrak
c15649fbd2 MDL-27626 random question conversion support 2011-06-03 22:59:13 +02:00
David Mudrak
0e3a69b0e5 MDL-22414 Provided a work around MDL-27713
Currently the underlying backup/restore code does not differentiate null
and empty array data. So we have to explicitly check that we got array,
even though the correct set_stash() was called.
2011-06-03 22:45:46 +02:00
David Mudrak
c0e3796e1b MDL-27626 calculated qtype conversion support
uff...
2011-06-03 21:57:00 +02:00
David Mudrak
aaf88d2cb2 MDL-27626 numerical_options are written only if there are some numerical_units available
This reflects the logic of the backup 2.0. Previously, the new
numerical_options structure was written always, even if there were no
numerical_units.
2011-06-03 21:56:59 +02:00
David Mudrak
23007e5d27 MDL-22414 Fixed wrong usage of static caches
These static caches were bad idea of mine. Multiple conversion jobs
executed from a single PHP script share such variables, of course, which
is wrong. This patch removes one static cache completely and
reimplements the other two static caches as normal member variables.
2011-06-03 21:54:13 +02:00
David Mudrak
38bce21a9e MDL-22414 Fixed the id generation entropy 2011-06-03 18:54:57 +02:00
David Mudrak
cd92d83bf2 MDL-22414 Added new method to get the list of existing stashes 2011-06-03 18:54:57 +02:00
David Mudrak
f75ad8d776 MDL-27626 moodle1_qtype_handler now provides helper methods for numerical_units and numerical_options 2011-06-03 18:54:56 +02:00
David Mudrak
1056c9b914 MDL-22414 Fixed moodle1_xml_handler::write_xml() attributes handling
The attributes did not work for nested elements because of the missing
slash.
2011-06-03 18:54:51 +02:00
David Mudrak
513e2215c6 MDL-27626 The test file with questions now contains numerical units in numerical qtype 2011-06-03 18:06:35 +02:00
David Mudrak
22b8486fe6 MDL-27626 moodle1_qtype_handler now provides a helper method for answers structure conversion 2011-06-03 18:06:27 +02:00
David Mudrak
1ff4b8dec0 MDL-27626 moodle1_qtype_handler::process_question() is not supposed to return anything
Returning the converted array has no benefit here and makes the things
more complicated. From now on, the method is supposed to write what it
needs directly into the opened file, without returning anything.
2011-06-03 18:06:27 +02:00
David Mudrak
e19d0c109c MDL-27626 The initial support for the question bank backups conversion
This patch introduces a framework for the question bank conversion. It
deals with the common question data (that are not qtype-specific) and
the way how to make sure that the qtype plugins have access to the paths
they are interested in.
2011-06-03 18:06:27 +02:00
David Mudrak
78d22af957 Fixed error/required_not_stashed_data when the backup does not contain course_files 2011-06-02 09:05:59 +02:00
David Mudrak
034b0e4a30 Fixed applying convert_path recipes on sub-paths of grouped elements
Grouped elements contain arrays with the sub-paths. This patch makes
sure that the sub-paths are pre-cooked recursively. However because the
recipes do not distinguish the full path to the element, only the
implicit recipe (making the tags lowecase) is applied. To avoid
potential data loss (for example dropfields recipe would delete all
fields from the whole grouped tree, not only the direct descendants of
the path where the recipe is declared), explicit recipes are forbidden
for grouped elements. The developer has to convert the $data manually as
needed.
2011-06-02 03:26:52 +02:00
David Mudrak
93264625f2 The source passed to the migrate_directory() may not exist
In case the source $rootpath passed to the migrate_directory() does not
exist, an empty array is returned by the method. Note that if the
directory exists and is empty, the directory itself is converter so
there would be a new record created. However, the restore process
ignores these records anyway, as the directory records are created
automatically by certain file api methods.
2011-05-29 00:38:23 +02:00
David Mudrak
214c492447 Converter file manager's methods take relative path within the backup instead of the absolute path 2011-05-29 00:18:19 +02:00
David Mudrak
66f79e50a3 Files conversion support improved
The new file manager class is introduced. Once its public properties are
set, one can use it to migrate either a single file or a whole
directory. The course_files conversion reworked so that it uses the new
manager now. The files.xml written at the very end of the conversion,
giving all handlers a chance to migrate the files they need.
2011-05-27 04:13:34 +02:00
David Mudrak
f6f7a7266c Merge branch 'master' into backup-convert
Conflicts:
	backup/util/xml/parser/processors/simplified_parser_processor.class.php
	backup/util/xml/parser/simpletest/testparser.php
2011-05-26 17:30:27 +02:00
David Mudrak
6cfa5a3220 Added support for the on_xxx_start() event handler for MOD and BLOCK sub-paths 2011-05-26 16:59:59 +02:00
David Mudrak
4ddf9ac6b5 Added base class for the activity module subplugins 2011-05-26 16:59:51 +02:00
Eloy Lafuente (stronk7)
c44299c172 MDL-27636 restore - add support for after_restore() to plugins. Credit goes to Mark Nielsen. Thanks! 2011-05-26 02:37:16 +02:00
Eloy Lafuente (stronk7)
28e2b08582 Merge branch 'MDL-27594' of git://github.com/stronk7/moodle 2011-05-25 10:16:10 +02:00
David Mudrak
2fe7d14a04 The generation of module.xml and friends moved to a later phase
This is needed to give the modules a chance to actually rewrite course
modules related information. Resource module needs this so it is able to
split its own information into its successors (url, folder, page etc).
2011-05-24 16:01:04 +02:00
David Mudrak
8bcefb3254 Activity module handler get_moduleid() replaced with get_cminfo() 2011-05-24 16:01:00 +02:00
David Mudrak
6357693c8b Extended debugging information thrown by an exception 2011-05-24 16:00:55 +02:00
Eloy Lafuente (stronk7)
d4dd06591b MDL-27594 backup - out unused (and incorrect) condition + stronger tests 2011-05-24 11:55:39 +02:00
Eloy Lafuente (stronk7)
eb78f0632d MDL-27594 backup - fix start/end notifications on empty chunks 2011-05-24 11:01:00 +02:00
Eloy Lafuente (stronk7)
7a01a2d0ca Merge branch 'MDL-27532-master' of git://github.com/sammarshallou/moodle 2011-05-23 10:29:33 +02:00
Eloy Lafuente (stronk7)
54b8f33421 MDL-27594 backup - fix start/end notifications on empty chunks 2011-05-23 00:58:45 +02:00
David Mudrak
8312ab674a Course files conversion 2011-05-20 11:59:41 +02:00
David Mudrak
f3b0b1e552 The write_xml() does not put 'id' into attributes implicitly
In some situations - like in inforef.xml - we need id to be proper
nested citizen.
2011-05-20 11:29:00 +02:00
David Mudrak
716a9616e3 The handlers now throw moodle1_convert_exception instead of convert_exception 2011-05-20 10:19:28 +02:00
David Mudrak
26cac34a6c Improved get_contextid()
For system and course levels, we do not need itemid as we work with
single system context and single course context only. Thanks to this, we
can generate contextid for the restored course even we do not know its
original id yet.
2011-05-20 10:19:28 +02:00
David Mudrak
6700d288b3 New get_nextid() method
This is useful for generating artificial database records ids.
2011-05-20 10:19:27 +02:00
David Mudrak
dbf6843a72 Include a course file in the unit test 2011-05-20 10:19:27 +02:00
David Mudrak
6d73f18573 New method get_stash_itemids()
This will be useful to build inforef.xml files.
2011-05-20 10:19:22 +02:00
David Mudrak
01b922fe70 Trivial improvement of member variables doc 2011-05-20 09:39:22 +02:00
David Mudrak
2304cbaacd Do not try to convert activity modules that do not have the converter implemented yet
This checks for the presence of moodle1 library in the module directory.
If there is no such file, the converter does not include the module in
the list of included modules.

Note that some files (like module.xml) are created for such skipped
modules anyway. But restore process seems to use the information from
moodle_backup.xml so it does not try to restore them.
2011-05-19 14:25:37 +02:00
David Mudrak
317f1c6f61 Generate fake XML files to make the restore process happy
With these changes I was able to restore the very first 1.9 course
containing a forum and a choice.
2011-05-19 13:56:43 +02:00
David Mudrak
46ff8b0ecf The handler's process_xxx() method is not mandatory any more
It was realized that it is pretty common to register a convert_path just
to be able to attach on-start or on-end listeners to it, without actual
processing data. So now, the handler must provide at least one of these
three methods and the process_xxx() does not need to be there if it is
not needed.
2011-05-19 03:17:18 +02:00
David Mudrak
ae80f68f31 Improvements in moodle1_xml_handler external API
The methods are protected now as they are supposed to be used by
subclasses only. Added a new method to check if the output writer has
been opened.
2011-05-18 16:32:51 +02:00
David Mudrak
c18f90f22f Merge remote branch 'github/master' into backup-convert 2011-05-18 16:08:15 +02:00
sam marshall
5e0dae125d MDL-27532 Add backup support for course report per-course data 2011-05-18 14:56:11 +01:00
David Mudrak
c171d28ebc The basic wrapper for question categories conversion
The QUESTION_CATEGORIES tag is optional in moodle.xml but the file
questions.xml is required by the moodle2 restore process. So here we
make sure that at least an empty file is created.
2011-05-18 14:33:05 +02:00
David Mudrak
ba66847b71 Roles definition conversion 2011-05-18 14:12:52 +02:00
David Mudrak
96f7c7ad72 Implemented new XML transformer for the files being written during the conversion 2011-05-18 14:10:04 +02:00
David Mudrak
71d1751c53 Improved the information display about a non-standard backup file 2011-05-18 12:19:57 +02:00