chg: [flood protection] added cleanup

cli-modification-summary
iglocska 2022-02-07 02:14:53 +01:00
parent d45a4dc499
commit c7b226f844
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 4 additions and 2 deletions

View File

@ -94,7 +94,6 @@ class AppController extends Controller
public function beforeFilter(EventInterface $event)
{
//$this->request_ip = Configure::read('')
$this->loadModel('Users');
$this->Users->checkForNewInstance();
$this->authApiUser();
@ -150,6 +149,9 @@ class AppController extends Controller
$this->set('metaGroup', !empty($this->isAdmin) ? 'Administration' : 'Cerebrate');
}
}
if (mt_rand(1, 50) === 1) {
$this->FloodProtection->cleanup();
}
}
private function authApiUser(): void

View File

@ -53,6 +53,6 @@ class FloodProtectionComponent extends Component
public function cleanup(): void
{
$this->FloodProtection->deleteAll(['expiration' < time()]);
$this->FloodProtections->deleteAll(['expiration <' => time()]);
}
}