From 1d5bdcd2e4760999c88a0f67fa6c3895d27031d3 Mon Sep 17 00:00:00 2001
From: dwoolhead <dwoolhead>
Date: Mon, 23 Jul 2007 10:20:15 +0000
Subject: [PATCH] MDL-10574 Backup and restore event table modulename column

---
 backup/backuplib.php  | 1 +
 backup/restorelib.php | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/backup/backuplib.php b/backup/backuplib.php
index 9dede40211..4118cbf986 100644
--- a/backup/backuplib.php
+++ b/backup/backuplib.php
@@ -1696,6 +1696,7 @@
                 fwrite ($bf,full_tag("USERID",4,false,$event->userid));
                 fwrite ($bf,full_tag("REPEATID",4,false,$event->repeatid));
                 fwrite ($bf,full_tag("EVENTTYPE",4,false,$event->eventtype));
+                fwrite ($bf,full_tag("MODULENAME",4,false,$event->modulename));
                 fwrite ($bf,full_tag("TIMESTART",4,false,$event->timestart));
                 fwrite ($bf,full_tag("TIMEDURATION",4,false,$event->timeduration));
                 fwrite ($bf,full_tag("VISIBLE",4,false,$event->visible));
diff --git a/backup/restorelib.php b/backup/restorelib.php
index 8d85723e60..a2c6c4795c 100644
--- a/backup/restorelib.php
+++ b/backup/restorelib.php
@@ -2602,6 +2602,9 @@
                         $eve->userid = backup_todb($info['EVENT']['#']['USERID']['0']['#']);
                         $eve->repeatid = backup_todb($info['EVENT']['#']['REPEATID']['0']['#']);
                         $eve->modulename = "";
+                        if (!empty($info['EVENT']['#']['MODULENAME'])) {
+                            $eve->modulename = backup_todb($info['EVENT']['#']['MODULENAME']['0']['#']);
+                        }  
                         $eve->instance = 0;
                         $eve->eventtype = backup_todb($info['EVENT']['#']['EVENTTYPE']['0']['#']);  
                         $eve->timestart = backup_todb($info['EVENT']['#']['TIMESTART']['0']['#']);
-- 
2.39.5