JodliDev / calendar

GNU Affero General Public License v3.0
16 stars 12 forks source link

install misses Sabre\DAV\client #11

Closed chaos-prevails closed 2 years ago

chaos-prevails commented 2 years ago

Hello, first, thanks so much for this plugin!

I tried to install, and ended up with this error message: May 10 18:52:28 mail roundcube: PHP Fatal error: Uncaught Error: Class 'Sabre\DAV\Client' not found in /opt/www/roundcubemail/plugins/calendar/drivers/caldav/caldav_client.php:26

I understand I'm missing Sabre, but I didn't get it when following the install instructions. My composer.json (updated to composer v2) looks like this:

{
    "name": "roundcube/roundcubemail",
    "description": "The Roundcube Webmail suite",
    "license": "GPL-3.0+",
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://plugins.roundcube.net"
        },
        "calendar": {
            "type": "vcs",
            "url": "https://github.com/JodliDev/calendar",
            "minimum-stability": "dev"
        },
        "libcalendaring": {
            "type": "vcs",
            "url": "https://github.com/JodliDev/libcalendaring",
            "minimum-stability": "dev"
        }
    },
    "require": {
        "php": ">=5.5.0",
        "pear/pear-core-minimal": "~1.10.1",
        "pear/auth_sasl": "~1.1.0",
        "pear/net_idna2": "~0.2.0",
        "pear/mail_mime": "~1.10.0",
        "pear/net_smtp": "~1.10.0",
        "pear/crypt_gpg": "~1.6.3",
        "pear/net_sieve": "~1.4.5",
        "roundcube/plugin-installer": ">=0.2.0",
        "masterminds/html5": "~2.7.0",
        "endroid/qr-code": "~1.6.5",
        "kolab/net_ldap3": "~1.1.1",
        "roundcube/rtf-html-php": "~2.1",
        "guzzlehttp/guzzle": "^6.5.5",
        "kolab/calendar": "^3.5"
    },
    "require-dev": {
        "phpunit/phpunit": "^4.8.36 || ^5.7.21"
    },
    "suggest": {
        "mkopinsky/zxcvbn-php": "^4.4.2 required for Zxcvbn password strength driver"
    },
    "config": {
        "home": "/opt/www/roundcubemail/.composer",
        "data-dir": "/opt/www/roundcubemail/.composer",
        "cache-dir": "/opt/www/roundcubemail/.composer/cache",
        "allow-plugins": {
            "roundcube/plugin-installer": true
        }
    }
}

