Skip to content

Commit 65cea88

Browse files
committed
drush: remove oit:bic command as advban takes care of the cleanup
1 parent 191d058 commit 65cea88

1 file changed

Lines changed: 0 additions & 41 deletions

File tree

src/Commands/OitCommands.php

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -105,47 +105,6 @@ public function sendTeamsAlert($userMessage) {
105105
$this->messenger->addMessage('Teams Alert Sent.');
106106
}
107107

108-
/**
109-
* Clean banned ip's.
110-
*
111-
* @param int $keep
112-
* Number of banned IPs to keep (default: 300).
113-
*
114-
* @command oit:ban-ip-clean
115-
* @aliases oit:bic
116-
*/
117-
public function bannedIpClean($keep = 300) {
118-
$query = $this->database->select('ban_ip', 'b');
119-
$query->fields('b', ['iid']);
120-
$query->orderBy('iid', 'ASC');
121-
$result = $query->execute()->fetchAll();
122-
123-
$count = count($result);
124-
125-
if ($count <= $keep) {
126-
$this->messenger->addMessage('Banned IP\'s are less than the keep value.');
127-
return;
128-
}
129-
130-
$how_many_to_remove = $count - $keep;
131-
132-
$result_remove = [];
133-
$i = 0;
134-
foreach ($result as $row) {
135-
if ($i <= $how_many_to_remove) {
136-
$result_remove[] = $row->iid;
137-
}
138-
$i++;
139-
}
140-
141-
foreach ($result_remove as $row) {
142-
$this->database->delete('ban_ip')
143-
->condition('iid', $row)
144-
->execute();
145-
}
146-
$this->messenger->addMessage('Banned IP\'s cleaned.');
147-
}
148-
149108
/**
150109
* Clean users that haven't accessed the site in over a year.
151110
*

0 commit comments

Comments
 (0)