mstilkerich / rcmcarddav

CardDAV plugin for RoundCube Webmailer
GNU General Public License v2.0
257 stars 81 forks source link

Interoperability with Kolab calendar plugin #320

Closed wawefr closed 3 years ago

wawefr commented 3 years ago

Hello i have an error using Carddav. The enum.php file is missing which I cannot add. Thank you Fred

PHP Warning: include(/etc/roundcube/plugins/libcalendaring/vendor/sabre/xml/lib/Deserializer/enum.php): failed to open stream:

mstilkerich commented 3 years ago

Your error message is from a libcalendaring plugin that I don’t know, not from the carddav plugin.

wawefr commented 3 years ago

Hi

The message comes when I use Carddav see complet log Do you confirm you can't help me ? Thanks

Stack trace:

0 /var/lib/roundcube/vendor/mstilkerich/carddavclient/src/AddressbookCollection.php(162): MStilkerich\CardDavClient\AddressbookCollection->validateCard(Object(Sabre\V$

1 /etc/roundcube/plugins/carddav/src/Addressbook.php(509): MStilkerich\CardDavClient\AddressbookCollection->createCard(Object(Sabre\VObject\Component\VCard))

2 /usr/share/roundcube/program/steps/addressbook/move.inc(88): MStilkerich\CardDavAddressbook4Roundcube\Addressbook->insert(Array, false)

3 /var/lib/roundcube/index.php(315): include_once('/usr/share/roun...')

4 {main}

thrown in /var/lib/roundcube/vendor/mstilkerich/carddavclient/src/AddressbookCollection.php on line 220 [27-Nov-2020 08:51:03 Europe/Berlin] PHP Warning: include(/etc/roundcube/plugins/libcalendaring/vendor/sabre/xml/lib/Deserializer/enum.php): failed to open stream: No$ [27-Nov-2020 08:51:03 Europe/Berlin] PHP Warning: include(): Failed opening '/etc/roundcube/plugins/libcalendaring/vendor/sabre/xml/lib/Deserializer/enum.php' for inc$ [27-Nov-2020 10:13:02 Europe/Berlin] PHP Warning: include(/etc/roundcube/plugins/libcalendaring/vendor/sabre/xml/lib/Deserializer/enum.php): failed to open stream: No$ [27-Nov-2020 10:13:02 Europe/Berlin] PHP Warning: include(): Failed opening '/etc/roundcube/plugins/libcalendaring/vendor/sabre/xml/lib/Deserializer/enum.php' for inc$

mstilkerich commented 3 years ago

Ok, it attempts to load the sabre library from the libcalendaring vendor directory. Possibly incompatible/different versions are installed in that plugin. This is why I recommend to have a global vendor directory for all roundcube code including plugins so that only one instance of each library is installed and composer can globally check version constraints.

Does it work without the calendaring plugin? I dont know if that plugin supports managing its dependencies using composer, if it does please try to run composer in the roundcube main directory and remove an vendor directory from plugins.

mstilkerich commented 3 years ago

Kolab's calendaring plugin depends on an older version of sabre/vobject (3.5.3), at least according to packagist. RCMCardDAV requires a version starting at 4.3, so composer will not be able to resolve these dependencies.

The dependency of RCMCardDAV is more or less simply the first version I used. I guess 3.5.3 would work just as fine, but would require some testing before changing the version constraint.

mstilkerich commented 3 years ago

The unit tests for data conversion run fine with sabre/vobject 3.3.5, so I widened the version constraint to allows usage with older sabre/vobject versions in the v4.1 branch.

I also tried using the calendar plugin following the instructions here with a released version of the plugin (i.e. with new sabre/vobject installed with the plugin). It seems to work just fine as well, so maybe the calendar plugin also would work with sabre/vobject v4.

So I guess the key is to just make sure that you don't have several versions of sabre/vobject installed in your roundcube installation.

If you still have trouble / require assistance please let me know, otherwise I will close this issue in a couple of days.

wawefr commented 3 years ago

Many thanks for your help and job. I will check if I have différents versions of Sabre (It very possible because I have installed differents plugins) I hope I will succeed to do working correctly the différents plugins because I'm not an expert, and I need to understand how I will install the final solution I come back to you if I have any questions Thanks and sorry for my poor english (I'm french)

wawefr commented 3 years ago

I confirm that I have several vendor directories for plugins with several sabre implementations. how do i get one under the roundcube root? thanks

mstilkerich commented 3 years ago

With a plain roundcube installation (i.e. not debian/ubuntu package), you simply add the plugins to your composer.json file in the roundcube root directory and delete the vendor directories for any plugin folder. Then run composer update --no-dev and it should install compatible versions of the libraries for all plugins in roundcube/vendor.

Note that with calendar and rcmcarddav this will fail because of the composer dependencies, unless you use the 4.1 branch where the dependency is adapted and dev-master of mstilkerich/carddavclient (where I also had to widen the version constraint).

However, if you installed the calendar plugin with according to the linked instructions above, there will be no vendor directory inside the calendar plugins and you have to take care to install sabre on your own (which would already have happened by installing rcmcarddav). And in this case it appears to also work with rcmcarddav 4.0, calendar will use sabre/vobject 4 in that case (there might be incompatibilities of course).

I don't know what other plugins you have installed that may also use sabre and whether they are composer compatible or not.

To use v4.1 you would add the following to composer.json (the requirement needs to be added to the existing require array of course):

    "require": {
        "mstilkerich/carddavclient": "dev-master",
        "roundcube/carddav": "v4.1.x-dev"
    },
    "minimum-stability": "dev",
    "prefer-stable": true
wawefr commented 3 years ago

Hello Thanks for your help, FYI I'm on debian buster, and my installation is for mail serveur (I use this tuto https://workaround.org/) After I made your modifications, I have a new mistake Thanks Fred

[02-Dec-2020 17:26:18 Europe/Berlin] PHP Fatal error: Uncaught Error: Undefined class constant 'PROFILE_CARDDAV' in /var/lib/roundcube/vendor/mstilkerich/carddavclien$ Stack trace:

0 /var/lib/roundcube/vendor/mstilkerich/carddavclient/src/AddressbookCollection.php(180): MStilkerich\CardDavClient\AddressbookCollection->validateCard(Object(Sabre\V$

1 /etc/roundcube/plugins/carddav/src/Addressbook.php(509): MStilkerich\CardDavClient\AddressbookCollection->createCard(Object(Sabre\VObject\Component\VCard))

2 /usr/share/roundcube/program/steps/addressbook/save.inc(225): MStilkerich\CardDavAddressbook4Roundcube\Addressbook->insert(Array)

3 /var/lib/roundcube/index.php(315): include_once('/usr/share/roun...')

4 {main}

thrown in /var/lib/roundcube/vendor/mstilkerich/carddavclient/src/AddressbookCollection.php on line 276

mstilkerich commented 3 years ago

Hello,

when PROFILE_CARDDAV is not defined the sabre/vobject library is too old. The version constraint allows sabre starting from 3.3.5 (which is precisely the version that defines this constant), and calendar requires 3.5.something. So apparently you installed something older.

Can you execute the following commands in your /var/lib/roundcube directory and provide the output: composer info find -name Node.php

Btw from your paths I guess you are running the Debian package version of roundcube. It normally requires copying the composer.json file from /usr/share/roundcube to /var/lib/roundcube and modify it in order to use composer with the debian package. But you appear to have done that already?

wawefr commented 3 years ago

Hello This is the feedback image

image

mstilkerich commented 3 years ago

Hello,

in principal, this looks good (i.e. I cannot tell why it does not work). You seem to not have installed all your plugins via composer, e.g. I don't see the carddav plugin. In addition, your carddav plugin lives in a weird place /etc/roundcube. I don't even know why roundcube checks that directory for plugins.

For reference, here is a readily adapted composer.json file that I have have in /var/lib/roundcube and that will install the carddav plugin including all dependencies for you. For that, run composer update --no-dev in the /var/lib/roundcube directory. Maybe delete the vendor directory before doing this, although it should normally not be needed.

{
    "name": "roundcube/roundcubemail",
    "description": "The Roundcube Webmail suite",
    "license": "GPL-3.0+",
    "repositories": [
        {
            "type": "composer",
            "url": "https://plugins.roundcube.net"
        }
    ],
    "require": {
        "php": ">=5.4.0",
        "masterminds/html5": ">=2.5.0",
        "pear/net_socket": ">=1.0.14",
        "pear/auth_sasl": ">=1.0.6",
        "pear/mail_mime": ">=1.10.0",
        "pear/net_smtp": ">=1.8.0",
        "pear/net_sieve": ">=1.4.1",
        "roundcube/plugin-installer": ">=0.1.6",
        "mstilkerich/carddavclient": "dev-master",
        "roundcube/carddav": "v4.1.x-dev"
    },
    "require-dev": {
        "phpunit/phpunit": "^4.8.36 || ^5.7.21"
    },
    "suggest": {
        "kolab/net_ldap3": ">=1.1.1",
        "pear-pear.php.net/crypt_gpg": ">=1.6.0",
        "mkopinsky/zxcvbn-php": ">=4.4.2 required for Zxcvbn password strength driver"
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}
wawefr commented 3 years ago

Hello Many thanks, now it's ok. I have cardav on roundcube with a baikal server. I am doing a test with my iPhone, it works fine. For information on my debian I have 3 places where I have Roundcube /etc/roundcube /var/lib/roundcube /usr/share/roundcube

One other question, is there a plugin for roundcube Calendar ?

Many thanks Fred

mstilkerich commented 3 years ago

Erm yes, the calendar plugin you originally had installed already?

Glad to hear it works for you now, then I'll close this issue.