Date: Sunday, January 16, 2022 @ 16:58:29 Author: dvzrv Revision: 1106377
archrelease: copy trunk to community-testing-any Added: nextcloud/repos/community-testing-any/ nextcloud/repos/community-testing-any/PKGBUILD (from rev 1106376, nextcloud/trunk/PKGBUILD) nextcloud/repos/community-testing-any/apache.example.conf (from rev 1106376, nextcloud/trunk/apache.example.conf) nextcloud/repos/community-testing-any/nextcloud-23.0.0-php8.1.patch (from rev 1106376, nextcloud/trunk/nextcloud-23.0.0-php8.1.patch) nextcloud/repos/community-testing-any/nextcloud-cron.service (from rev 1106376, nextcloud/trunk/nextcloud-cron.service) nextcloud/repos/community-testing-any/nextcloud-cron.timer (from rev 1106376, nextcloud/trunk/nextcloud-cron.timer) nextcloud/repos/community-testing-any/nextcloud.config.php (from rev 1106376, nextcloud/trunk/nextcloud.config.php) nextcloud/repos/community-testing-any/nextcloud.hook (from rev 1106376, nextcloud/trunk/nextcloud.hook) nextcloud/repos/community-testing-any/nextcloud.install (from rev 1106376, nextcloud/trunk/nextcloud.install) nextcloud/repos/community-testing-any/nextcloud.occ.sh (from rev 1106376, nextcloud/trunk/nextcloud.occ.sh) nextcloud/repos/community-testing-any/nextcloud.sysusers (from rev 1106376, nextcloud/trunk/nextcloud.sysusers) nextcloud/repos/community-testing-any/nextcloud.tmpfiles (from rev 1106376, nextcloud/trunk/nextcloud.tmpfiles) nextcloud/repos/community-testing-any/nextcloud.uwsgi (from rev 1106376, nextcloud/trunk/nextcloud.uwsgi) -------------------------------+ PKGBUILD | 131 +++++ apache.example.conf | 21 nextcloud-23.0.0-php8.1.patch | 983 ++++++++++++++++++++++++++++++++++++++++ nextcloud-cron.service | 9 nextcloud-cron.timer | 9 nextcloud.config.php | 17 nextcloud.hook | 13 nextcloud.install | 16 nextcloud.occ.sh | 45 + nextcloud.sysusers | 1 nextcloud.tmpfiles | 9 nextcloud.uwsgi | 82 +++ 12 files changed, 1336 insertions(+) Copied: nextcloud/repos/community-testing-any/PKGBUILD (from rev 1106376, nextcloud/trunk/PKGBUILD) =================================================================== --- community-testing-any/PKGBUILD (rev 0) +++ community-testing-any/PKGBUILD 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,131 @@ +# Maintainer: Sergej Pupykin <pupykin.s+a...@gmail.com> +# Maintainer: David Runge <dv...@archlinux.org> + +pkgname=nextcloud +# NOTE: do not package x.0.0 versions as they are considered beta +pkgver=23.0.0 +pkgrel=2 +pkgdesc="A cloud server to store your files centrally on a hardware controlled by you" +arch=(any) +url="https://nextcloud.com" +license=(AGPL3) +depends=('php>=8.0.0' 'php<8.2.0' php-gd) +optdepends=( + 'curl: for webcron jobs from within uwsgi' + 'ffmpeg: for preview generation' + 'libreoffice: for preview generation' + 'mariadb: to use a local MariaDB server' + 'memcached: to use a local memcached server' + 'php-apcu: for caching with APCU' + 'php-apache: to use the Apache web server' + 'mod_itk: to use the Apache web server' + 'php-fpm: to run in fastCGI process manager' + 'php-imagick: for preview generation' + 'php-imap: for external user authentication' + 'php-intl: to increase language translation performance and fix sorting' + 'php-memcached: for caching with memcached' + 'php-pgsql: to use the PostgreSQL database backend' + 'php-redis: for caching with redis' + 'php-sqlite: to use the SQLite database backend' + 'postgresql: to use a local PostgreSQL server' + 'redis: to use a local Redis server' + 'smbclient: for SMB/CIFS integration' + 'sudo: for privilege elevation in occ command when not run as root' + 'uwsgi-plugin-php: run as application container' +) +backup=( + "etc/webapps/${pkgname}/config/config.php" + "etc/webapps/${pkgname}/.htaccess" + "etc/uwsgi/${pkgname}.ini" +) +# there are no elf files, no need to strip anything +options=(!strip) +install="${pkgname}.install" +source=( + "https://download.nextcloud.com/server/releases/nextcloud-${pkgver}.tar.bz2"{,.asc} + 'apache.example.conf' + "${pkgname}.config.php" + "${pkgname}.hook" + "${pkgname}.occ.sh" + "${pkgname}.sysusers" + "${pkgname}.tmpfiles" + "${pkgname}.uwsgi" + "${pkgname}-cron.service" + "${pkgname}-cron.timer" + "${pkgname}-23.0.0-php8.1.patch" +) +sha512sums=('fba9f03c37a4d3f5e44472218fc50a49157872ae7c1aaaa3bc0c1c0301a97394690f75cf03cd11b3f9b0f282fef29eea189fa52ee5019f40a0d6f671ddda6706' + 'SKIP' + '5f9be223225e6ad2772989c440df8585a852ea0be697274384064ec73df47dab2f5d0847c275732fab26c419a713911d8f77ebc2b639bf6e8ede76272b752cde' + '92592f9a76ee534d0ae6d3aedf2257c147337debe7e2d6dbec1daff66a682e3abc74611e08662058de314bf3ea6ff1c85efd678674b782d71251c38786e446f9' + '7b18b73ee369607b8ee3d00d2a054262a7b8f3033fc4873eb333c9b9333d7338870c035910ae123b564a65d7d245730178137311048f0713d5bc524de3654923' + 'daae0331998fc3b135c18330cd8f8405958abce1a913cdbc16accc3c49f2b185a6d44cf4d768eb1eb11d1dd1d81dcc3fe75ec959bd9f4c9c5eb85c450d5ad408' + '1d06f339c43d57e5f5406c2698b815241fd9e39039a9e55f777face510c9a5ddae5ccd4e051393e8f16f391301a6aa03fff2462837a2d3441d969ea7195e7d84' + '919008a2bf6cf2492cb1e9c8e28c1e082d74e45da5a96e6669f8971d6cf721e36d23625c89918fe10d8bc1b202c0340aa897849d9ec501a26f3f4572ccb57a98' + '8bc7e76ba986cadf8d3bf35d6fbd8e7e236a61d1372e023c07e60427bacce925737c996d9fbaaeb51ed1066c1d0c8d83a86d7d640ed991b531744ed06629a670' + 'c585af280c2503a5a969fffd53d192a045a1dedd6d3a32901dfa0e226f9ddb4b5d1b1760553e962b061172c0077fcc57b095d8b7c70cafaa8ca84dbfce2eaa24' + 'eb69785a5b0df0e2a11f53f9c2e2dbf75681d7c698e88cbcc5ceed713a558d528511cc576813cc083cbaa28a2c83d543a39436ad4805670348ef22634305b1c8' + '00ce00f0bd5e424ee8bbaef72e7bf0a15f4987c059385abb3788d7605e2e9802176c5083a00b7e211be44c74eb83fe9b9bc1069256e0328f883a4abc01705a08') +b2sums=('2dc00a1b522b51baa368a19628e354a674af1428e062595ccf75cb8541f497c1b2f8ed4f301cc0b5136382526e0e0c6ea1405f2d08a748b8fa2caf95d70c3d89' + 'SKIP' + '7d40d120c28291f1a7537f3e1b5049fa83c9c0af949371345ea9ccdf3de4a0f3a3a06edbc52d9254dba483e4d11acf562cf679b9e379c5dfc2f61dfbfc2e4cef' + '4ad061efbc20b4d0e9f8cfd01c5e8e612fa5af29bce754b77f90c1835b98ee445ef4de3d8c83da91461053622620af14d880eb9014b51f2383c75f1860d479f4' + '772a9571fe7d88dbcbeb46351a188354e237dfe8e020131f2752b3a36cff0ff177423b4cfd6a1a5f28946f86a8581f3e24ee06ebda7260c5f862ca4071908e43' + '150273823fdadcaecf3e2af036067581cb4cf02507c6da2a533ef3c288a2a715d076f83c6d6d4ff13cd336184f595361318faa2acdc68979edfad7afef0b575b' + '1a61a89531636b65dade03cd7edca8747b3e1e880f9bbd4d5a53cffa452d70fe17e345cfed739ae92e99e336d4c1f2633c84a5c84a4ee6da518762bf1396b1db' + 'd132044cb7f1d61a1ce87800d2e1142e3ac385acdec25e2f5ad685603a0ffa88e105f4c35688584d65d287adbb40b8d9a02d6a80d7a0b58bb8801a6769405218' + '937ae5b89d968d784c7b68e1ca81e7aec11e295b95244fc4bcfec55b3d5f37ef70d5f593086eeb14101c8940a241565730cb6edcdf88165094c4ad27a89bd980' + '9857f3dd219b624869255e0d6c262b60de813b87ac4fd3fccad0a330392f55709e8c2d4b9dfb5ad19df7cc0fc13cc83cead06c9a1d893ee4e4972c4937df0c2b' + 'e6214351ca16bfe97683e838e727d6b5eaa62194878272204034c62aac4a632c9b33cd31aa0570c2eb936d7e9e7ff60190ac05a3a8cc2e27eda423a7d89b6d39' + '509be5240a86010f1143c285f0c4796d6fdc3be0239b0345aeac7f295cb723e095b91a24302558b611d0d7146654e652d3caf1e479260941a7cc84bfc4207de3') +validpgpkeys=('28806A878AE423A28372792ED75899B9A724937A') # Nextcloud Security <secur...@nextcloud.com> + +prepare() { + cd "${pkgname}" + # add backported patch for php 8.1 support: https://github.com/nextcloud/server/pull/29862 + patch -Np1 -i ../"${pkgname}-23.0.0-php8.1.patch" +} + +package() { + cd "${pkgname}" + # sysusers.d integration + install -vDm 644 ../${pkgname}.sysusers \ + "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf" + # tmpfiles.d integration + install -vDm 644 ../${pkgname}.tmpfiles \ + "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf" + # state dir for data and writable apps + install -vdm 755 "${pkgdir}/var/lib/${pkgname}/" + install -vdm 770 "${pkgdir}/var/lib/${pkgname}/data" + install -vdm 755 "${pkgdir}/var/lib/${pkgname}/apps" + # log dir + install -vdm 755 "${pkgdir}/var/log/${pkgname}/" + # uwsgi integration + install -vDm 644 "../${pkgname}.uwsgi" "${pkgdir}/etc/uwsgi/${pkgname}.ini" + # config dir + install -vDm 644 .htaccess -t "${pkgdir}/etc/webapps/${pkgname}/" + install -vDm 640 "../${pkgname}.config.php" "${pkgdir}/etc/webapps/${pkgname}/config/config.php" + find config -type f -exec install -vDm 644 {} "${pkgdir}/etc/webapps/${pkgname}/"{} \; + # remove config dir and .htaccess from source so that it is not installed to default location + rm -rf config .htaccess + + # webapp + find . -type f -not -iname "*.orig" -exec install -vDm 644 {} "${pkgdir}/usr/share/webapps/${pkgname}/"{} \; + + # symlink config directory into place + ln -sv "/etc/webapps/${pkgname}/config" "${pkgdir}/usr/share/webapps/${pkgname}/" + # symlink .htaccess file into place + ln -sv "/etc/webapps/${pkgname}/.htaccess" "${pkgdir}/usr/share/webapps/${pkgname}/" + # add symlink to default writable apps directory + ln -sv "/var/lib/${pkgname}/apps" "${pkgdir}/usr/share/webapps/${pkgname}/wapps" + # install occ command + install -vDm 755 occ -t "${pkgdir}/usr/share/webapps/${pkgname}" + # occ script + install -vDm 755 "../${pkgname}.occ.sh" "${pkgdir}/usr/bin/occ" + # optional pacman hook + install -vDm 644 "../${pkgname}.hook" -t "${pkgdir}/usr/share/doc/${pkgname}/" + # apache example conf + install -vDm 644 ../apache.example.conf -t "${pkgdir}/usr/share/doc/${pkgname}/" + # systemd timer + install -vDm 644 ../${pkgname}-cron.{service,timer} -t "$pkgdir/usr/lib/systemd/system" +} Copied: nextcloud/repos/community-testing-any/apache.example.conf (from rev 1106376, nextcloud/trunk/apache.example.conf) =================================================================== --- community-testing-any/apache.example.conf (rev 0) +++ community-testing-any/apache.example.conf 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,21 @@ +<IfModule mod_alias.c> + Alias /nextcloud /usr/share/webapps/nextcloud/ +</IfModule> + +<Directory /usr/share/webapps/nextcloud/> + Options FollowSymlinks + AllowOverride all + Require all granted +</Directory> + +<VirtualHost *:80> + ServerAdmin f...@foofarm.com + DocumentRoot /usr/share/webapps/nextcloud + ServerName nextcloud.foo.com + ErrorLog /var/log/httpd/nextcloud.foo.info-error_log + CustomLog /var/log/httpd/nextcloud.foo.info-access_log common +</VirtualHost> + +<IfModule mpm_itk_module> + AssignUserId nextcloud nextcloud +</IfModule> Copied: nextcloud/repos/community-testing-any/nextcloud-23.0.0-php8.1.patch (from rev 1106376, nextcloud/trunk/nextcloud-23.0.0-php8.1.patch) =================================================================== --- community-testing-any/nextcloud-23.0.0-php8.1.patch (rev 0) +++ community-testing-any/nextcloud-23.0.0-php8.1.patch 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,983 @@ +From 260be93a14af6eccb6240dfb3692073775da259e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> +Date: Tue, 19 Oct 2021 17:08:57 +0200 +Subject: [PATCH 01/12] Allow running Nextcloud with PHP 8.1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> +--- + lib/versioncheck.php | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/versioncheck.php b/lib/versioncheck.php +index 4b1d9dec4d72..8aa68dd35fdd 100644 +--- a/lib/versioncheck.php ++++ b/lib/versioncheck.php +@@ -33,10 +33,10 @@ + exit(1); + } + +-// Show warning if > PHP 8.0 is used as Nextcloud is not compatible with > PHP 8.0 for now +-if (PHP_VERSION_ID >= 80100) { ++// Show warning if > PHP 8.1 is used as Nextcloud is not compatible with > PHP 8.1 for now ++if (PHP_VERSION_ID > 80100) { + http_response_code(500); +- echo 'This version of Nextcloud is not compatible with > PHP 8.0.<br/>'; ++ echo 'This version of Nextcloud is not compatible with > PHP 8.1.<br/>'; + echo 'You are currently running ' . PHP_VERSION . '.'; + exit(1); + } + +From 37f8f7a5a18e57507330036b747d4b12e58efae4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> +Date: Tue, 26 Oct 2021 16:42:19 +0200 +Subject: [PATCH 03/12] Fix tests on PHP 8.1 for encryption, files_sharing, + files_version, +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + + files_trashbin and theming apps + +Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> +--- + apps/encryption/lib/Command/FixEncryptedVersion.php | 5 +---- + apps/encryption/tests/Crypto/EncryptAllTest.php | 5 ++++- + .../tests/Controller/PublicPreviewControllerTest.php | 4 ++++ + .../tests/Controller/PreviewControllerTest.php | 2 ++ + .../tests/Controller/PreviewControllerTest.php | 2 ++ + apps/theming/tests/Controller/IconControllerTest.php | 2 ++ + apps/theming/tests/Controller/ThemingControllerTest.php | 3 +++ + 7 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/apps/encryption/lib/Command/FixEncryptedVersion.php b/apps/encryption/lib/Command/FixEncryptedVersion.php +index d51f64c8ef91..073c1f1438a8 100644 +--- a/apps/encryption/lib/Command/FixEncryptedVersion.php ++++ b/apps/encryption/lib/Command/FixEncryptedVersion.php +@@ -116,10 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int + $user = (string)$input->getArgument('user'); + $pathToWalk = "/$user/files"; + +- /** +- * trim() returns an empty string when the argument is an unset/null +- */ +- $pathOption = \trim($input->getOption('path'), '/'); ++ $pathOption = \trim(($input->getOption('path') ?? ''), '/'); + if ($pathOption !== "") { + $pathToWalk = "$pathToWalk/$pathOption"; + } + +From f3dcbfe146782d2c7dec8760651e79605ddc96e7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> +Date: Tue, 26 Oct 2021 16:43:39 +0200 +Subject: [PATCH 04/12] Fix PHP 8.1 support for user_ldap application +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> +--- + apps/user_ldap/lib/Access.php | 8 +- + apps/user_ldap/lib/Connection.php | 9 +- + apps/user_ldap/lib/Group_LDAP.php | 6 +- + apps/user_ldap/lib/Group_Proxy.php | 2 +- + apps/user_ldap/lib/IGroupLDAP.php | 2 +- + apps/user_ldap/lib/ILDAPWrapper.php | 60 ++++++------ + apps/user_ldap/lib/IUserLDAP.php | 2 +- + apps/user_ldap/lib/LDAP.php | 92 +++++-------------- + apps/user_ldap/lib/LDAPProvider.php | 4 +- + apps/user_ldap/lib/PagedResults/IAdapter.php | 4 +- + apps/user_ldap/lib/PagedResults/TLinkId.php | 12 ++- + apps/user_ldap/lib/User/Manager.php | 2 +- + apps/user_ldap/lib/User/User.php | 8 +- + apps/user_ldap/lib/User_LDAP.php | 2 +- + apps/user_ldap/lib/User_Proxy.php | 2 +- + apps/user_ldap/lib/Wizard.php | 6 +- + apps/user_ldap/tests/AccessTest.php | 2 +- + .../Integration/ExceptionOnLostConnection.php | 4 +- + 18 files changed, 96 insertions(+), 131 deletions(-) + +diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php +index 0af04747ded2..f79efe909968 100644 +--- a/apps/user_ldap/lib/Access.php ++++ b/apps/user_ldap/lib/Access.php +@@ -260,7 +260,7 @@ public function readAttribute($dn, $attr, $filter = 'objectClass=*') { + /** + * Runs an read operation against LDAP + * +- * @param resource $cr the LDAP connection ++ * @param resource|\LDAP\Connection $cr the LDAP connection + * @param string $dn + * @param string $attribute + * @param string $filter +@@ -926,7 +926,7 @@ public function fetchListOfUsers(string $filter, array $attr, int $limit = null, + * @throws \Exception + */ + public function batchApplyUserAttributes(array $ldapRecords) { +- $displayNameAttribute = strtolower($this->connection->ldapUserDisplayName); ++ $displayNameAttribute = strtolower((string)$this->connection->ldapUserDisplayName); + foreach ($ldapRecords as $userRecord) { + if (!isset($userRecord[$displayNameAttribute])) { + // displayName is obligatory +@@ -1186,7 +1186,7 @@ private function executeSearch( + /** + * processes an LDAP paged search operation + * +- * @param resource $sr the array containing the LDAP search resources ++ * @param resource|\LDAP\Result|resource[]|\LDAP\Result[] $sr the array containing the LDAP search resources + * @param int $foundItems number of results in the single search operation + * @param int $limit maximum results to be counted + * @param bool $pagedSearchOK whether a paged search has been executed +@@ -1303,7 +1303,7 @@ private function count( + } + + /** +- * @param resource $sr ++ * @param resource|\LDAP\Result|resource[]|\LDAP\Result[] $sr + * @return int + * @throws ServerNotAvailableException + */ +diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php +index 77ae34f9f6c4..6666da1e933c 100644 +--- a/apps/user_ldap/lib/Connection.php ++++ b/apps/user_ldap/lib/Connection.php +@@ -74,6 +74,9 @@ + * @property string ldapMatchingRuleInChainState + */ + class Connection extends LDAPUtility { ++ /** ++ * @var resource|\LDAP\Connection|null ++ */ + private $ldapConnectionRes = null; + private $configPrefix; + private $configID; +@@ -202,7 +205,7 @@ public function init($force = false) { + } + + /** +- * Returns the LDAP handler ++ * @return resource|\LDAP\Connection The LDAP resource + */ + public function getConnectionResource() { + if (!$this->ldapConnectionRes) { +@@ -408,7 +411,7 @@ private function doSoftValidation() { + } + } + +- if ((stripos($this->configuration->ldapHost, 'ldaps://') === 0) ++ if ((stripos((string)$this->configuration->ldapHost, 'ldaps://') === 0) + && $this->configuration->ldapTLS) { + $this->configuration->ldapTLS = false; + $this->logger->info( +@@ -487,7 +490,7 @@ private function doCriticalValidation() { + $configurationOK = false; + } + +- if (mb_strpos($this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8') ++ if (mb_strpos((string)$this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8') + === false) { + $this->logger->warning( + $errorStr.'login filter does not contain %uid place holder.', +diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php +index 744f921c6dd3..9172b5fa25fc 100644 +--- a/apps/user_ldap/lib/Group_LDAP.php ++++ b/apps/user_ldap/lib/Group_LDAP.php +@@ -83,7 +83,7 @@ public function __construct(Access $access, GroupPluginManager $groupPluginManag + $this->cachedNestedGroups = new CappedMemoryCache(); + $this->groupPluginManager = $groupPluginManager; + $this->logger = OC::$server->get(LoggerInterface::class); +- $this->ldapGroupMemberAssocAttr = strtolower($gAssoc); ++ $this->ldapGroupMemberAssocAttr = strtolower((string)$gAssoc); + } + + /** +@@ -202,7 +202,7 @@ public function inGroup($uid, $gid) { + * @throws ServerNotAvailableException + */ + public function getDynamicGroupMembers(string $dnGroup): array { +- $dynamicGroupMemberURL = strtolower($this->access->connection->ldapDynamicGroupMemberURL); ++ $dynamicGroupMemberURL = strtolower((string)$this->access->connection->ldapDynamicGroupMemberURL); + + if (empty($dynamicGroupMemberURL)) { + return []; +@@ -1312,7 +1312,7 @@ public function getGroupDetails($gid) { + * of the current access. + * + * @param string $gid +- * @return resource of the LDAP connection ++ * @return resource|\LDAP\Connection The LDAP connection + * @throws ServerNotAvailableException + */ + public function getNewLDAPConnection($gid) { +diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php +index 3f9bb9013eb4..92a9041949e2 100644 +--- a/apps/user_ldap/lib/Group_Proxy.php ++++ b/apps/user_ldap/lib/Group_Proxy.php +@@ -290,7 +290,7 @@ public function getLDAPAccess($gid) { + * The connection needs to be closed manually. + * + * @param string $gid +- * @return resource of the LDAP connection ++ * @return resource|\LDAP\Connection The LDAP connection + */ + public function getNewLDAPConnection($gid) { + return $this->handleRequest($gid, 'getNewLDAPConnection', [$gid]); +diff --git a/apps/user_ldap/lib/IGroupLDAP.php b/apps/user_ldap/lib/IGroupLDAP.php +index 33636dd8f552..2face1aa9074 100644 +--- a/apps/user_ldap/lib/IGroupLDAP.php ++++ b/apps/user_ldap/lib/IGroupLDAP.php +@@ -36,7 +36,7 @@ public function getLDAPAccess($gid); + /** + * Return a new LDAP connection for the specified group. + * @param string $gid +- * @return resource of the LDAP connection ++ * @return resource|\LDAP\Connection The LDAP connection + */ + public function getNewLDAPConnection($gid); + } +diff --git a/apps/user_ldap/lib/ILDAPWrapper.php b/apps/user_ldap/lib/ILDAPWrapper.php +index c82df09d2345..9917898a001b 100644 +--- a/apps/user_ldap/lib/ILDAPWrapper.php ++++ b/apps/user_ldap/lib/ILDAPWrapper.php +@@ -35,7 +35,7 @@ interface ILDAPWrapper { + + /** + * Bind to LDAP directory +- * @param resource $link LDAP link resource ++ * @param resource|\LDAP\Connection $link LDAP link resource + * @param string $dn an RDN to log in with + * @param string $password the password + * @return bool true on success, false otherwise +@@ -54,7 +54,7 @@ public function connect($host, $port); + + /** + * Send LDAP pagination control +- * @param resource $link LDAP link resource ++ * @param resource|\LDAP\Connection $link LDAP link resource + * @param int $pageSize number of results per page + * @param bool $isCritical Indicates whether the pagination is critical of not. + * @param string $cookie structure sent by LDAP server +@@ -64,8 +64,8 @@ public function controlPagedResult($link, $pageSize, $isCritical); + + /** + * Retrieve the LDAP pagination cookie +- * @param resource $link LDAP link resource +- * @param resource $result LDAP result resource ++ * @param resource|\LDAP\Connection $link LDAP link resource ++ * @param resource|\LDAP\Result $result LDAP result resource + * @param string $cookie structure sent by LDAP server + * @return bool true on success, false otherwise + * +@@ -75,22 +75,22 @@ public function controlPagedResultResponse($link, $result, &$cookie); + + /** + * Count the number of entries in a search +- * @param resource $link LDAP link resource +- * @param resource $result LDAP result resource ++ * @param resource|\LDAP\Connection $link LDAP link resource ++ * @param resource|\LDAP\Result $result LDAP result resource + * @return int|false number of results on success, false otherwise + */ + public function countEntries($link, $result); + + /** + * Return the LDAP error number of the last LDAP command +- * @param resource $link LDAP link resource ++ * @param resource|\LDAP\Connection $link LDAP link resource + * @return int error code + */ + public function errno($link); + + /** + * Return the LDAP error message of the last LDAP command +- * @param resource $link LDAP link resource ++ * @param resource|\LDAP\Connection $link LDAP link resource + * @return string error message + */ + public function error($link); +@@ -106,69 +106,69 @@ public function explodeDN($dn, $withAttrib); + + /** + * Return first result id +- * @param resource $link LDAP link resource +- * @param resource $result LDAP result resource +- * @return Resource an LDAP search result resource ++ * @param resource|\LDAP\Connection $link LDAP link resource ++ * @param resource|\LDAP\Result $result LDAP result resource ++ * @return resource|\LDAP\ResultEntry an LDAP entry resource + * */ + public function firstEntry($link, $result); + + /** + * Get attributes from a search result entry +- * @param resource $link LDAP link resource +- * @param resource $result LDAP result resource ++ * @param resource|\LDAP\Connection $link LDAP link resource ++ * @param resource|\LDAP\ResultEntry $result LDAP result resource + * @return array containing the results, false on error + * */ + public function getAttributes($link, $result); + + /** + * Get the DN of a result entry +- * @param resource $link LDAP link resource +- * @param resource $result LDAP result resource ++ * @param resource|\LDAP\Connection $link LDAP link resource ++ * @param resource|\LDAP\ResultEntry $result LDAP result resource + * @return string containing the DN, false on error + */ + public function getDN($link, $result); + + /** + * Get all result entries +- * @param resource $link LDAP link resource +- * @param resource $result LDAP result resource ++ * @param resource|\LDAP\Connection $link LDAP link resource ++ * @param resource|\LDAP\Result $result LDAP result resource + * @return array containing the results, false on error + */ + public function getEntries($link, $result); + + /** + * Return next result id +- * @param resource $link LDAP link resource +- * @param resource $result LDAP entry result resource +- * @return resource an LDAP search result resource ++ * @param resource|\LDAP\Connection $link LDAP link resource ++ * @param resource|\LDAP\ResultEntry $result LDAP result resource ++ * @return resource|\LDAP\ResultEntry an LDAP entry resource + * */ + public function nextEntry($link, $result); + + /** + * Read an entry +- * @param resource $link LDAP link resource ++ * @param resource|\LDAP\Connection $link LDAP link resource + * @param array $baseDN The DN of the entry to read from + * @param string $filter An LDAP filter + * @param array $attr array of the attributes to read +- * @return resource an LDAP search result resource ++ * @return resource|\LDAP\Result an LDAP search result resource + */ + public function read($link, $baseDN, $filter, $attr); + + /** + * Search LDAP tree +- * @param resource $link LDAP link resource ++ * @param resource|\LDAP\Connection $link LDAP link resource + * @param string $baseDN The DN of the entry to read from + * @param string $filter An LDAP filter + * @param array $attr array of the attributes to read + * @param int $attrsOnly optional, 1 if only attribute types shall be returned + * @param int $limit optional, limits the result entries +- * @return resource|false an LDAP search result resource, false on error ++ * @return resource|\LDAP\Result|false an LDAP search result resource, false on error + */ + public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0); + + /** + * Replace the value of a userPassword by $password +- * @param resource $link LDAP link resource ++ * @param resource|\LDAP\Connection $link LDAP link resource + * @param string $userDN the DN of the user whose password is to be replaced + * @param string $password the new value for the userPassword + * @return bool true on success, false otherwise +@@ -177,7 +177,7 @@ public function modReplace($link, $userDN, $password); + + /** + * Sets the value of the specified option to be $value +- * @param resource $link LDAP link resource ++ * @param resource|\LDAP\Connection $link LDAP link resource + * @param string $option a defined LDAP Server option + * @param int $value the new value for the option + * @return bool true on success, false otherwise +@@ -186,14 +186,14 @@ public function setOption($link, $option, $value); + + /** + * establish Start TLS +- * @param resource $link LDAP link resource ++ * @param resource|\LDAP\Connection $link LDAP link resource + * @return bool true on success, false otherwise + */ + public function startTls($link); + + /** + * Unbind from LDAP directory +- * @param resource $link LDAP link resource ++ * @param resource|\LDAP\Connection $link LDAP link resource + * @return bool true on success, false otherwise + */ + public function unbind($link); +@@ -208,8 +208,8 @@ public function areLDAPFunctionsAvailable(); + + /** + * Checks whether the submitted parameter is a resource +- * @param resource $resource the resource variable to check +- * @return bool true if it is a resource, false otherwise ++ * @param mixed $resource the resource variable to check ++ * @return bool true if it is a resource or LDAP object, false otherwise + */ + public function isResource($resource); + } +diff --git a/apps/user_ldap/lib/IUserLDAP.php b/apps/user_ldap/lib/IUserLDAP.php +index 201bbfd75a22..dfba11c5d343 100644 +--- a/apps/user_ldap/lib/IUserLDAP.php ++++ b/apps/user_ldap/lib/IUserLDAP.php +@@ -37,7 +37,7 @@ public function getLDAPAccess($uid); + /** + * Return a new LDAP connection for the specified user. + * @param string $uid +- * @return resource of the LDAP connection ++ * @return resource|\LDAP\Connection of the LDAP connection + */ + public function getNewLDAPConnection($uid); + +diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php +index 900f5a7030f7..e33facd0889e 100644 +--- a/apps/user_ldap/lib/LDAP.php ++++ b/apps/user_ldap/lib/LDAP.php +@@ -51,19 +51,14 @@ public function __construct(string $logFile = '') { + } + + /** +- * @param resource $link +- * @param string $dn +- * @param string $password +- * @return bool|mixed ++ * {@inheritDoc} + */ + public function bind($link, $dn, $password) { + return $this->invokeLDAPMethod('bind', $link, $dn, $password); + } + + /** +- * @param string $host +- * @param string $port +- * @return mixed ++ * {@inheritDoc} + */ + public function connect($host, $port) { + if (strpos($host, '://') === false) { +@@ -76,6 +71,9 @@ public function connect($host, $port) { + return $this->invokeLDAPMethod('connect', $host); + } + ++ /** ++ * {@inheritDoc} ++ */ + public function controlPagedResultResponse($link, $result, &$cookie): bool { + $this->preFunctionCall( + $this->pagedResultsAdapter->getResponseCallFunc(), +@@ -93,10 +91,7 @@ public function controlPagedResultResponse($link, $result, &$cookie): bool { + } + + /** +- * @param LDAP $link +- * @param int $pageSize +- * @param bool $isCritical +- * @return mixed|true ++ * {@inheritDoc} + */ + public function controlPagedResult($link, $pageSize, $isCritical) { + $fn = $this->pagedResultsAdapter->getRequestCallFunc(); +@@ -116,25 +111,21 @@ public function controlPagedResult($link, $pageSize, $isCritical) { + } + + /** +- * @param LDAP $link +- * @param LDAP $result +- * @return mixed ++ * {@inheritDoc} + */ + public function countEntries($link, $result) { + return $this->invokeLDAPMethod('count_entries', $link, $result); + } + + /** +- * @param LDAP $link +- * @return integer ++ * {@inheritDoc} + */ + public function errno($link) { + return $this->invokeLDAPMethod('errno', $link); + } + + /** +- * @param LDAP $link +- * @return string ++ * {@inheritDoc} + */ + public function error($link) { + return $this->invokeLDAPMethod('error', $link); +@@ -152,56 +143,42 @@ public function explodeDN($dn, $withAttrib) { + } + + /** +- * @param LDAP $link +- * @param LDAP $result +- * @return mixed ++ * {@inheritDoc} + */ + public function firstEntry($link, $result) { + return $this->invokeLDAPMethod('first_entry', $link, $result); + } + + /** +- * @param LDAP $link +- * @param LDAP $result +- * @return array|mixed ++ * {@inheritDoc} + */ + public function getAttributes($link, $result) { + return $this->invokeLDAPMethod('get_attributes', $link, $result); + } + + /** +- * @param LDAP $link +- * @param LDAP $result +- * @return mixed|string ++ * {@inheritDoc} + */ + public function getDN($link, $result) { + return $this->invokeLDAPMethod('get_dn', $link, $result); + } + + /** +- * @param LDAP $link +- * @param LDAP $result +- * @return array|mixed ++ * {@inheritDoc} + */ + public function getEntries($link, $result) { + return $this->invokeLDAPMethod('get_entries', $link, $result); + } + + /** +- * @param LDAP $link +- * @param resource $result +- * @return mixed ++ * {@inheritDoc} + */ + public function nextEntry($link, $result) { + return $this->invokeLDAPMethod('next_entry', $link, $result); + } + + /** +- * @param LDAP $link +- * @param string $baseDN +- * @param string $filter +- * @param array $attr +- * @return mixed ++ * {@inheritDoc} + */ + public function read($link, $baseDN, $filter, $attr) { + $this->pagedResultsAdapter->setReadArgs($link, $baseDN, $filter, $attr); +@@ -209,14 +186,7 @@ public function read($link, $baseDN, $filter, $attr) { + } + + /** +- * @param LDAP $link +- * @param string[] $baseDN +- * @param string $filter +- * @param array $attr +- * @param int $attrsOnly +- * @param int $limit +- * @return mixed +- * @throws \Exception ++ * {@inheritDoc} + */ + public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0) { + $oldHandler = set_error_handler(function ($no, $message, $file, $line) use (&$oldHandler) { +@@ -239,47 +209,35 @@ public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = + } + + /** +- * @param LDAP $link +- * @param string $userDN +- * @param string $password +- * @return bool ++ * {@inheritDoc} + */ + public function modReplace($link, $userDN, $password) { + return $this->invokeLDAPMethod('mod_replace', $link, $userDN, ['userPassword' => $password]); + } + + /** +- * @param LDAP $link +- * @param string $userDN +- * @param string $oldPassword +- * @param string $password +- * @return bool ++ * {@inheritDoc} + */ + public function exopPasswd($link, $userDN, $oldPassword, $password) { + return $this->invokeLDAPMethod('exop_passwd', $link, $userDN, $oldPassword, $password); + } + + /** +- * @param LDAP $link +- * @param string $option +- * @param int $value +- * @return bool|mixed ++ * {@inheritDoc} + */ + public function setOption($link, $option, $value) { + return $this->invokeLDAPMethod('set_option', $link, $option, $value); + } + + /** +- * @param LDAP $link +- * @return mixed|true ++ * {@inheritDoc} + */ + public function startTls($link) { + return $this->invokeLDAPMethod('start_tls', $link); + } + + /** +- * @param resource $link +- * @return bool|mixed ++ * {@inheritDoc} + */ + public function unbind($link) { + return $this->invokeLDAPMethod('unbind', $link); +@@ -294,12 +252,10 @@ public function areLDAPFunctionsAvailable() { + } + + /** +- * Checks whether the submitted parameter is a resource +- * @param Resource $resource the resource variable to check +- * @return bool true if it is a resource, false otherwise ++ * {@inheritDoc} + */ + public function isResource($resource) { +- return is_resource($resource); ++ return is_resource($resource) || is_object($resource); + } + + /** +@@ -368,7 +324,7 @@ private function preFunctionCall($functionName, $args) { + /** + * Analyzes the returned LDAP error and acts accordingly if not 0 + * +- * @param resource $resource the LDAP Connection resource ++ * @param resource|\LDAP\Connection $resource the LDAP Connection resource + * @throws ConstraintViolationException + * @throws ServerNotAvailableException + * @throws \Exception +diff --git a/apps/user_ldap/lib/LDAPProvider.php b/apps/user_ldap/lib/LDAPProvider.php +index dd86ce486ac9..751ebf687684 100644 +--- a/apps/user_ldap/lib/LDAPProvider.php ++++ b/apps/user_ldap/lib/LDAPProvider.php +@@ -149,7 +149,7 @@ public function sanitizeDN($dn) { + * Return a new LDAP connection resource for the specified user. + * The connection must be closed manually. + * @param string $uid user id +- * @return resource of the LDAP connection ++ * @return resource|\LDAP\Connection The LDAP connection + * @throws \Exception if user id was not found in LDAP + */ + public function getLDAPConnection($uid) { +@@ -163,7 +163,7 @@ public function getLDAPConnection($uid) { + * Return a new LDAP connection resource for the specified user. + * The connection must be closed manually. + * @param string $gid group id +- * @return resource of the LDAP connection ++ * @return resource|\LDAP\Connection The LDAP connection + * @throws \Exception if group id was not found in LDAP + */ + public function getGroupLDAPConnection($gid) { +diff --git a/apps/user_ldap/lib/PagedResults/IAdapter.php b/apps/user_ldap/lib/PagedResults/IAdapter.php +index 2dd9ffe80a16..31338126e405 100644 +--- a/apps/user_ldap/lib/PagedResults/IAdapter.php ++++ b/apps/user_ldap/lib/PagedResults/IAdapter.php +@@ -82,7 +82,7 @@ public function getResponseCallArgs(array $originalArgs): array; + /** + * the adapter should do it's LDAP function call and return success state + * +- * @param resource $link LDAP resource ++ * @param resource|\LDAP\Connection $link LDAP resource + * @return bool + */ + public function responseCall($link): bool; +@@ -123,7 +123,7 @@ public function getReadArgs($link): array; + /** + * Returns the current paged results cookie + * +- * @param resource $link LDAP resource ++ * @param resource|\LDAP\Connection $link LDAP resource + * @return string + */ + public function getCookie($link): string; +diff --git a/apps/user_ldap/lib/PagedResults/TLinkId.php b/apps/user_ldap/lib/PagedResults/TLinkId.php +index 6f320705e67e..02c36da97f92 100644 +--- a/apps/user_ldap/lib/PagedResults/TLinkId.php ++++ b/apps/user_ldap/lib/PagedResults/TLinkId.php +@@ -28,10 +28,16 @@ + + trait TLinkId { + public function getLinkId($link) { +- if (is_resource($link)) { ++ if (is_object($link)) { ++ return spl_object_id($link); ++ } elseif (is_resource($link)) { + return (int)$link; +- } elseif (is_array($link) && isset($link[0]) && is_resource($link[0])) { +- return (int)$link[0]; ++ } elseif (is_array($link) && isset($link[0])) { ++ if (is_object($link[0])) { ++ return spl_object_id($link[0]); ++ } elseif (is_resource($link[0])) { ++ return (int)$link[0]; ++ } + } + throw new \RuntimeException('No resource provided'); + } +diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php +index 63af3cf17709..e752b113e3f1 100644 +--- a/apps/user_ldap/lib/User/Manager.php ++++ b/apps/user_ldap/lib/User/Manager.php +@@ -177,7 +177,7 @@ public function getAttributes($minimal = false) { + $this->access->getConnection()->ldapExtStorageHomeAttribute, + ]; + +- $homeRule = $this->access->getConnection()->homeFolderNamingRule; ++ $homeRule = (string)$this->access->getConnection()->homeFolderNamingRule; + if (strpos($homeRule, 'attr:') === 0) { + $attributes[] = substr($homeRule, strlen('attr:')); + } +diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php +index a0955f94bb4f..ab1500ff3689 100644 +--- a/apps/user_ldap/lib/User/User.php ++++ b/apps/user_ldap/lib/User/User.php +@@ -464,9 +464,9 @@ public function updateEmail($valueFromLDAP = null) { + * bytes), '1234 MB' (quota in MB - check the \OC_Helper::computerFileSize method for more info) + * + * fetches the quota from LDAP and stores it as Nextcloud user value +- * @param string $valueFromLDAP the quota attribute's value can be passed, ++ * @param ?string $valueFromLDAP the quota attribute's value can be passed, + * to save the readAttribute request +- * @return null ++ * @return void + */ + public function updateQuota($valueFromLDAP = null) { + if ($this->wasRefreshed('quota')) { +@@ -487,7 +487,7 @@ public function updateQuota($valueFromLDAP = null) { + } elseif (is_array($aQuota) && isset($aQuota[0])) { + $this->logger->debug('no suitable LDAP quota found for user ' . $this->uid . ': [' . $aQuota[0] . ']', ['app' => 'user_ldap']); + } +- } elseif ($this->verifyQuotaValue($valueFromLDAP)) { ++ } elseif (!is_null($valueFromLDAP) && $this->verifyQuotaValue($valueFromLDAP)) { + $quota = $valueFromLDAP; + } else { + $this->logger->debug('no suitable LDAP quota found for user ' . $this->uid . ': [' . $valueFromLDAP . ']', ['app' => 'user_ldap']); +@@ -509,7 +509,7 @@ public function updateQuota($valueFromLDAP = null) { + } + } + +- private function verifyQuotaValue($quotaValue) { ++ private function verifyQuotaValue(string $quotaValue) { + return $quotaValue === 'none' || $quotaValue === 'default' || \OC_Helper::computerFileSize($quotaValue) !== false; + } + +diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php +index b1d4da9514d6..9cd90451ea37 100644 +--- a/apps/user_ldap/lib/User_LDAP.php ++++ b/apps/user_ldap/lib/User_LDAP.php +@@ -617,7 +617,7 @@ public function getLDAPAccess($uid) { + * The cloned connection needs to be closed manually. + * of the current access. + * @param string $uid +- * @return resource of the LDAP connection ++ * @return resource|\LDAP\Connection The LDAP connection + */ + public function getNewLDAPConnection($uid) { + $connection = clone $this->access->getConnection(); +diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php +index 5731f314aede..183c90493cfa 100644 +--- a/apps/user_ldap/lib/User_Proxy.php ++++ b/apps/user_ldap/lib/User_Proxy.php +@@ -368,7 +368,7 @@ public function getLDAPAccess($uid) { + * The connection needs to be closed manually. + * + * @param string $uid +- * @return resource of the LDAP connection ++ * @return resource|\LDAP\Connection The LDAP connection + */ + public function getNewLDAPConnection($uid) { + return $this->handleRequest($uid, 'getNewLDAPConnection', [$uid]); +diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php +index 9b037b471347..98d399b77b94 100644 +--- a/apps/user_ldap/lib/Wizard.php ++++ b/apps/user_ldap/lib/Wizard.php +@@ -820,7 +820,7 @@ private function detectGroupMemberAssoc() { + return false; + } + $er = $this->ldap->firstEntry($cr, $rr); +- while (is_resource($er)) { ++ while ($this->ldap->isResource($er)) { + $this->ldap->getDN($cr, $er); + $attrs = $this->ldap->getAttributes($cr, $er); + $result = []; +@@ -1066,7 +1066,7 @@ private function connectAndBind($port, $tls) { + ['app' => 'user_ldap'] + ); + $cr = $this->ldap->connect($host, $port); +- if (!is_resource($cr)) { ++ if (!$this->ldap->isResource($cr)) { + throw new \Exception(self::$l->t('Invalid Host')); + } + +@@ -1276,7 +1276,7 @@ private function determineFeature($objectclasses, $attr, $dbkey, $confkey, $po = + + /** + * appends a list of values fr +- * @param resource $result the return value from ldap_get_attributes ++ * @param array $result the return value from ldap_get_attributes + * @param string $attribute the attribute values to look for + * @param array &$known new values will be appended here + * @return int, state on of the class constants LRESULT_PROCESSED_OK, + +From 743267eba4bf0558337dcb47f0f8c382f2b25b69 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> +Date: Mon, 29 Nov 2021 11:42:27 +0100 +Subject: [PATCH 07/12] Fix LDAP related docblocks types +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> +--- + apps/user_ldap/lib/ILDAPWrapper.php | 2 +- + lib/public/LDAP/ILDAPProvider.php | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/apps/user_ldap/lib/ILDAPWrapper.php b/apps/user_ldap/lib/ILDAPWrapper.php +index 9917898a001b..3f600a40cc0e 100644 +--- a/apps/user_ldap/lib/ILDAPWrapper.php ++++ b/apps/user_ldap/lib/ILDAPWrapper.php +@@ -147,7 +147,7 @@ public function nextEntry($link, $result); + /** + * Read an entry + * @param resource|\LDAP\Connection $link LDAP link resource +- * @param array $baseDN The DN of the entry to read from ++ * @param string $baseDN The DN of the entry to read from + * @param string $filter An LDAP filter + * @param array $attr array of the attributes to read + * @return resource|\LDAP\Result an LDAP search result resource +diff --git a/lib/public/LDAP/ILDAPProvider.php b/lib/public/LDAP/ILDAPProvider.php +index 0355a0052c41..8fad3bd2266e 100644 +--- a/lib/public/LDAP/ILDAPProvider.php ++++ b/lib/public/LDAP/ILDAPProvider.php +@@ -79,7 +79,7 @@ public function sanitizeDN($dn); + /** + * Return a new LDAP connection resource for the specified user. + * @param string $uid user id +- * @return resource of the LDAP connection ++ * @return \LDAP\Connection|resource + * @since 11.0.0 + */ + public function getLDAPConnection($uid); +@@ -87,7 +87,7 @@ public function getLDAPConnection($uid); + /** + * Return a new LDAP connection resource for the specified group. + * @param string $gid group id +- * @return resource of the LDAP connection ++ * @return \LDAP\Connection|resource + * @since 13.0.0 + */ + public function getGroupLDAPConnection($gid); + +From 72baee96988bbd9d3f7d68a90bf716008946000f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> +Date: Thu, 2 Dec 2021 16:31:19 +0100 +Subject: [PATCH 09/12] Allow minor release of PHP 8.1 to be used as well +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +No reason to allow 8.1.0 and not 8.1.1. + +Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> +--- + lib/versioncheck.php | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/versioncheck.php b/lib/versioncheck.php +index 8aa68dd35fdd..3e840ff5b461 100644 +--- a/lib/versioncheck.php ++++ b/lib/versioncheck.php +@@ -33,10 +33,10 @@ + exit(1); + } + +-// Show warning if > PHP 8.1 is used as Nextcloud is not compatible with > PHP 8.1 for now +-if (PHP_VERSION_ID > 80100) { ++// Show warning if >= PHP 8.2 is used as Nextcloud is not compatible with >= PHP 8.2 for now ++if (PHP_VERSION_ID >= 80200) { + http_response_code(500); +- echo 'This version of Nextcloud is not compatible with > PHP 8.1.<br/>'; ++ echo 'This version of Nextcloud is not compatible with PHP>=8.2.<br/>'; + echo 'You are currently running ' . PHP_VERSION . '.'; + exit(1); + } + +From c3a1a66eaefac9e06385d125dd4edae3117cc9eb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chill...@nextcloud.com> +Date: Thu, 16 Dec 2021 10:35:03 +0100 +Subject: [PATCH 12/12] Avoid deprecation warnings about + libxml_disable_entity_loader in PHP 8.1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Côme Chilliet <come.chill...@nextcloud.com> +--- + lib/private/Updater/ChangesCheck.php | 10 +++++++--- + lib/private/Updater/VersionCheck.php | 10 +++++++--- + 2 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php +index 600c8db9a3c2..e3ced6e5b123 100644 +--- a/lib/private/Updater/ChangesCheck.php ++++ b/lib/private/Updater/ChangesCheck.php +@@ -138,9 +138,13 @@ protected function queryChangesServer(string $uri, ChangesResult $entry): IRespo + protected function extractData($body):array { + $data = []; + if ($body) { +- $loadEntities = libxml_disable_entity_loader(true); +- $xml = @simplexml_load_string($body); +- libxml_disable_entity_loader($loadEntities); ++ if (\LIBXML_VERSION < 20900) { ++ $loadEntities = libxml_disable_entity_loader(true); ++ $xml = @simplexml_load_string($body); ++ libxml_disable_entity_loader($loadEntities); ++ } else { ++ $xml = @simplexml_load_string($body); ++ } + if ($xml !== false) { + $data['changelogURL'] = (string)$xml->changelog['href']; + $data['whatsNew'] = []; +diff --git a/lib/private/Updater/VersionCheck.php b/lib/private/Updater/VersionCheck.php +index ffa707d89909..d9f795796b8c 100644 +--- a/lib/private/Updater/VersionCheck.php ++++ b/lib/private/Updater/VersionCheck.php +@@ -95,9 +95,13 @@ public function check() { + } + + if ($xml) { +- $loadEntities = libxml_disable_entity_loader(true); +- $data = @simplexml_load_string($xml); +- libxml_disable_entity_loader($loadEntities); ++ if (\LIBXML_VERSION < 20900) { ++ $loadEntities = libxml_disable_entity_loader(true); ++ $data = @simplexml_load_string($xml); ++ libxml_disable_entity_loader($loadEntities); ++ } else { ++ $data = @simplexml_load_string($xml); ++ } + if ($data !== false) { + $tmp['version'] = (string)$data->version; + $tmp['versionstring'] = (string)$data->versionstring; Copied: nextcloud/repos/community-testing-any/nextcloud-cron.service (from rev 1106376, nextcloud/trunk/nextcloud-cron.service) =================================================================== --- community-testing-any/nextcloud-cron.service (rev 0) +++ community-testing-any/nextcloud-cron.service 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,9 @@ +[Unit] +Description=Nextcloud; run cron.php + +[Service] +User=nextcloud +ExecStart=/usr/bin/php -f /usr/share/webapps/nextcloud/cron.php + +[Install] +WantedBy=basic.target Copied: nextcloud/repos/community-testing-any/nextcloud-cron.timer (from rev 1106376, nextcloud/trunk/nextcloud-cron.timer) =================================================================== --- community-testing-any/nextcloud-cron.timer (rev 0) +++ community-testing-any/nextcloud-cron.timer 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,9 @@ +[Unit] +Description=Nextcloud; run cron.php periodically + +[Timer] +OnBootSec=5min +OnUnitActiveSec=5min + +[Install] +WantedBy=timers.target \ No newline at end of file Copied: nextcloud/repos/community-testing-any/nextcloud.config.php (from rev 1106376, nextcloud/trunk/nextcloud.config.php) =================================================================== --- community-testing-any/nextcloud.config.php (rev 0) +++ community-testing-any/nextcloud.config.php 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,17 @@ +<?php +$CONFIG = array ( +'datadirectory' => '/var/lib/nextcloud/data', +'logfile' => '/var/log/nextcloud/nextcloud.log', +'apps_paths' => [ + [ + 'path'=> '/usr/share/webapps/nextcloud/apps', + 'url' => '/apps', + 'writable' => false, + ], + [ + 'path'=> '/var/lib/nextcloud/apps', + 'url' => '/wapps', + 'writable' => true, + ], +], +); Copied: nextcloud/repos/community-testing-any/nextcloud.hook (from rev 1106376, nextcloud/trunk/nextcloud.hook) =================================================================== --- community-testing-any/nextcloud.hook (rev 0) +++ community-testing-any/nextcloud.hook 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,13 @@ +# Update Nextcloud when core or -apps are touched + +[Trigger] +Operation = Install +Operation = Upgrade +Type = Package +Target = nextcloud +Target = nextcloud-app-* + +[Action] +Description = Updating Nextcloud installation +When = PostTransaction +Exec = /usr/bin/runuser -u nextcloud -- /usr/bin/php /usr/share/webapps/nextcloud/occ upgrade Copied: nextcloud/repos/community-testing-any/nextcloud.install (from rev 1106376, nextcloud/trunk/nextcloud.install) =================================================================== --- community-testing-any/nextcloud.install (rev 0) +++ community-testing-any/nextcloud.install 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,16 @@ +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + if (( "$(vercmp "$2" '21.0.0-6')" < 0 )); then + printf "WARNING: Major changes introduced to package!\n" + printf " The application is now run as its own user - nextcloud.\n" + printf " Default directories for runtime, state and log files are provided.\n" + printf " A convenience wrapper around occ is provided in /usr/bin/occ.\n" + # directories below /usr/share/webapps/nextcloud are still group-owned by the + # nextcloud user due to nextcloud < 21.0.0 + find /usr/share/webapps/nextcloud -type d -exec chgrp root {} \; + fi + if (( "$(vercmp "$2" '22.0.0-1')" < 0 )); then + printf "NOTE: The application's .htaccess file is now located in /etc/webapps/nextcloud/.\n" + fi +} Copied: nextcloud/repos/community-testing-any/nextcloud.occ.sh (from rev 1106376, nextcloud/trunk/nextcloud.occ.sh) =================================================================== --- community-testing-any/nextcloud.occ.sh (rev 0) +++ community-testing-any/nextcloud.occ.sh 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +readonly default_config="/etc/php/php.ini" +readonly default_php_command="/usr/bin/php" +readonly default_user="nextcloud" +readonly preserved_environment_vars="NEXTCLOUD_CONFIG_DIR" + +config="" +php_command="" +user="" + +check_sudo() { + if ! command -v sudo > /dev/null; then + printf "The sudo command is not available.\n" + exit 1 + fi +} + +# allow overriding the php.ini +if [[ -n "${NEXTCLOUD_PHP_CONFIG}" ]] && [[ -f "${NEXTCLOUD_PHP_CONFIG}" ]]; then + config="${NEXTCLOUD_PHP_CONFIG}" +else + config="${default_config}" +fi + +# allow overriding the php executable +if [[ -n "${NEXTCLOUD_PHP}" ]] && command -v "${NEXTCLOUD_PHP}" > /dev/null; then + php_command="${NEXTCLOUD_PHP}" +else + php_command="${default_php_command}" +fi + +# allow overriding the user to run as +if [[ -n "${NEXTCLOUD_USER}" ]] && id "${NEXTCLOUD_USER}" > /dev/null 2>&1; then + user="${NEXTCLOUD_USER}" +else + user="${default_user}" +fi + +if [[ "${UID}" -eq 0 ]]; then + runuser --whitelist-environment="${preserved_environment_vars}" -u "$user" -- "$php_command" -c "${config}" /usr/share/webapps/nextcloud/occ "$@" +else + check_sudo + sudo --preserve-env="${preserved_environment_vars}" -u "$user" "$php_command" -c "${config}" /usr/share/webapps/nextcloud/occ "$@" +fi Copied: nextcloud/repos/community-testing-any/nextcloud.sysusers (from rev 1106376, nextcloud/trunk/nextcloud.sysusers) =================================================================== --- community-testing-any/nextcloud.sysusers (rev 0) +++ community-testing-any/nextcloud.sysusers 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1 @@ +u nextcloud - "Nextcloud user" - - Copied: nextcloud/repos/community-testing-any/nextcloud.tmpfiles (from rev 1106376, nextcloud/trunk/nextcloud.tmpfiles) =================================================================== --- community-testing-any/nextcloud.tmpfiles (rev 0) +++ community-testing-any/nextcloud.tmpfiles 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,9 @@ +Z /etc/webapps/nextcloud/config - nextcloud nextcloud +z /etc/webapps/nextcloud/.htaccess 0644 nextcloud nextcloud +z /etc/webapps/nextcloud/ 0755 root root +Z %C/nextcloud - nextcloud nextcloud +d %t/nextcloud 0755 nextcloud nextcloud +z %L/nextcloud 0755 nextcloud nextcloud +d %S/nextcloud 0755 nextcloud nextcloud +d %S/nextcloud/apps 0755 nextcloud nextcloud +d %S/nextcloud/data 0770 nextcloud nextcloud Copied: nextcloud/repos/community-testing-any/nextcloud.uwsgi (from rev 1106376, nextcloud/trunk/nextcloud.uwsgi) =================================================================== --- community-testing-any/nextcloud.uwsgi (rev 0) +++ community-testing-any/nextcloud.uwsgi 2022-01-16 16:58:29 UTC (rev 1106377) @@ -0,0 +1,82 @@ +[uwsgi] +procname-master = %n +plugins = php +master = true +socket = /run/%n/%n.sock +# uncomment for a stats socket, that can be used with uwsgitop +# stats = /run/%n/%n-stats.sock +uid = nextcloud +gid = nextcloud +processes = 10 +cheaper = 4 +cheaper-step = 1 +idle = 600 +die-on-idle = true + +; reload whenever this config file changes +touch-reload = %p + +cloud_data_dir = /var/lib/nextcloud/data +cloud_writable_apps_dir = /var/lib/nextcloud/apps +chdir = %(cloud_data_dir) + +php-allowed-ext = .php +php-docroot = /usr/share/webapps/%n +php-index = index.php +php-set = date.timezone=Europe/Berlin +php-set = open_basedir=%(cloud_data_dir):%(cloud_writable_apps_dir):/var/lib/%n:/tmp/:/usr/share/webapps/%n:/etc/webapps/%n:/dev/urandom:/usr/lib/php/modules:/run/redis/redis.sock:/var/log/%n/%n.log:/proc/meminfo +php-set = session.save_path=/tmp +php-set = session.gc_maxlifetime 21600 +php-set = session.gc_divisor 500 +php-set = session.gc_probability 1 +php-set = post_max_size=1000M +php-set = upload_max_filesize=1000M +php-set = always_populate_raw_post_data=-1 +php-set = max_input_time=120 +php-set = max_execution_time=60 +php-set = memory_limit=768M +php-set = zend_extension=opcache +php-set = opcache.enable=1 +php-set = opcache.enable_cli=1 +php-set = opcache.interned_strings_buffer=8 +php-set = opcache.max_accelerated_files=10000 +php-set = opcache.memory_consumption=128 +php-set = opcache.save_comments=1 +php-set = opcache.revalidate_freq=1 + +# uncomment if php-apcu is installed and used +# php-set = extension=apcu +php-set = extension=bcmath +php-set = extension=bz2 +php-set = extension=curl +php-set = extension=exif +php-set = extension=ftp +php-set = extension=gd +php-set = extension=gmp +# uncomment if php-imagick is installed and used +# php-set = extension=imagick +# uncomment if php-imap is installed and used +# php-set = extension=imap +# uncomment if php-intl is installed and used +# php-set = extension=intl +php-set = extension=iconv +php-set = extension=ldap +# uncomment if php-memcached is installed and used +# php-set = extension=memcached +php-set = extension=pdo_mysql +# uncomment if php-pgsql is installed and used +# php-set = extension=pdo_pgsql +php-set = extension=pdo_sqlite +# uncomment if php-igbinary is installed and used +# php-set = extension=igbinary +# uncomment if php-redis is installed and used (requires php-igbinary) +# php-set = extension=redis +php-set = extension=sockets +# uncomment if php-xsl is installed and used +# php-set = extension=xsl +php-set = extension=zip + +# change the URL to your own address and uncomment to run a webcron job every five minutes +# cron = -5 -1 -1 -1 -1 curl --silent https://change.me.tld/cron.php 1>/dev/null +# uncomment to run a cron job every five minutes +# cron = -5 -1 -1 -1 -1 php -f /usr/share/webapps/%n/cron.php