Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCP\Files\InvalidContentException;
use OCP\Files\InvalidPathException;
use OCP\Files\LockNotAcquiredException;
use OCP\Files\NotEnoughSpaceException;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\Storage\IWriteStreamStorage;
Expand Down Expand Up @@ -621,7 +622,7 @@ private function convertToSabreException(\Exception $e) {
if ($e instanceof NotFoundException) {
throw new NotFound($this->l10n->t('File not found: %1$s', [$e->getMessage()]), 0, $e);
}
if ($e instanceof Files\NotEnoughSpaceException) {
if ($e instanceof NotEnoughSpaceException) {
throw new EntityTooLarge($this->l10n->t('Insufficient space'), 0, $e);
}

Expand Down
3 changes: 2 additions & 1 deletion core/Controller/UpdateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\Attribute\PublicPage;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IEventSourceFactory;
Expand All @@ -34,7 +35,7 @@
use Psr\Log\LoggerInterface;

#[OpenAPI(scope: OpenApi::SCOPE_IGNORE)]
class UpdateController extends \OCP\AppFramework\OCSController {
class UpdateController extends OCSController {
public function __construct(
string $appName,
IRequest $request,
Expand Down
2 changes: 1 addition & 1 deletion core/Service/CronService.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private function runCli(string $appMode, ?array $jobClasses): void {
}

// Try to log and unlock job in case of failure (eg. Allowed memory size exhausted)
register_shutdown_function(function () {
register_shutdown_function(function (): void {
$error = error_get_last();
if ($error === null) {
return;
Expand Down
3 changes: 2 additions & 1 deletion lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
use OCP\L10N\IFactory;
use OCP\Server;
use OCP\ServerVersion;
use OCP\Settings\IManager as ISettingsManager;
Expand Down Expand Up @@ -1240,7 +1241,7 @@ public function checkAppDependencies(string $appId, bool $ignoreMax = false): vo

$missing = $this->dependencyAnalyzer->analyze($info, $ignoreMax);
if ($missing !== []) {
$l = \OCP\Server::get(\OCP\L10N\IFactory::class)->get('core');
$l = Server::get(IFactory::class)->get('core');
$missingMsg = implode(PHP_EOL, $missing);
throw new \Exception(
$l->t('App "%1$s" cannot be installed because the following dependencies are not fulfilled: %2$s',
Expand Down
10 changes: 4 additions & 6 deletions lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
use OCP\Files\Cache\CacheEntryInsertedEvent;
use OCP\Files\Cache\CacheEntryRemovedEvent;
use OCP\Files\Cache\CacheEntryUpdatedEvent;
use OCP\Files\Cache\CacheInsertEvent;
use OCP\Files\Cache\CacheUpdateEvent;
use OCP\Files\Cache\ICache;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Config\IUserMountCache;
Expand Down Expand Up @@ -332,7 +330,7 @@ public function insert($file, array $data) {
}

$event = new CacheEntryInsertedEvent($this->storage, $file, $fileId, $storageId);
$this->eventDispatcher->dispatch(CacheInsertEvent::class, $event);
$this->eventDispatcher->dispatch(CacheEntryInsertedEvent::class, $event);
$this->eventDispatcher->dispatchTyped($event);
return $fileId;
}
Expand Down Expand Up @@ -436,7 +434,7 @@ public function update($id, array $data) {
// path can still be null if the file doesn't exist
if ($path !== null) {
$event = new CacheEntryUpdatedEvent($this->storage, $path, $id, $this->getNumericStorageId());
$this->eventDispatcher->dispatch(CacheUpdateEvent::class, $event);
$this->eventDispatcher->dispatch(CacheEntryUpdatedEvent::class, $event);
$this->eventDispatcher->dispatchTyped($event);
}
}
Expand Down Expand Up @@ -850,11 +848,11 @@ public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
$this->eventDispatcher->dispatchTyped(new CacheEntriesRemovedEvent([$event]));

$event = new CacheEntryInsertedEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId());
$this->eventDispatcher->dispatch(CacheInsertEvent::class, $event);
$this->eventDispatcher->dispatch(CacheEntryInsertedEvent::class, $event);
$this->eventDispatcher->dispatchTyped($event);
} else {
$event = new CacheEntryUpdatedEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId());
$this->eventDispatcher->dispatch(CacheUpdateEvent::class, $event);
$this->eventDispatcher->dispatch(CacheEntryUpdatedEvent::class, $event);
$this->eventDispatcher->dispatchTyped($event);
}
Comment on lines 332 to 857
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these changes to be incorrect.
Either the old name is listened to and we cannot change the dispatch, or it’s not and we can remove the dispatch. There is the dispatchTyped already that will dispatch the new name.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I overlooked that. Apparently only Collectives listens to these events, so the easiest solution is to fix Collectives and then remove these event emit calls here:
https://github.com/search?q=org%3ANextcloud+CacheInsertEvent%3A%3Aclass&type=code
https://github.com/search?q=org%3ANextcloud+CacheUpdateEvent%3A%3Aclass&type=code

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The events have also been deprecated for long enough.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else {
Expand Down
5 changes: 3 additions & 2 deletions tests/lib/Files/Storage/Wrapper/QuotaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use OC\Files\Storage\Local;
use OC\Files\Storage\Wrapper\Quota;
use OCP\Files;
use OCP\Files\NotEnoughSpaceException;
use OCP\ITempManager;
use OCP\Server;

Expand Down Expand Up @@ -246,14 +247,14 @@ public function testNoWriteStreamQuota(): void {
$stream = fopen('php://temp', 'w+');
fwrite($stream, 'foobar');
rewind($stream);
$this->expectException(Files\NotEnoughSpaceException::class);
$this->expectException(NotEnoughSpaceException::class);
$instance->writeStream('files/test.txt', $stream);
}

public function testNoWriteStreamQuotaZero(): void {
$instance = $this->getLimitedStorage(0.0);
$stream = fopen('php://temp', 'w+');
$this->expectException(Files\NotEnoughSpaceException::class);
$this->expectException(NotEnoughSpaceException::class);
$instance->writeStream('files/test.txt', $stream);
}
}
Loading