diff options
-rw-r--r-- | apps/admin_audit/lib/Actions/Sharing.php | 2 | ||||
-rw-r--r-- | apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php | 10 | ||||
-rw-r--r-- | apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php | 14 | ||||
-rw-r--r-- | apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php | 6 | ||||
-rw-r--r-- | composer.json | 1 | ||||
-rw-r--r-- | composer.lock | 3 | ||||
-rw-r--r-- | lib/composer/composer/InstalledVersions.php | 299 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 8 | ||||
-rw-r--r-- | lib/composer/composer/installed.php | 24 | ||||
-rw-r--r-- | lib/private/Comments/Manager.php | 6 | ||||
-rw-r--r-- | lib/private/legacy/OC_User.php | 12 |
11 files changed, 360 insertions, 25 deletions
diff --git a/apps/admin_audit/lib/Actions/Sharing.php b/apps/admin_audit/lib/Actions/Sharing.php index 472e4203110..ad233047677 100644 --- a/apps/admin_audit/lib/Actions/Sharing.php +++ b/apps/admin_audit/lib/Actions/Sharing.php @@ -322,7 +322,7 @@ class Sharing extends Action { public function updateExpirationDate(array $params): void { if ($params['date'] === null) { $this->log( - 'The expiration date of the publicly shared %s with ID "%s" has been changed removed', + 'The expiration date of the publicly shared %s with ID "%s" has been removed', $params, [ 'itemType', diff --git a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php index 0e6e76d3927..2978863da88 100644 --- a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php +++ b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php @@ -82,7 +82,7 @@ class EnablePluginTest extends TestCase { $plugin = new EnablePlugin($this->config, $this->birthdayService); - $server->expects($this->at(0)) + $server->expects($this->once()) ->method('on') ->with('method:POST', [$plugin, 'httpPost']); @@ -120,11 +120,11 @@ class EnablePluginTest extends TestCase { ->with('/bar/foo') ->willReturn($calendarHome); - $this->request->expects($this->at(0)) + $this->request->expects($this->once()) ->method('getBodyAsString') ->willReturn('<nc:disable-birthday-calendar xmlns:nc="http://nextcloud.com/ns"/>'); - $this->request->expects($this->at(1)) + $this->request->expects($this->once()) ->method('getUrl') ->willReturn('url_abc'); @@ -158,11 +158,11 @@ class EnablePluginTest extends TestCase { ->method('getOwner') ->willReturn('principals/users/BlaBlub'); - $this->request->expects($this->at(0)) + $this->request->expects($this->once()) ->method('getBodyAsString') ->willReturn('<nc:enable-birthday-calendar xmlns:nc="http://nextcloud.com/ns"/>'); - $this->request->expects($this->at(1)) + $this->request->expects($this->once()) ->method('getUrl') ->willReturn('url_abc'); diff --git a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php index d1fc2c32f28..f017664238c 100644 --- a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php +++ b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php @@ -96,15 +96,13 @@ class BirthdayCalendarControllerTest extends TestCase { $closure($user3); }); - $this->jobList->expects($this->at(0)) + $this->jobList->expects($this->exactly(3)) ->method('add') - ->with(GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid1']); - $this->jobList->expects($this->at(1)) - ->method('add') - ->with(GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid2']); - $this->jobList->expects($this->at(2)) - ->method('add') - ->with(GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid3']); + ->withConsecutive( + [GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid1']], + [GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid2']], + [GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid3']], + ); $response = $this->controller->enable(); $this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $response); diff --git a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php index 52c99fad2ee..639708c57ff 100644 --- a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php +++ b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php @@ -62,7 +62,7 @@ class RegenerateBirthdayCalendarsTest extends TestCase { } public function testRun() { - $this->config->expects($this->at(0)) + $this->config->expects($this->once()) ->method('getAppValue') ->with('dav', 'regeneratedBirthdayCalendarsForYearFix') ->willReturn(null); @@ -72,11 +72,11 @@ class RegenerateBirthdayCalendarsTest extends TestCase { ->method('info') ->with('Adding background jobs to regenerate birthday calendar'); - $this->jobList->expects($this->at(0)) + $this->jobList->expects($this->once()) ->method('add') ->with(RegisterRegenerateBirthdayCalendars::class); - $this->config->expects($this->at(1)) + $this->config->expects($this->once()) ->method('setAppValue') ->with('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes'); diff --git a/composer.json b/composer.json index 51762b84098..ff94ef05d7f 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,7 @@ "require": { "ext-json": "*", "ext-libxml": "*", + "ext-mbstring": "*", "ext-pdo": "*", "ext-simplexml": "*", "ext-xmlreader": "*", diff --git a/composer.lock b/composer.lock index 88c8b05fe0c..e5bcbda1a15 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9e703ab133e8363e26a67dbd639a297c", + "content-hash": "fd5e442ed41b3a7ebb1c53c30467e7e7", "packages": [], "packages-dev": [ { @@ -3030,6 +3030,7 @@ "platform": { "ext-json": "*", "ext-libxml": "*", + "ext-mbstring": "*", "ext-pdo": "*", "ext-simplexml": "*", "ext-xmlreader": "*", diff --git a/lib/composer/composer/InstalledVersions.php b/lib/composer/composer/InstalledVersions.php new file mode 100644 index 00000000000..a8a60673673 --- /dev/null +++ b/lib/composer/composer/InstalledVersions.php @@ -0,0 +1,299 @@ +<?php + + + + + + + + + + + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + + + + + + + + +class InstalledVersions +{ +private static $installed = array ( + 'root' => + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '619b35b480a2d348436156a2a6144895b00b1e07', + 'name' => '__root__', + ), + 'versions' => + array ( + '__root__' => + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '619b35b480a2d348436156a2a6144895b00b1e07', + ), + ), +); +private static $canGetVendors; +private static $installedByVendor = array(); + + + + + + + +public static function getInstalledPackages() +{ +$packages = array(); +foreach (self::getInstalled() as $installed) { +$packages[] = array_keys($installed['versions']); +} + +if (1 === \count($packages)) { +return $packages[0]; +} + +return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); +} + + + + + + + + + +public static function isInstalled($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (isset($installed['versions'][$packageName])) { +return true; +} +} + +return false; +} + + + + + + + + + + + + + + +public static function satisfies(VersionParser $parser, $packageName, $constraint) +{ +$constraint = $parser->parseConstraints($constraint); +$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + +return $provided->matches($constraint); +} + + + + + + + + + + +public static function getVersionRanges($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +$ranges = array(); +if (isset($installed['versions'][$packageName]['pretty_version'])) { +$ranges[] = $installed['versions'][$packageName]['pretty_version']; +} +if (array_key_exists('aliases', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); +} +if (array_key_exists('replaced', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); +} +if (array_key_exists('provided', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); +} + +return implode(' || ', $ranges); +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getVersion($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['version'])) { +return null; +} + +return $installed['versions'][$packageName]['version']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getPrettyVersion($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['pretty_version'])) { +return null; +} + +return $installed['versions'][$packageName]['pretty_version']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getReference($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['reference'])) { +return null; +} + +return $installed['versions'][$packageName]['reference']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getRootPackage() +{ +$installed = self::getInstalled(); + +return $installed[0]['root']; +} + + + + + + + + +public static function getRawData() +{ +@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + +return self::$installed; +} + + + + + + + +public static function getAllRawData() +{ +return self::getInstalled(); +} + + + + + + + + + + + + + + + + + + + +public static function reload($data) +{ +self::$installed = $data; +self::$installedByVendor = array(); +} + + + + + +private static function getInstalled() +{ +if (null === self::$canGetVendors) { +self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); +} + +$installed = array(); + +if (self::$canGetVendors) { +foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { +if (isset(self::$installedByVendor[$vendorDir])) { +$installed[] = self::$installedByVendor[$vendorDir]; +} elseif (is_file($vendorDir.'/composer/installed.php')) { +$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; +} +} +} + +$installed[] = self::$installed; + +return $installed; +} +} diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 1af3458d999..698cbc3cfae 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -7,7 +7,7 @@ namespace Composer\Autoload; class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c { public static $prefixLengthsPsr4 = array ( - 'O' => + 'O' => array ( 'OC\\Core\\' => 8, 'OC\\' => 3, @@ -16,15 +16,15 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c ); public static $prefixDirsPsr4 = array ( - 'OC\\Core\\' => + 'OC\\Core\\' => array ( 0 => __DIR__ . '/../../..' . '/core', ), - 'OC\\' => + 'OC\\' => array ( 0 => __DIR__ . '/../../..' . '/lib/private', ), - 'OCP\\' => + 'OCP\\' => array ( 0 => __DIR__ . '/../../..' . '/lib/public', ), diff --git a/lib/composer/composer/installed.php b/lib/composer/composer/installed.php new file mode 100644 index 00000000000..08d6e91e111 --- /dev/null +++ b/lib/composer/composer/installed.php @@ -0,0 +1,24 @@ +<?php return array ( + 'root' => + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '619b35b480a2d348436156a2a6144895b00b1e07', + 'name' => '__root__', + ), + 'versions' => + array ( + '__root__' => + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '619b35b480a2d348436156a2a6144895b00b1e07', + ), + ), +); diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 8cd8fc57b3d..beaab9535ac 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -655,16 +655,16 @@ class Manager implements ICommentsManager { $query->andWhere($query->expr()->eq('c.verb', $query->createNamedParameter($verb))); } + $unreadComments = array_fill_keys($objectIds, 0); foreach (array_chunk($objectIds, 1000) as $chunk) { $query->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY); - $result = $query->execute(); - $unreadComments += array_fill_keys($objectIds, 0); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $unreadComments[$row['object_id']] = (int) $row['num_comments']; } + $result->closeCursor(); } - $result->closeCursor(); return $unreadComments; } diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php index c8d9b51eaba..3638a32589d 100644 --- a/lib/private/legacy/OC_User.php +++ b/lib/private/legacy/OC_User.php @@ -36,7 +36,10 @@ * */ +use OCP\EventDispatcher\IEventDispatcher; use OCP\ILogger; +use OCP\IUserManager; +use OCP\User\Events\UserLoggedInEvent; /** * This class provides wrapper methods for user management. Multiple backends are @@ -186,6 +189,15 @@ class OC_User { 'isTokenLogin' => false, ] ); + /** @var IEventDispatcher $dispatcher */ + $dispatcher = \OC::$server->get(IEventDispatcher::class); + $dispatcher->dispatchTyped(new UserLoggedInEvent( + \OC::$server->get(IUserManager::class)->get($uid), + $uid, + '', + false) + ); + //trigger creation of user home and /files folder \OC::$server->getUserFolder($uid); } |