chg: [flood protection] added cleanup
parent
d45a4dc499
commit
c7b226f844
|
@ -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
|
||||
|
|
|
@ -53,6 +53,6 @@ class FloodProtectionComponent extends Component
|
|||
|
||||
public function cleanup(): void
|
||||
{
|
||||
$this->FloodProtection->deleteAll(['expiration' < time()]);
|
||||
$this->FloodProtections->deleteAll(['expiration <' => time()]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue