Projects
Kolab:3.4
roundcubemail-plugins-kolab
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 21
View file
roundcubemail-plugins-kolab.spec
Changed
@@ -35,6 +35,7 @@ Source1: kolab_logo.png Patch1: roundcubemail-plugins-kolab-3.1.6-task-enhancements.patch +Patch2: roundcubemail-plugins-kolab-3.1.6-2353-ics-import-efficiency.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildArch: noarch @@ -52,6 +53,7 @@ %setup -q %patch1 -p1 +%patch2 -p1 %build @@ -212,7 +214,8 @@ %attr(0770,root,%{httpd_group}) %{roundcube_lib}/plugins/odfviewer %changelog -* Thu Oct 31 2013 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 3.1.6-2 +* Thu Oct 31 2013 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 3.1.6-3 +- Also apply patch for #2353 - ICS import efficiency - Also apply patch for task enhancements - New upstream version
View file
roundcubemail-plugins-kolab-3.1.6-2353-ics-import-efficiency.patch
Added
@@ -0,0 +1,744 @@ +diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php +index 685745d..e8e5ab2 100644 +--- a/plugins/calendar/calendar.php ++++ b/plugins/calendar/calendar.php +@@ -1003,7 +1003,7 @@ class calendar extends rcube_plugin + rcube_upload_progress(); + } + +- $calendar = get_input_value('calendar', RCUBE_INPUT_GPC); ++ @set_time_limit(0); + + // process uploaded file if there is no error + $err = $_FILES['_data']['error']; +@@ -1011,22 +1011,23 @@ class calendar extends rcube_plugin + if (!$err && $_FILES['_data']['tmp_name']) { + $calendar = get_input_value('calendar', RCUBE_INPUT_GPC); + $rangestart = $_REQUEST['_range'] ? date_create("now -" . intval($_REQUEST['_range']) . " months") : 0; +- $count = $errors = 0; +- +- try { +- $events = $this->get_ical()->import_from_file($_FILES['_data']['tmp_name'], 'UTF-8', true); +- } +- catch (Exception $e) { +- $errors = 1; +- $msg = $e->getMessage(); +- $events = array(); +- } ++ $user_email = $this->rc->user->get_username(); ++ ++ $ical = $this->get_ical(); ++ $errors = !$ical->fopen($_FILES['_data']['tmp_name']); ++ $count = $i = 0; ++ foreach ($ical as $event) { ++ // keep the browser connection alive on long import jobs ++ if (++$i > 100 && $i % 100 == 0) { ++ echo "<!-- -->"; ++ ob_flush(); ++ } + +- foreach ($events as $event) { + // TODO: correctly handle recurring events which start before $rangestart + if ($event['end'] < $rangestart && (!$event['recurrence'] || ($event['recurrence']['until'] && $event['recurrence']['until'] < $rangestart))) + continue; + ++ $event['_owner'] = $user_email; + $event['calendar'] = $calendar; + if ($this->driver->new_event($event)) { + $count++; +diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js +index d5a4308..3ef1cb1 100644 +--- a/plugins/calendar/calendar_ui.js ++++ b/plugins/calendar/calendar_ui.js +@@ -1988,10 +1988,15 @@ function rcube_calendar_ui(settings) + rcmail.display_message(rcmail.get_label('importerror', 'calendar'), 'error'); + }); + +- // display upload indicator ++ // display upload indicator (with extended timeout) ++ var timeout = rcmail.env.request_timeout; ++ rcmail.env.request_timeout = 600; + me.import_succeeded = null; + me.saving_lock = rcmail.set_busy(true, 'uploading'); + $('.ui-dialog-buttonpane button', $dialog.parent()).button('disable'); ++ ++ // restore settings ++ rcmail.env.request_timeout = timeout; + } + }; + +diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php b/plugins/calendar/drivers/kolab/kolab_calendar.php +index 91c8d0c..bd42f56 100644 +--- a/plugins/calendar/drivers/kolab/kolab_calendar.php ++++ b/plugins/calendar/drivers/kolab/kolab_calendar.php +@@ -317,7 +317,7 @@ class kolab_calendar + } + else { + $event['id'] = $event['uid']; +- $this->events[$event['uid']] = $this->_to_rcube_event($object); ++ $this->events = array($event['uid'] => $this->_to_rcube_event($object)); + } + + return $saved; +diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php +index 5e12d50..aa6dc4a 100644 +--- a/plugins/libcalendaring/libvcalendar.php ++++ b/plugins/libcalendaring/libvcalendar.php +@@ -37,13 +37,17 @@ if (!class_exists('\Sabre\VObject\Reader')) { + * and place the lib files in this plugin's lib directory + * + */ +-class libvcalendar ++class libvcalendar implements Iterator + { + private $timezone; + private $attach_uri = null; + private $prodid = '-//Roundcube//Roundcube libcalendaring//Sabre//Sabre VObject//EN'; + private $type_component_map = array('event' => 'VEVENT', 'task' => 'VTODO'); + private $attendee_keymap = array('name' => 'CN', 'status' => 'PARTSTAT', 'role' => 'ROLE', 'cutype' => 'CUTYPE', 'rsvp' => 'RSVP'); ++ private $iteratorkey = 0; ++ private $charset; ++ private $forward_exceptions; ++ private $fp; + + public $method; + public $agent = ''; +@@ -98,6 +102,13 @@ class libvcalendar + { + $this->method = ''; + $this->objects = array(); ++ $this->freebusy = array(); ++ $this->iteratorkey = 0; ++ ++ if ($this->fp) { ++ fclose($this->fp); ++ $this->fp = null; ++ } + } + + /** +@@ -108,25 +119,36 @@ class libvcalendar + * @param boolean True if parsing exceptions should be forwarded to the caller + * @return array List of events extracted from the input + */ +- public function import($vcal, $charset = 'UTF-8', $forward_exceptions = false) ++ public function import($vcal, $charset = 'UTF-8', $forward_exceptions = false, $memcheck = true) + { + // TODO: convert charset to UTF-8 if other + + try { ++ // estimate the memory usage and try to avoid fatal errors when allowed memory gets exhausted ++ if ($memcheck) { ++ $count = substr_count($vcal, 'BEGIN:VEVENT'); ++ $expected_memory = $count * 70*1024; // assume ~ 70K per event (empirically determined) ++ ++ if (!rcube_utils::mem_check($expected_memory)) { ++ throw new Exception("iCal file too big"); ++ } ++ } ++ + $vobject = VObject\Reader::read($vcal, VObject\Reader::OPTION_FORGIVING | VObject\Reader::OPTION_IGNORE_INVALID_LINES); + if ($vobject) + return $this->import_from_vobject($vobject); + } + catch (Exception $e) { +- rcube::raise_error(array( +- 'code' => 600, 'type' => 'php', +- 'file' => __FILE__, 'line' => __LINE__, +- 'message' => "iCal data parse error: " . $e->getMessage()), +- true, false); +- + if ($forward_exceptions) { + throw $e; + } ++ else { ++ rcube::raise_error(array( ++ 'code' => 600, 'type' => 'php', ++ 'file' => __FILE__, 'line' => __LINE__, ++ 'message' => "iCal data parse error: " . $e->getMessage()), ++ true, false); ++ } + } + + return array(); +@@ -142,17 +164,118 @@ class libvcalendar + */ + public function import_from_file($filepath, $charset = 'UTF-8', $forward_exceptions = false) + { +- $this->objects = array(); +- $fp = fopen($filepath, 'r'); ++ if ($this->fopen($filepath, $charset, $forward_exceptions)) { ++ while ($this->_parse_next(false)) { ++ // nop ++ } ++ ++ fclose($this->fp); ++ $this->fp = null; ++ } ++ ++ return $this->objects; ++ } ++ ++ /** ++ * Open a file to read iCalendar events sequentially ++ * ++ * @param string File path to read from ++ * @param string Input charset (from envelope) ++ * @param boolean True if parsing exceptions should be forwarded to the caller ++ * @return boolean True if file contents are considered valid ++ */ ++ public function fopen($filepath, $charset = 'UTF-8', $forward_exceptions = false) ++ { ++ $this->reset(); ++ ++ // just to be sure... ++ @ini_set('auto_detect_line_endings', true); ++ ++ $this->charset = $charset; ++ $this->forward_exceptions = $forward_exceptions; ++ $this->fp = fopen($filepath, 'r');
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.