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
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"nails/module-cron": "dev-develop",
"nails/module-email": "dev-develop",
"nails/module-form-builder": "dev-develop",
"nails/module-housekeeping": "dev-develop",
"sonata-project/google-authenticator": "~2.3.0",
"wikimedia/common-passwords": "^v0.5",
"lbuchs/webauthn": "^2.2",
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Controller/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ protected function delete(ApiResponse $oApiResponse, Entity $oItem): void
*
* A failure here is logged rather than raised: the row has gone and the
* delete has genuinely succeeded, so there is nothing for the caller to
* retry. It cannot be left silent though - `auth:user:import:clean`
* retry. It cannot be left silent though - `Nails\Auth\Housekeeping\UserImports`
* reaps by walking job rows, so an object orphaned here is unreachable
* by anything else, and the log line is the only thread back to what it
* was for.
Expand Down
261 changes: 0 additions & 261 deletions src/Console/Command/User/Import/Clean.php

This file was deleted.

39 changes: 0 additions & 39 deletions src/Cron/Task/User/Import/Clean.php

This file was deleted.

49 changes: 49 additions & 0 deletions src/Housekeeping/AccessTokens.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace Nails\Auth\Housekeeping;

use Nails\Auth\Constants;
use Nails\Common\Model\Base as ModelBase;
use Nails\Factory;
use Nails\Housekeeping\Routine\Base;
use Nails\Housekeeping\Traits\DeletesModelRows;

class AccessTokens extends Base
{
use DeletesModelRows;

const LABEL = 'API access tokens';
const DESCRIPTION = 'Deletes expired user API access tokens';
const CRON_EXPRESSION = '@daily';

protected function model(): ModelBase
{
return Factory::model('UserAccessToken', Constants::MODULE_SLUG);
}

/**
* @return array<int, mixed>
*/
protected function where(): array
{
/** @var \DateTime $oNow */
$oNow = Factory::factory('DateTime');

return [
['expires <', $oNow->format('Y-m-d H:i:s')],
];
}

/**
* @return string[]
*/
protected function auditColumns(): array
{
return ['id', 'user_id', 'expires'];
}

protected function optimizeAfter(): bool
{
return true;
}
}
Loading
Loading