2023-11-29 13:05:35 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
/**
|
2024-06-02 09:26:54 -04:00
|
|
|
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2023-11-29 13:05:35 -05:00
|
|
|
*/
|
|
|
|
|
namespace OCA\Files_Trashbin\Events;
|
|
|
|
|
|
2026-03-18 09:46:54 -04:00
|
|
|
use OCP\Exceptions\AbortedEventException;
|
2023-11-29 13:05:35 -05:00
|
|
|
use OCP\Files\Events\Node\AbstractNodesEvent;
|
|
|
|
|
use OCP\Files\Node;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 28.0.0
|
|
|
|
|
*/
|
|
|
|
|
class BeforeNodeRestoredEvent extends AbstractNodesEvent {
|
|
|
|
|
public function __construct(
|
|
|
|
|
Node $source,
|
|
|
|
|
Node $target,
|
|
|
|
|
private bool &$run,
|
|
|
|
|
) {
|
|
|
|
|
parent::__construct($source, $target);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-03-18 09:46:54 -04:00
|
|
|
* @since 28.0.0
|
|
|
|
|
* @deprecated 29.0.0 - use OCP\Exceptions\AbortedEventException instead
|
2023-11-29 13:05:35 -05:00
|
|
|
*/
|
2024-03-28 11:13:19 -04:00
|
|
|
public function abortOperation(?\Throwable $ex = null) {
|
2026-03-18 09:46:54 -04:00
|
|
|
throw new AbortedEventException($ex?->getMessage() ?? 'Operation aborted');
|
2023-11-29 13:05:35 -05:00
|
|
|
}
|
|
|
|
|
}
|