File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ class restore_format_ucl_plugin extends \restore_format_plugin {
3030 * Returns the paths to be handled by the plugin at course level
3131 */
3232 protected function define_course_plugin_structure (): array {
33- $ paths = [];
3433 $ paths [] = new restore_path_element (
3534 'customcontact ' ,
3635 $ this ->get_pathfor ('/customcontacts/customcontact ' )
@@ -48,14 +47,13 @@ protected function define_course_plugin_structure(): array {
4847 public function process_customcontact ($ data ): void {
4948 global $ DB ;
5049
51- $ data = (object )$ data ;
5250 /* We only process this information if the course we are restoring to
53- has 'ucl' format (target format can change depending of restore options). */
54- $ format = $ DB ->get_field ('course ' , 'format ' , ['id ' => $ this ->task ->get_courseid ()]);
55- if ($ format != 'ucl ' ) {
56- return ;
51+ has 'ucl' format (target format can change depending on restore options). */
52+ if ($ DB ->get_field ('course ' , 'format ' , ['id ' => $ this ->task ->get_courseid ()]) != 'ucl ' ) {
53+ return ;
5754 }
5855
56+ $ data = (object )$ data ;
5957 $ oldid = $ data ->id ;
6058 $ data ->courseid = $ this ->task ->get_courseid ();
6159 unset($ data ->id );
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ Feature: Custom contacts are backed up and restored
66
77 Background :
88 Given the following "courses" exist:
9- | fullname | shortname | format | coursedisplay | numsections | startdate |
10- | Course 1 | C1 | ucl | 0 | 5 | ## yesterday ## |
9+ | fullname | shortname | format | coursedisplay | numsections |
10+ | Course 1 | C1 | ucl | 0 | 5 |
1111 And the following "users" exist:
1212 | username | firstname | lastname | email |
1313 | teacher1 | Teacher | 1 | teacher1 @example .com |
@@ -24,7 +24,7 @@ Feature: Custom contacts are backed up and restored
2424 And I set the following fields to these values:
2525 | Role | Ring Master |
2626 | Name | Jack Tucker |
27- | Email | zzucker @stamptown .com |
27+ | Email | zzucker @example .com |
2828 | Description | Clown king |
2929 And I press "Save"
3030
@@ -39,5 +39,5 @@ Feature: Custom contacts are backed up and restored
3939 And I click on "Course contacts" "link"
4040 Then I should see "Ring Master"
4141 And I should see "Jack Tucker"
42- And I should see "zzucker@stamptown .com"
42+ And I should see "zzucker@example .com"
4343 And I should see "Clown king"
You can’t perform that action at this time.
0 commit comments