From 5b46071eb0145869a2176e4aa188449cd4d64813 Mon Sep 17 00:00:00 2001
From: Gabriel Fontes <hi@m7.rs>
Date: Tue, 19 May 2026 12:20:24 -0300
Subject: [PATCH] fix: load plugin vendor dir as well

---
 plugins/libcalendaring/libcalendaring.php | 5 +++++
 plugins/libkolab/libkolab.php             | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/plugins/libcalendaring/libcalendaring.php b/plugins/libcalendaring/libcalendaring.php
index f5889737..6c924c77 100644
--- a/plugins/libcalendaring/libcalendaring.php
+++ b/plugins/libcalendaring/libcalendaring.php
@@ -107,6 +107,11 @@ class libcalendaring extends rcube_plugin
      */
     public function init()
     {
+        // This supports a self-contained tarball installation of the plugin, at the risk of having conflicts with other
+        // versions of the library installed in the global roundcube vendor directory (-> use not recommended)
+        if (file_exists(dirname(__FILE__) . "/vendor/autoload.php")) {
+            include_once dirname(__FILE__) . "/vendor/autoload.php";
+        }
         // extend include path to load bundled lib classes
         $include_path = $this->home . '/lib' . PATH_SEPARATOR . ini_get('include_path');
         set_include_path($include_path);
diff --git a/plugins/libkolab/libkolab.php b/plugins/libkolab/libkolab.php
index 7b026fad..5d6ac934 100644
--- a/plugins/libkolab/libkolab.php
+++ b/plugins/libkolab/libkolab.php
@@ -41,6 +41,11 @@ class libkolab extends rcube_plugin
         $this->load_config();
         $this->require_plugin('libcalendaring');

+        // This supports a self-contained tarball installation of the plugin, at the risk of having conflicts with other
+        // versions of the library installed in the global roundcube vendor directory (-> use not recommended)
+        if (file_exists(dirname(__FILE__) . "/vendor/autoload.php")) {
+            include_once dirname(__FILE__) . "/vendor/autoload.php";
+        }
         // extend include path to load bundled lib classes
         $include_path = $this->home . '/lib' . PATH_SEPARATOR . ini_get('include_path');
         set_include_path($include_path);
--
2.53.0

