Projects
Kolab:Winterfell
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 144
View file
roundcubemail-plugins-kolab.spec
Changed
@@ -62,7 +62,6 @@ Source104: plesk.libkolab.inc.php Patch0000: roundcubemail-plugins-kolab-3.4-kolab-files-manticore-api.patch -Patch0001: 0001-Fix-kolab-cache-sync-issues.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildArch: noarch @@ -1398,7 +1397,6 @@ cp -av %{datadir}/skins/elastic/styles/ skins/elastic/. || : %patch0000 -p1 -%patch0001 -p1 %if 0%{?plesk} # Provide defaults for Plesk
View file
0001-Fix-kolab-cache-sync-issues.patch
Deleted
@@ -1,537 +0,0 @@ -From 23c76d2ef80b35acf8d86ae4e4391020918998cf Mon Sep 17 00:00:00 2001 -From: Aleksander Machniak <machniak@kolabsys.com> -Date: Fri, 16 Oct 2020 11:01:12 +0200 -Subject: [PATCH] Fix kolab cache sync issues - -Summary: Use QRESYNC, get rid of "scheduled" cache reset, other small improvements - -Reviewers: #roundcube_kolab_plugins_developers - -Subscribers: #roundcube_kolab_plugins_developers - -Differential Revision: https://git.kolab.org/D1726 ---- - plugins/libkolab/config.inc.php.dist | 4 - - plugins/libkolab/lib/kolab_storage_cache.php | 404 ++++++++++++++----- - 2 files changed, 295 insertions(+), 113 deletions(-) - -diff --git a/plugins/libkolab/config.inc.php.dist b/plugins/libkolab/config.inc.php.dist -index 81f4ea80..9801af37 100644 ---- a/plugins/libkolab/config.inc.php.dist -+++ b/plugins/libkolab/config.inc.php.dist -@@ -5,10 +5,6 @@ - // Enable caching of Kolab objects in local database - $config['kolab_cache'] = true; - --// Cache refresh interval (default is 12 hours) --// after this period, cache is forced to synchronize with IMAP --$config['kolab_cache_refresh'] = '12h'; -- - // Specify format version to write Kolab objects (must be a string value!) - $config['kolab_format_version'] = '3.0'; - -diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php -index 8f682e54..18b5e5f2 100644 ---- a/plugins/libkolab/lib/kolab_storage_cache.php -+++ b/plugins/libkolab/lib/kolab_storage_cache.php -@@ -27,8 +27,6 @@ class kolab_storage_cache - const DB_DATE_FORMAT = 'Y-m-d H:i:s'; - const MAX_RECORDS = 500; - -- public $sync_complete = false; -- - protected $db; - protected $imap; - protected $folder; -@@ -42,7 +40,6 @@ class kolab_storage_cache - protected $synclock = false; - protected $ready = false; - protected $cache_table; -- protected $cache_refresh = 3600; - protected $folders_table; - protected $max_sql_packet; - protected $max_sync_lock_time = 600; -@@ -85,7 +82,6 @@ class kolab_storage_cache - $this->imap = $rcmail->get_storage(); - $this->enabled = $rcmail->config->get('kolab_cache', false); - $this->folders_table = $this->db->table_name('kolab_folders'); -- $this->cache_refresh = get_offset_sec($rcmail->config->get('kolab_cache_refresh', '12h')); - $this->server_timezone = new DateTimeZone(date_default_timezone_get()); - - if ($this->enabled) { -@@ -174,16 +170,6 @@ class kolab_storage_cache - if ($this->synched) - return; - -- // increase time limit -- @set_time_limit($this->max_sync_lock_time - 60); -- -- // get effective time limit we have for synchronization (~70% of the execution time) -- $time_limit = ini_get('max_execution_time') * 0.7; -- $sync_start = time(); -- -- // assume sync will be completed -- $this->sync_complete = true; -- - if (!$this->ready) { - // kolab cache is disabled, synchronize IMAP mailbox cache only - $this->imap_mode(true); -@@ -191,124 +177,312 @@ class kolab_storage_cache - $this->imap_mode(false); - } - else { -+ $this->sync_start = time(); -+ - // read cached folder metadata - $this->_read_folder_data(); - -+ // Read folder data from IMAP -+ $ctag = $this->folder->get_ctag(); -+ -+ // Validate current ctag -+ list($uidvalidity, $highestmodseq, $uidnext) = explode('-', $ctag); -+ -+ if (empty($uidvalidity) || empty($highestmodseq)) { -+ rcube::raise_error(array( -+ 'code' => 900, -+ 'message' => "Failed to sync the kolab cache (Invalid ctag)" -+ ), true); -+ } - // check cache status ($this->metadata is set in _read_folder_data()) -- if ( empty($this->metadata['ctag']) || -- empty($this->metadata['changed']) || -- $this->metadata['objectcount'] === null || -- $this->metadata['changed'] < date(self::DB_DATE_FORMAT, time() - $this->cache_refresh) || -- $this->metadata['ctag'] != $this->folder->get_ctag() || -- intval($this->metadata['objectcount']) !== $this->count() -+ else if ( -+ empty($this->metadata['ctag']) -+ || empty($this->metadata['changed']) -+ || $this->metadata['ctag'] !== $ctag - ) { - // lock synchronization for this folder or wait if locked - $this->_sync_lock(); - -- // disable messages cache if configured to do so -- $this->imap_mode(true); -+ // Run a full-sync (initial sync or continue the aborted sync) -+ if (empty($this->metadata['changed']) || empty($this->metadata['ctag'])) { -+ $result = $this->synchronize_full(); -+ } -+ // Synchronize only the changes since last sync -+ else { -+ $result = $this->synchronize_update($ctag); -+ } -+ -+ // update ctag value (will be written to database in _sync_unlock()) -+ if ($result) { -+ $this->metadata['ctag'] = $ctag; -+ $this->metadata['changed'] = date(self::DB_DATE_FORMAT, time()); -+ } -+ -+ // remove lock -+ $this->_sync_unlock(); -+ } -+ } - -- // synchronize IMAP mailbox cache -- $this->imap->folder_sync($this->folder->name); -+ $this->check_error(); -+ $this->synched = time(); -+ } - -- // compare IMAP index with object cache index -- $imap_index = $this->imap->index($this->folder->name, null, null, true, true); -+ /** -+ * Perform full cache synchronization -+ */ -+ protected function synchronize_full() -+ { -+ // get effective time limit we have for synchronization (~70% of the execution time) -+ $time_limit = $this->_max_sync_lock_time() * 0.7; - -- $this->imap_mode(false); -+ if (time() - $this->sync_start > $time_limit) { -+ return false; -+ } - -- // determine objects to fetch or to invalidate -- if (!$imap_index->is_error()) { -- $imap_index = $imap_index->get(); -- $old_index = array(); -- $del_index = array(); -+ // disable messages cache if configured to do so -+ $this->imap_mode(true); - -- // read cache index -- $sql_result = $this->db->query( -- "SELECT `msguid`, `uid` FROM `{$this->cache_table}` WHERE `folder_id` = ?" -- . " ORDER BY `msguid` DESC", $this->folder_id -- ); -+ // synchronize IMAP mailbox cache, does nothing if messages cache is disabled -+ $this->imap->folder_sync($this->folder->name); - -- while ($sql_arr = $this->db->fetch_assoc($sql_result)) { -- // Mark all duplicates for removal (note sorting order above) -- // Duplicates here should not happen, but they do sometimes -- if (isset($old_index[$sql_arr['uid']])) { -- $del_index[] = $sql_arr['msguid']; -- } -- else { -- $old_index[$sql_arr['uid']] = $sql_arr['msguid']; -- } -- } -+ // compare IMAP index with object cache index -+ $imap_index = $this->imap->index($this->folder->name, null, null, true, true); - -- // fetch new objects from imap -- $i = 0; -- foreach (array_diff($imap_index, $old_index) as $msguid) { -- // Note: We'll store only objects matching the folder type -- // anything else will be silently ignored -- if ($object = $this->folder->read_object($msguid)) { -- // Deduplication: remove older objects with the same UID -- // Here we do not resolve conflicts, we just make sure -- // the most recent version of the object will be used -- if ($old_msguid = $old_index[$object['uid']]) { -- if ($old_msguid < $msguid) { -- $del_index[] = $old_msguid; -- }
View file
debian.series
Changed
@@ -1,2 +1,1 @@ roundcubemail-plugins-kolab-3.4-kolab-files-manticore-api.patch -p1 -0001-Fix-kolab-cache-sync-issues.patch -p1
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
.