Skip to content

Commit

Permalink
API Update API to reflect changes to CLI interaction (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Sep 26, 2024
1 parent a73d2f8 commit c3550ae
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Tasks/RemoveExpiredShareTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
namespace SilverStripe\ShareDraftContent\Tasks;

use SilverStripe\Dev\BuildTask;
use SilverStripe\PolyExecution\PolyOutput;
use SilverStripe\ShareDraftContent\Models\ShareToken;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;

/**
* Remove expired share tokens.
Expand All @@ -14,13 +17,13 @@
*/
class RemoveExpiredShareTokens extends BuildTask
{
private static $segment = 'RemoveExpiredShareTokens';
protected static string $commandName = 'RemoveExpiredShareTokens';

protected $title = 'Remove expired share tokens';
protected string $title = 'Remove expired share tokens';

protected $description = 'Remove all expired ShareTokens from the database';
protected static string $description = 'Remove all expired ShareTokens from the database';

public function run($request)
protected function execute(InputInterface $input, PolyOutput $output): int
{
$shareTokens = ShareToken::get();
$removeCount = 0;
Expand All @@ -32,6 +35,7 @@ public function run($request)
}
}

echo "Removed $removeCount expired share tokens.\n";
$output->writeln("Removed $removeCount expired share tokens.");
return Command::SUCCESS;
}
}

0 comments on commit c3550ae

Please sign in to comment.