please beware that I moved the dev as minimum requirement to the 2 added repositories of JodliDev (but I don't think that is my issue). Otherwise I think I would lower the minimum standard for all plugins to dev, and I wanted to prevent that.

However, with above composer.json I don't even get the calendar master from JodliDev (I just get the kolab/calendar which is enabled and downloaded to the plugins directory, and I get a folder called libcalendaring. So I deleted the kolab calendar (plugins/calenar), and manually downloaded the master from this repository and put it there instead (plugins/calendar). The error persisted, so I also manually downloaded JodliDev/libcalendaring, and also placed it to plugins/libcalendaring instead.

Then I initialized the database. Otherwise than that, I left the config.inc.php unchanged for the moment, except configuring the caldav url to (I'm trying to use SOGo): $config['calendar_caldav_url'] = 'https://%h/SOGo/dav/%u/Calendar/%i';

so I still get the error of the missing sabre. How do I best add Sabre to my composer.json so it stays a requirement, and is updated accordingly.

the full error message is:

May 10 19:13:09 mail roundcube: PHP Fatal error:  Uncaught Error: Class 'Sabre\DAV\Client' not found in /opt/www/roundcubemail/plugins/calendar/drivers/caldav/caldav_client.php:26
May 10 19:13:09 mail roundcube: Stack trace:
May 10 19:13:09 mail roundcube: #0 /opt/www/roundcubemail/plugins/calendar/drivers/caldav/caldav_sync.php(25): require_once()
May 10 19:13:09 mail roundcube: #1 /opt/www/roundcubemail/plugins/calendar/drivers/caldav/caldav_driver.php(25): require_once('/opt/www/roundc...')
May 10 19:13:09 mail roundcube: #2 /opt/www/roundcubemail/plugins/calendar/calendar.php(246): require_once('/opt/www/roundc...')
May 10 19:13:09 mail roundcube: #3 /opt/www/roundcubemail/plugins/calendar/calendar.php(146): calendar->load_driver()
May 10 19:13:09 mail roundcube: #4 /opt/www/roundcubemail/program/lib/Roundcube/rcube_plugin_api.php(513): calendar->startup()
May 10 19:13:09 mail roundcube: #5 /opt/www/roundcubemail/index.php(97): rcube_plugin_api->exec_hook()
May 10 19:13:09 mail roundcube: #6 {main}
May 10 19:13:09 mail roundcube:   thrown in /opt/www/roundcubemail/plugins/calendar/drivers/caldav/caldav_client.php on line 26

thanks!

chaos-prevails commented 2 years ago

sorry, I can answer my own question by looking at the composer.json file in this rep! of course I just need to add sabre as requirement (and libkolab instead of kolab/calendar)

I will test more tomorrow, and if I succeed, post a full explanation for SOGo with autodiscovery (in case more people need a more elaborate step-by-step explanation!)

chaos-prevails commented 2 years ago

I only partly succeeded to install everything via composer CLI without manually downloading a github repository. I always get the following error when trying to add jodlidev/calendar as requirement:

www-data@mail:/opt/www/roundcubemail$ composer.phar require jodlidev/calendar "dev-master"
./composer.json has been updated
Running composer update jodlidev/calendar
Loading composer repositories with package information
Updating dependencies                                  
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires jodlidev/calendar, it could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I tried any various minimum requirement but composer does not find an appropriate package on github. So I had to download the latest zip file from github to extract it to ./plugins/ and rename it to calendar

prior to that, this should work (however bear in mind that I have an issue showing calendar events, not sure if that is related:

  1. switch to www-data user: sudo su -s /bin/bash www-data
  2. add sabre/dav as required: composer.phar require sabre/dav
  3. add kolab/libkolab as required:composer.phar require kolab/libkolab
  4. add calendar repository: composer config repositories.calendar vcs https://github.com/JodliDev/calendar
  5. add libcalendar repository:composer config repositories.libcalendaring vcs https://github.com/JodliDev/libcalendaring
  6. add jodlidev/libcalendaring as required: composer.phar require jodlidev/libcalendaring "dev-master"
  7. add jodlidev/calendar as required: composer.phar require jodlidev/calendar "dev-master" <-- this should work, but it does not (so manual download needed)
  8. initialize the DB: bin/initdb.sh --dir=plugins/calendar/drivers/caldav/SQL

the result is:

{
    "name": "roundcube/roundcubemail",
    "description": "The Roundcube Webmail suite",
    "license": "GPL-3.0+",
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://plugins.roundcube.net"
        },
        "calendar": {
            "type": "vcs",
            "url": "https://github.com/JodliDev/calendar",
            "minimum-stability": "dev"
        },
        "libcalendaring": {
            "type": "vcs",
            "url": "https://github.com/JodliDev/libcalendaring",
            "minimum-stability": "dev"
        }
    },
    "require": {
        "php": ">=5.5.0",
        "pear/pear-core-minimal": "~1.10.1",
        "pear/auth_sasl": "~1.1.0",
        "pear/net_idna2": "~0.2.0",
        "pear/mail_mime": "~1.10.0",
        "pear/net_smtp": "~1.10.0",
        "pear/crypt_gpg": "~1.6.3",
        "pear/net_sieve": "~1.4.5",
        "roundcube/plugin-installer": ">=0.2.0",
        "masterminds/html5": "~2.7.0",
        "endroid/qr-code": "~1.6.5",
        "kolab/net_ldap3": "~1.1.1",
        "roundcube/rtf-html-php": "~2.1",
        "guzzlehttp/guzzle": "^6.5.5",
        "roundcube/carddav": "^4.3",
        "sabre/dav": "^4.3",
        "jodlidev/libcalendaring": "dev-master",
        "kolab/libkolab": "^3.5"
    },
    "require-dev": {
        "phpunit/phpunit": "^4.8.36 || ^5.7.21"
    },
    "suggest": {
        "mkopinsky/zxcvbn-php": "^4.4.2 required for Zxcvbn password strength driver"
    },
    "config": {
        "home": "/opt/www/roundcubemail/.composer",
        "data-dir": "/opt/www/roundcubemail/.composer",
        "cache-dir": "/opt/www/roundcubemail/.composer/cache",
        "allow-plugins": {
            "roundcube/plugin-installer": true
        }
    }
}
JodliDev commented 2 years ago

Hm. My guess is that you needed to set the minimum standard to dev and thats why it didnt find the right repositories (because without dev it skips github repositories). After you installed calendar, you could always revert the mimimum standard if you are concerned leaving it at dev

But I am happy that you resolved the issue :)