Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
listen to proper event type and do not use deprecated method
Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz committed Dec 17, 2019
commit bc63be6900340606b89b9bf72cd6e5b1a604972f
2 changes: 1 addition & 1 deletion appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
*
*/

$app = new \OCA\WorkflowPDFConverter\AppInfo\Application();
$app = \OC::$server->query(\OCA\WorkflowPDFConverter\AppInfo\Application::class);
10 changes: 7 additions & 3 deletions lib/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
use OCA\WorkflowEngine\Entity\File;
use OCA\WorkflowPDFConverter\BackgroundJobs\Convert;
use OCP\BackgroundJob\IJobList;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\Folder;
use OCP\Files\Node;
use OCP\IL10N;
use OCP\WorkflowEngine\IRuleMatcher;
use OCP\WorkflowEngine\ISpecificOperation;
use Symfony\Component\EventDispatcher\GenericEvent;

class Operation implements ISpecificOperation {

Expand Down Expand Up @@ -78,7 +79,10 @@ public function isAvailableForScope(int $scope): bool {
return true;
}

public function onEvent(string $eventName, GenericEvent $event, IRuleMatcher $ruleMatcher): void {
public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatcher): void {
if(!$event instanceof GenericEvent) {
return;
}
try {
if($eventName === '\OCP\Files::postRename') {
/** @var Node $oldNode */
Expand All @@ -103,7 +107,7 @@ public function onEvent(string $eventName, GenericEvent $event, IRuleMatcher $ru
return;
}

$matches = $ruleMatcher->getMatchingOperations(Operation::class, false);
$matches = $ruleMatcher->getFlows(false);
$originalFileMode = $targetPdfMode = null;
foreach($matches as $match) {
$fileModes = explode(';', $match['operation']);
Expand Down