From d400c9a0ec2a3810b9f8655ca13fb4e0b5a08c84 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Sun, 4 Mar 2007 16:36:33 +0100 Subject: [PATCH] [svn r11380] Fixed bug when path is used as an internal item ID --- .../classes/CourseRestorer.class.php | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/main/coursecopy/classes/CourseRestorer.class.php b/main/coursecopy/classes/CourseRestorer.class.php index 11f42f3c2d..dd3834b932 100644 --- a/main/coursecopy/classes/CourseRestorer.class.php +++ b/main/coursecopy/classes/CourseRestorer.class.php @@ -1,7 +1,7 @@ comment)."', title = '".Database::escape_string($document->title)."' ,filetype='".$document->file_type."', size= '".$document->size."'"; api_sql_query($sql, __FILE__, __LINE__); $this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = Database::get_last_insert_id(); + //also insert into item_property + /* + api_item_property_update( + array('dbName'=>$this->course->destination_db, + TOOL_DOCUMENT, + $this->course->resource[RESOURCE_DOCUMENT][$id]->destination_id, + 'DocumentAdded', + ); + */ break; } // end switch } // end if file exists @@ -672,13 +681,20 @@ class CourseRestorer if(!empty($item['ref'])){ $ref = $this->get_new_id($item['item_type'],$item['ref']); } + //Dealing with path the same way as ref as some data has been put into path when it's a + //local resource + $path = Database::escape_string($item['path']); + if(strval(intval($path)) === $path) + { + $path = $this->get_new_id($item['item_type'],$path); + } $sql = "INSERT INTO ".$table_item." SET " . "lp_id = '".$new_lp_id."', " . "item_type='".$item['item_type']."', " . "ref = '".$ref."', " . "title = '".Database::escape_string($item['title'])."', " . "description ='".Database::escape_string($item['description'])."', " . - "path = '".Database::escape_string($item['path'])."', " . + "path = '".$path."', " . "min_score = '".$item['min_score']."', " . "max_score = '".$item['max_score']."', " . "mastery_score = '".$item['mastery_score']."', " .