2 //This php script contains all the stuff to backup/restore data mod
4 //This is the "graphical" structure of the data mod:
11 // ---------------------------------------------------------------------------------
13 //data_records (UL,pk->id, fk->data) data_fields (pk->id, fk->data)
16 // ----------------------------------------------------------------------------- |
18 //data_ratings(fk->recordid, pk->id) data_comments (fk->recordid, pk->id) | |
19 // data_content(pk->id, fk->recordid, fk->fieldid)
23 // Meaning: pk->primary key field of the table
24 // fk->foreign key to link with parent
25 // nt->nested field (recursive data)
26 // CL->course level info
27 // UL->user level info
28 // files->table may have files)
30 //-----------------------------------------------------------
32 //Backup data files because we've selected to backup user info
33 //and files are user info's level
35 $fieldids = array(); //array in the format of $fieldids[$oldid]=$newid. This is needed because of double dependencies of multiple tables.
38 //Return a content encoded to support interactivities linking. Every module
39 function data_restore_mods($mod,$restore) {
45 $data = backup_getid($restore->backup_unique_code
,$mod->modtype
,$mod->id
);
48 //Now get completed xmlized object
50 // if necessary, write to restorelog and adjust date/time fields
51 if ($restore->course_startdateoffset
) {
52 restore_log_date_changes('Database', $restore, $info['MOD']['#'], array('TIMEAVAILABLEFROM', 'TIMEAVAILABLETO','TIMEVIEWFROM', 'TIMEVIEWTO'));
54 //traverse_xmlize($info); //Debug
55 //print_object ($GLOBALS['traverse_array']); //Debug
56 //$GLOBALS['traverse_array']=""; //Debug
58 $database->course
= $restore->course_id
;
60 $database->name
= backup_todb($info['MOD']['#']['NAME']['0']['#']);
61 $database->intro
= backup_todb($info['MOD']['#']['INTRO']['0']['#']);
62 // Only relevant for restoring backups from 1.6 in a 1.7 install.
63 if (isset($info['MOD']['#']['RATINGS']['0']['#'])) {
64 $database->ratings
= backup_todb($info['MOD']['#']['RATINGS']['0']['#']);
66 $database->comments
= backup_todb($info['MOD']['#']['COMMENTS']['0']['#']);
67 $database->timeavailablefrom
= backup_todb($info['MOD']['#']['TIMEAVAILABLEFROM']['0']['#']);
68 $database->timeavailableto
= backup_todb($info['MOD']['#']['TIMEAVAILABLETO']['0']['#']);
69 $database->timeviewfrom
= backup_todb($info['MOD']['#']['TIMEVIEWFROM']['0']['#']);
70 $database->timeviewto
= backup_todb($info['MOD']['#']['TIMEVIEWTO']['0']['#']);
71 // Only relevant for restoring backups from 1.6 in a 1.7 install.
72 if (isset($info['MOD']['#']['PARTICIPANTS']['0']['#'])) {
73 $database->participants
= backup_todb($info['MOD']['#']['PARTICIPANTS']['0']['#']);
75 $database->requiredentries
= backup_todb($info['MOD']['#']['REQUIREDENTRIES']['0']['#']);
76 $database->requiredentriestoview
= backup_todb($info['MOD']['#']['REQUIREDENTRIESTOVIEW']['0']['#']);
77 $database->maxentries
= backup_todb($info['MOD']['#']['MAXENTRIES']['0']['#']);
78 $database->rssarticles
= backup_todb($info['MOD']['#']['RSSARTICLES']['0']['#']);
79 $database->singletemplate
= backup_todb($info['MOD']['#']['SINGLETEMPLATE']['0']['#']);
80 $database->listtemplate
= backup_todb($info['MOD']['#']['LISTTEMPLATE']['0']['#']);
81 $database->listtemplateheader
= backup_todb($info['MOD']['#']['LISTTEMPLATEHEADER']['0']['#']);
82 $database->listtemplatefooter
= backup_todb($info['MOD']['#']['LISTTEMPLATEFOOTER']['0']['#']);
83 $database->addtemplate
= backup_todb($info['MOD']['#']['ADDTEMPLATE']['0']['#']);
84 $database->rsstemplate
= backup_todb($info['MOD']['#']['RSSTEMPLATE']['0']['#']);
85 $database->rsstitletemplate
= backup_todb($info['MOD']['#']['RSSTITLETEMPLATE']['0']['#']);
86 $database->csstemplate
= backup_todb($info['MOD']['#']['CSSTEMPLATE']['0']['#']);
87 $database->jstemplate
= backup_todb($info['MOD']['#']['JSTEMPLATE']['0']['#']);
88 $database->approval
= backup_todb($info['MOD']['#']['APPROVAL']['0']['#']);
89 $database->scale
= backup_todb($info['MOD']['#']['SCALE']['0']['#']);
90 $database->assessed
= backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);
91 // Only relevant for restoring backups from 1.6 in a 1.7 install.
92 if (isset($info['MOD']['#']['ASSESSPUBLIC']['0']['#'])) {
93 $database->assesspublic
= backup_todb($info['MOD']['#']['ASSESSPUBLIC']['0']['#']);
95 $database->defaultsort
= backup_todb($info['MOD']['#']['DEFAULTSORT']['0']['#']);
96 $database->defaultsortdir
= backup_todb($info['MOD']['#']['DEFAULTSORTDIR']['0']['#']);
97 $database->editany
= backup_todb($info['MOD']['#']['EDITANY']['0']['#']);
98 $database->notification
= backup_todb($info['MOD']['#']['NOTIFICATION']['0']['#']);
100 $newid = insert_record ('data', $database);
103 if (!defined('RESTORE_SILENTLY')) {
104 echo "<li>".get_string("modulename","data")." \"".format_string(stripslashes($database->name
),true)."\"</li>";
108 //We have the newid, update backup_ids
109 backup_putid($restore->backup_unique_code
,$mod->modtype
,
111 //Now check if want to restore user data and do it.
112 if (function_exists('restore_userdata_selected')) {
114 $restore_userdata_selected = restore_userdata_selected($restore, 'data', $mod->id
);
117 $restore_userdata_selected = $restore->mods
['data']->userinfo
;
120 //Restore data_fields first!!! need to hold an array of [oldid]=>newid due to double dependencies
121 $status = $status and data_fields_restore_mods ($mod->id
, $newid, $info, $restore);
123 if ($restore_userdata_selected) {
124 $status = $status and data_records_restore_mods ($mod->id
, $newid, $info, $restore);
127 // If the backup contained $data->participants, $data->assesspublic
128 // and $data->groupmode, we need to convert the data to use Roles.
129 // It means the backup was made pre Moodle 1.7. We check the
130 // backup_version to make sure.
131 if (isset($database->participants
) && isset($database->assesspublic
)) {
133 if (!$teacherroles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW
)) {
134 notice('Default teacher role was not found. Roles and permissions '.
135 'for your database modules will have to be manually set.');
137 if (!$studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW
)) {
138 notice('Default student role was not found. Roles and permissions '.
139 'for all your database modules will have to be manually set.');
141 if (!$guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW
)) {
142 notice('Default guest role was not found. Roles and permissions '.
143 'for all your database modules will have to be manually set.');
145 require_once($CFG->dirroot
.'/mod/data/lib.php');
146 data_convert_to_roles($database, $teacherroles, $studentroles,
147 $restore->mods
['data']->instances
[$mod->id
]->restored_as_course_module
);
160 function data_fields_restore_mods ($old_data_id, $new_data_id, $info, $restore) {
162 global $CFG, $fieldids;
165 $fields = $info['MOD']['#']['FIELDS']['0']['#']['FIELD'];
167 for ($i = 0; $i < sizeof($fields); $i++
) {
169 $fie_info = $fields[$i];
170 $oldid = backup_todb($fie_info['#']['ID']['0']['#']);
172 $field -> dataid
= $new_data_id;
173 $field -> type
= backup_todb($fie_info['#']['TYPE']['0']['#']);
174 $field -> name
= backup_todb($fie_info['#']['NAME']['0']['#']);
175 $field -> description
= backup_todb($fie_info['#']['DESCRIPTION']['0']['#']);
176 $field -> param1
= backup_todb($fie_info['#']['PARAM1']['0']['#']);
177 $field -> param2
= backup_todb($fie_info['#']['PARAM2']['0']['#']);
178 $field -> param3
= backup_todb($fie_info['#']['PARAM3']['0']['#']);
179 $field -> param4
= backup_todb($fie_info['#']['PARAM4']['0']['#']);
180 $field -> param5
= backup_todb($fie_info['#']['PARAM5']['0']['#']);
181 $field -> param6
= backup_todb($fie_info['#']['PARAM6']['0']['#']);
182 $field -> param7
= backup_todb($fie_info['#']['PARAM7']['0']['#']);
183 $field -> param8
= backup_todb($fie_info['#']['PARAM8']['0']['#']);
184 $field -> param9
= backup_todb($fie_info['#']['PARAM9']['0']['#']);
185 $field -> param10
= backup_todb($fie_info['#']['PARAM10']['0']['#']);
187 $newid = insert_record ("data_fields",$field);
189 $fieldids[$oldid] = $newid; //so we can use them in sub tables that depends on both fieldid and recordid
192 if (($i+
1) %
50 == 0) {
193 if (!defined('RESTORE_SILENTLY')) {
195 if (($i+
1) %
1000 == 0) {
203 //We have the newid, update backup_ids
204 $status = backup_putid($restore->backup_unique_code
,"data_fields",$oldid, $newid);
214 function data_records_restore_mods ($old_data_id, $new_data_id, $info, $restore) {
216 global $CFG, $fieldids;
220 $records = $info['MOD']['#']['RECORDS']['0']['#']['RECORD'];
222 for ($i = 0; $i < sizeof($records); $i++
) {
224 $rec_info = $records[$i];
225 $oldid = backup_todb($rec_info['#']['ID']['0']['#']);
227 $record = new object();
228 $record -> dataid
= $new_data_id;
229 $record -> userid
= backup_todb($rec_info['#']['USERID']['0']['#']);
230 $record -> groupid
= backup_todb($rec_info['#']['GROUPID']['0']['#']);
231 $record -> timecreated
= backup_todb($rec_info['#']['TIMECREATED']['0']['#']);
232 $record -> timemodified
= backup_todb($rec_info['#']['TIMEMODIFIED']['0']['#']);
233 $record -> approved
= backup_todb($rec_info['#']['APPROVED']['0']['#']);
234 $user = backup_getid($restore->backup_unique_code
,"user",$record->userid
);
235 $group= backup_getid($restore->backup_unique_code
,"groups",$record->groupid
);
238 $record->userid
= $user->new_id
;
241 $record->groupid
= $group->new_id
;
244 $newid = insert_record ("data_records",$record);
247 if (($i+
1) %
50 == 0) {
248 if (!defined('RESTORE_SILENTLY')) {
250 if (($i+
1) %
1000 == 0) {
258 //We have the newid, update backup_ids
259 $status = $status and backup_putid($restore->backup_unique_code
,"data_records",$oldid, $newid);
261 $status = $status and data_content_restore_mods ($oldid, $newid, $old_data_id, $new_data_id, $rec_info, $restore);
262 $status = $status and data_ratings_restore_mods ($oldid, $newid, $info, $rec_info);
263 $status = $status and data_comments_restore_mods ($oldid, $newid, $info, $rec_info);
272 function data_content_restore_mods ($old_record_id, $new_record_id, $old_data_id, $new_data_id, $recinfo, $restore) {
274 global $CFG, $fieldids;
278 $contents = $recinfo['#']['CONTENTS']['0']['#']['CONTENT'];
280 for ($i = 0; $i < sizeof($contents); $i++
) {
282 $con_info = $contents[$i];
283 $oldid = backup_todb($con_info['#']['ID']['0']['#']);
284 $oldfieldid = backup_todb($con_info['#']['FIELDID']['0']['#']);
285 $oldrecordid = backup_todb($con_info['#']['RECORDID']['0']['#']);
287 $content -> recordid
= $new_record_id;
288 $content -> fieldid
= $fieldids[$oldfieldid];
289 $content -> content
= backup_todb($con_info['#']['CONTENT']['0']['#']);
290 $content -> content1
= backup_todb($con_info['#']['CONTENT1']['0']['#']);
291 $content -> content2
= backup_todb($con_info['#']['CONTENT2']['0']['#']);
292 $content -> content3
= backup_todb($con_info['#']['CONTENT3']['0']['#']);
293 $content -> content4
= backup_todb($con_info['#']['CONTENT4']['0']['#']);
294 $newid = insert_record ("data_content",$content);
297 if (($i+
1) %
50 == 0) {
298 if (!defined('RESTORE_SILENTLY')) {
300 if (($i+
1) %
1000 == 0) {
308 //We have the newid, update backup_ids
310 $status = $status and data_restore_files ($old_data_id, $new_data_id, $oldfieldid, $content->fieldid
, $oldrecordid, $content->recordid
, $recinfo, $restore);
311 $status = $status and backup_putid($restore->backup_unique_code
,"data_content",$oldid, $newid);
320 function data_restore_files ($old_data_id, $new_data_id, $old_field_id, $new_field_id, $old_record_id, $new_record_id, $recinfo, $restore) {
330 //First, we check to "course_id" exists and create is as necessary
332 $dest_dir = $CFG->dataroot
."/".$restore->course_id
;
333 $status = check_dir_exists($dest_dir,true);
335 //Now, locate course's moddata directory
336 $moddata_path = $CFG->dataroot
."/".$restore->course_id
."/".$CFG->moddata
;
338 //Check it exists and create it
339 $status = check_dir_exists($moddata_path,true);
341 //Now, locate data directory
343 $data_path = $moddata_path."/data";
344 //Check it exists and create it
345 $status = check_dir_exists($data_path,true);
348 //Now locate the temp dir we are gong to restore
350 $temp_path = $CFG->dataroot
."/temp/backup/".$restore->backup_unique_code
.
351 "/moddata/data/".$old_data_id."/".$old_field_id."/".$old_record_id;
352 $todo = check_dir_exists($temp_path);
355 //If todo, we create the neccesary dirs in course moddata/data
356 if ($status and $todo) {
358 $this_data_path = $data_path."/".$new_data_id;
360 $status = check_dir_exists($this_data_path,true);
362 $this_field_path = $this_data_path."/".$new_field_id;
363 $status = check_dir_exists($this_field_path,true);
364 $this_record_path = $this_field_path = $this_field_path."/".$new_record_id;
365 $status = check_dir_exists($this_record_path,true);
366 //And now, copy temp_path to user_data_path
368 $status = @backup_copy_file
($temp_path, $this_record_path);
374 function data_ratings_restore_mods ($oldid, $newid, $info, $rec_info) {
380 $ratings= $rec_info['#']['RATINGS']['0']['#']['RATING'];
382 if (empty($ratings)) { // no ratings to restore
385 for ($i = 0; $i < sizeof($ratings); $i++
) {
387 $rat_info = $ratings[$i];
389 $rating -> recordid
= $newid;
390 $rating -> userid
= backup_todb($rat_info['#']['USERID']['0']['#']);
391 $rating -> rating
= backup_todb($rat_info['#']['RATING']['0']['#']);
393 if (! insert_record ("data_ratings",$rating)) {
400 function data_comments_restore_mods ($oldid, $newid, $info, $rec_info) {
406 $comments= $rec_info['#']['COMMENTS']['0']['#']['COMMENT'];
408 if (empty($comments)) { // no comments to restore
412 for ($i = 0; $i < sizeof($comments); $i++
) {
414 $com_info = $comments[$i];
416 $comment -> recordid
= $newid;
417 $comment -> userid
= backup_todb($com_info['#']['USERID']['0']['#']);
418 $comment -> content
= backup_todb($com_info['#']['CONTENT']['0']['#']);
419 $comment -> created
= backup_todb($com_info['#']['CREATED']['0']['#']);
420 $comment -> modified
= backup_todb($com_info['#']['MODIFIED']['0']['#']);
421 if (! insert_record ("data_comments",$comment)) {
431 * Returns a content decoded to support interactivities linking. Every module
432 * should have its own. They are called automatically from
433 * xxxx_decode_content_links_caller() function in each module
434 * in the restore process.
436 * @param string $content the content to be decoded
437 * @param object $restore the preferences used in restore
438 * @return string the decoded string
440 function data_decode_content_links ($content,$restore) {
446 /// Link to the list of datas
448 $searchstring='/\$@(DATAINDEX)\*([0-9]+)@\$/';
450 preg_match_all($searchstring,$content,$foundset);
451 /// If found, then we are going to look for its new id (in backup tables)
453 /// print_object($foundset); //Debug
454 /// Iterate over foundset[2]. They are the old_ids
455 foreach($foundset[2] as $old_id) {
456 /// We get the needed variables here (course id)
457 $rec = backup_getid($restore->backup_unique_code
,"course",$old_id);
458 /// Personalize the searchstring
459 $searchstring='/\$@(DATAINDEX)\*('.$old_id.')@\$/';
460 /// If it is a link to this course, update the link to its new location
463 $result= preg_replace($searchstring,$CFG->wwwroot
.'/mod/data/index.php?id='.$rec->new_id
,$result);
465 /// It's a foreign link so leave it as original
466 $result= preg_replace($searchstring,$restore->original_wwwroot
.'/mod/data/index.php?id='.$old_id,$result);
471 /// Link to data view by moduleid
473 $searchstring='/\$@(DATAVIEWBYID)\*([0-9]+)@\$/';
475 preg_match_all($searchstring,$result,$foundset);
476 /// If found, then we are going to look for its new id (in backup tables)
478 /// print_object($foundset); //Debug
479 /// Iterate over foundset[2]. They are the old_ids
480 foreach($foundset[2] as $old_id) {
481 /// We get the needed variables here (course_modules id)
482 $rec = backup_getid($restore->backup_unique_code
,"course_modules",$old_id);
483 /// Personalize the searchstring
484 $searchstring='/\$@(DATAVIEWBYID)\*('.$old_id.')@\$/';
485 /// If it is a link to this course, update the link to its new location
488 $result= preg_replace($searchstring,$CFG->wwwroot
.'/mod/data/view.php?id='.$rec->new_id
,$result);
490 /// It's a foreign link so leave it as original
491 $result= preg_replace($searchstring,$restore->original_wwwroot
.'/mod/data/view.php?id='.$old_id,$result);
496 /// Link to data view by dataid
498 $searchstring='/\$@(DATAVIEWBYD)\*([0-9]+)@\$/';
500 preg_match_all($searchstring,$result,$foundset);
501 /// If found, then we are going to look for its new id (in backup tables)
503 /// print_object($foundset); //Debug
504 /// Iterate over foundset[2]. They are the old_ids
505 foreach($foundset[2] as $old_id) {
506 /// We get the needed variables here (data id)
507 $rec = backup_getid($restore->backup_unique_code
,"data",$old_id);
508 /// Personalize the searchstring
509 $searchstring='/\$@(DATAVIEWBYD)\*('.$old_id.')@\$/';
510 /// If it is a link to this course, update the link to its new location
513 $result= preg_replace($searchstring,$CFG->wwwroot
.'/mod/data/view.php?d='.$rec->new_id
,$result);
515 /// It's a foreign link so leave it as original
516 $result= preg_replace($searchstring,$restore->original_wwwroot
.'/mod/data/view.php?d='.$old_id,$result);
521 /// Link to data record (element)
523 $searchstring='/\$@(DATAVIEWRECORD)\*([0-9]+)\*([0-9]+)@\$/';
525 preg_match_all($searchstring,$result,$foundset);
526 /// If found, then we are going to look for its new id (in backup tables)
528 /// print_object($foundset); //Debug
529 /// Iterate over foundset[2] and foundset[3]. They are the old_ids
530 foreach($foundset[2] as $key => $old_id) {
531 $old_id2 = $foundset[3][$key];
532 /// We get the needed variables here (data id and record id)
533 $rec = backup_getid($restore->backup_unique_code
,"data",$old_id);
534 $rec2 = backup_getid($restore->backup_unique_code
,"data_records",$old_id2);
535 /// Personalize the searchstring
536 $searchstring='/\$@(DATAVIEWRECORD)\*('.$old_id.')\*('.$old_id2.')@\$/';
537 /// If it is a link to this course, update the link to its new location
538 if($rec->new_id
&& $rec2->new_id
) {
540 $result= preg_replace($searchstring,$CFG->wwwroot
.'/mod/data/view.php?d='.$rec->new_id
.'&rid='.$rec2->new_id
,$result);
542 /// It's a foreign link so leave it as original
543 $result= preg_replace($searchstring,$restore->original_wwwroot
.'/mod/data/view.php?d='.$old_id.'&rid='.$old_id2,$result);
552 * This function makes all the necessary calls to xxxx_decode_content_links()
553 * function in each module, passing them the desired contents to be decoded
554 * from backup format to destination site/course in order to mantain inter-activities
555 * working in the backup/restore process. It's called from restore_decode_content_links()
556 * function in restore process
558 * @param object $restore the preferences used in restore
559 * @return boolean status of the execution
561 function data_decode_content_links_caller($restore) {
566 /// Process every DATA (intro) in the course
567 if ($datas = get_records_sql ("SELECT d.id, d.intro
568 FROM {$CFG->prefix}data d
569 WHERE d.course = $restore->course_id")) {
570 /// Iterate over each data->intro
571 $i = 0; //Counter to send some output to the browser to avoid timeouts
572 foreach ($datas as $data) {
573 /// Increment counter
575 $content = $data->intro
;
576 $result = restore_decode_content_links_worker($content,$restore);
577 if ($result != $content) {
579 $data->intro
= addslashes($result);
580 $status = update_record("data",$data);
582 if (!defined('RESTORE_SILENTLY')) {
583 echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
588 if (($i+
1) %
5 == 0) {
589 if (!defined('RESTORE_SILENTLY')) {
591 if (($i+
1) %
100 == 0) {
600 /// Process every COMMENT (content) in the course
601 if ($comments = get_records_sql ("SELECT dc.id, dc.content
602 FROM {$CFG->prefix}data d,
603 {$CFG->prefix}data_records dr,
604 {$CFG->prefix}data_comments dc
605 WHERE d.course = $restore->course_id
607 AND dc.recordid = dr.id")) {
608 /// Iterate over each data_comments->content
609 $i = 0; //Counter to send some output to the browser to avoid timeouts
610 foreach ($comments as $comment) {
611 /// Increment counter
613 $content = $comment->content
;
614 $result = restore_decode_content_links_worker($content,$restore);
615 if ($result != $content) {
617 $comment->content
= addslashes($result);
618 $status = update_record("data_comments",$comment);
620 if (!defined('RESTORE_SILENTLY')) {
621 echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
626 if (($i+
1) %
5 == 0) {
627 if (!defined('RESTORE_SILENTLY')) {
629 if (($i+
1) %
100 == 0) {
638 /// Process every CONTENT (content, content1, content2, content3, content4) in the course
639 if ($contents = get_records_sql ("SELECT dc.id, dc.content, dc.content1, dc.content2, dc.content3, dc.content4
640 FROM {$CFG->prefix}data d,
641 {$CFG->prefix}data_records dr,
642 {$CFG->prefix}data_content dc
643 WHERE d.course = $restore->course_id
645 AND dc.recordid = dr.id")) {
646 /// Iterate over each data_content->content, content1, content2, content3 and content4
647 $i = 0; //Counter to send some output to the browser to avoid timeouts
648 foreach ($contents as $cnt) {
649 /// Increment counter
651 $content = $cnt->content
;
652 $content1 = $cnt->content1
;
653 $content2 = $cnt->content2
;
654 $content3 = $cnt->content3
;
655 $content4 = $cnt->content4
;
656 $result = restore_decode_content_links_worker($content,$restore);
657 $result1 = restore_decode_content_links_worker($content1,$restore);
658 $result2 = restore_decode_content_links_worker($content2,$restore);
659 $result3 = restore_decode_content_links_worker($content3,$restore);
660 $result4 = restore_decode_content_links_worker($content4,$restore);
661 if ($result != $content ||
$result1 != $content1 ||
$result2 != $content2 ||
662 $result3 != $content3 ||
$result4 != $content4) {
663 /// Unset fields to update only the necessary ones
664 unset($cnt->content
);
665 unset($cnt->content1
);
666 unset($cnt->content2
);
667 unset($cnt->content3
);
668 unset($cnt->content4
);
669 /// Conditionally set the fields
670 if ($result != $content) {
671 $cnt->content
= addslashes($result);
673 if ($result1 != $content1) {
674 $cnt->content1
= addslashes($result1);
676 if ($result2 != $content2) {
677 $cnt->content2
= addslashes($result2);
679 if ($result3 != $content3) {
680 $cnt->content3
= addslashes($result3);
682 if ($result4 != $content4) {
683 $cnt->content4
= addslashes($result4);
685 /// Update record with the changed fields
686 $status = update_record("data_content",$cnt);
688 if (!defined('RESTORE_SILENTLY')) {
689 echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
694 if (($i+
1) %
5 == 0) {
695 if (!defined('RESTORE_SILENTLY')) {
697 if (($i+
1) %
100 == 0) {