Merge pull request #56717 from nextcloud/enh/noid/taskpro-optional-watermarking
Add a boolean 'addWatermarking' attribute to taskprocessing taskspull/56746/head
commit
3da9905c8f
@ -0,0 +1,46 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
||||
* SPDX-License-Identifier: AGPL-3.0-or-later |
||||
*/ |
||||
namespace OC\Core\Migrations; |
||||
|
||||
use Closure; |
||||
use OCP\DB\ISchemaWrapper; |
||||
use OCP\DB\Types; |
||||
use OCP\Migration\Attributes\AddColumn; |
||||
use OCP\Migration\Attributes\ColumnType; |
||||
use OCP\Migration\IOutput; |
||||
use OCP\Migration\SimpleMigrationStep; |
||||
|
||||
#[AddColumn(table: 'taskprocessing_tasks', name: 'include_watermark', type: ColumnType::SMALLINT)] |
||||
class Version33000Date20251126152410 extends SimpleMigrationStep { |
||||
|
||||
/** |
||||
* @param IOutput $output |
||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
||||
* @param array $options |
||||
* @return null|ISchemaWrapper |
||||
*/ |
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
||||
/** @var ISchemaWrapper $schema */ |
||||
$schema = $schemaClosure(); |
||||
|
||||
if ($schema->hasTable('taskprocessing_tasks')) { |
||||
$table = $schema->getTable('taskprocessing_tasks'); |
||||
if (!$table->hasColumn('include_watermark')) { |
||||
$table->addColumn('include_watermark', Types::SMALLINT, [ |
||||
'notnull' => true, |
||||
'default' => 1, |
||||
'unsigned' => true, |
||||
]); |
||||
return $schema; |
||||
} |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
} |
||||
@ -0,0 +1,35 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
||||
* SPDX-License-Identifier: AGPL-3.0-or-later |
||||
*/ |
||||
|
||||
|
||||
namespace OCP\TaskProcessing; |
||||
|
||||
use OCP\Files\File; |
||||
use OCP\TaskProcessing\Exception\ProcessingException; |
||||
|
||||
/** |
||||
* This is the interface that is implemented by apps that |
||||
* implement a task processing provider that supports watermarking |
||||
* @since 33.0.0 |
||||
*/ |
||||
interface ISynchronousWatermarkingProvider extends ISynchronousProvider { |
||||
|
||||
/** |
||||
* Returns the shape of optional output parameters |
||||
* |
||||
* @param null|string $userId The user that created the current task |
||||
* @param array<string, list<numeric|string|File>|numeric|string|File> $input The task input |
||||
* @param callable(float):bool $reportProgress Report the task progress. If this returns false, that means the task was cancelled and processing should be stopped. |
||||
* @param bool $includeWatermark Whether to include the watermark in the output files or not |
||||
* @psalm-return array<string, list<numeric|string>|numeric|string> |
||||
* @throws ProcessingException |
||||
* @since 33.0.0 |
||||
*/ |
||||
public function process(?string $userId, array $input, callable $reportProgress, bool $includeWatermark = true): array; |
||||
} |
||||
Loading…
Reference in new issue