Code Duplication    Length = 17-19 lines in 2 locations

main/coursecopy/classes/CourseRestorer.class.php 2 locations

@@ 1294-1310 (lines=17) @@
1291
1292
                $id = Database::insert($link_table, $params);
1293
1294
                if ($id) {
1295
                    $sql = "UPDATE $link_table SET id = iid WHERE iid = $id";
1296
                    Database::query($sql);
1297
1298
                    api_item_property_update(
1299
                        $this->destination_course_info,
1300
                        TOOL_LINK,
1301
                        $id,
1302
                        'LinkAdded',
1303
                        api_get_user_id()
1304
                    );
1305
1306
                    if (!isset($this->course->resources[RESOURCE_LINK][$id])) {
1307
                        $this->course->resources[RESOURCE_LINK][$id] = new stdClass();
1308
                    }
1309
                    $this->course->resources[RESOURCE_LINK][$id]->destination_id = $id;
1310
                }
1311
			}
1312
		}
1313
	}
@@ 2867-2885 (lines=19) @@
2864
                $params['name'] = self::DBUTF8($glossary->name);
2865
2866
                $my_id = Database::insert($table_glossary, $params);
2867
                if ($my_id) {
2868
2869
                    $sql = "UPDATE $table_glossary SET glossary_id = iid WHERE iid = $my_id";
2870
                    Database::query($sql);
2871
2872
                    api_item_property_update(
2873
                        $this->destination_course_info,
2874
                        TOOL_GLOSSARY,
2875
                        $my_id,
2876
                        "GlossaryAdded",
2877
                        api_get_user_id()
2878
                    );
2879
2880
                    if (!isset($this->course->resources[RESOURCE_GLOSSARY][$id])) {
2881
                        $this->course->resources[RESOURCE_GLOSSARY][$id] = new stdClass();
2882
                    }
2883
2884
                    $this->course->resources[RESOURCE_GLOSSARY][$id]->destination_id = $my_id;
2885
                }
2886
			}
2887
		}
2888
	}