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
	}
@@ 2868-2886 (lines=19) @@
2865
                $params['name'] = self::DBUTF8($glossary->name);
2866
2867
                $my_id = Database::insert($table_glossary, $params);
2868
                if ($my_id) {
2869
2870
                    $sql = "UPDATE $table_glossary SET glossary_id = iid WHERE iid = $my_id";
2871
                    Database::query($sql);
2872
2873
                    api_item_property_update(
2874
                        $this->destination_course_info,
2875
                        TOOL_GLOSSARY,
2876
                        $my_id,
2877
                        "GlossaryAdded",
2878
                        api_get_user_id()
2879
                    );
2880
2881
                    if (!isset($this->course->resources[RESOURCE_GLOSSARY][$id])) {
2882
                        $this->course->resources[RESOURCE_GLOSSARY][$id] = new stdClass();
2883
                    }
2884
2885
                    $this->course->resources[RESOURCE_GLOSSARY][$id]->destination_id = $my_id;
2886
                }
2887
			}
2888
		}
2889
	}