Code Duplication    Length = 17-19 lines in 2 locations

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

@@ 1298-1314 (lines=17) @@
1295
1296
                $id = Database::insert($link_table, $params);
1297
1298
                if ($id) {
1299
                    $sql = "UPDATE $link_table SET id = iid WHERE iid = $id";
1300
                    Database::query($sql);
1301
1302
                    api_item_property_update(
1303
                        $this->destination_course_info,
1304
                        TOOL_LINK,
1305
                        $id,
1306
                        'LinkAdded',
1307
                        api_get_user_id()
1308
                    );
1309
1310
                    if (!isset($this->course->resources[RESOURCE_LINK][$id])) {
1311
                        $this->course->resources[RESOURCE_LINK][$id] = new stdClass();
1312
                    }
1313
                    $this->course->resources[RESOURCE_LINK][$id]->destination_id = $id;
1314
                }
1315
			}
1316
		}
1317
	}
@@ 2934-2952 (lines=19) @@
2931
                $params['name'] = self::DBUTF8($glossary->name);
2932
2933
                $my_id = Database::insert($table_glossary, $params);
2934
                if ($my_id) {
2935
2936
                    $sql = "UPDATE $table_glossary SET glossary_id = iid WHERE iid = $my_id";
2937
                    Database::query($sql);
2938
2939
                    api_item_property_update(
2940
                        $this->destination_course_info,
2941
                        TOOL_GLOSSARY,
2942
                        $my_id,
2943
                        "GlossaryAdded",
2944
                        api_get_user_id()
2945
                    );
2946
2947
                    if (!isset($this->course->resources[RESOURCE_GLOSSARY][$id])) {
2948
                        $this->course->resources[RESOURCE_GLOSSARY][$id] = new stdClass();
2949
                    }
2950
2951
                    $this->course->resources[RESOURCE_GLOSSARY][$id]->destination_id = $my_id;
2952
                }
2953
			}
2954
		}
2955
	}