mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-07 16:24:43 +03:00
Add "banDelete" event
This commit is contained in:
parent
6263f3a2f4
commit
7eea7c09d4
@ -180,6 +180,8 @@ class Ban
|
||||
|
||||
/**
|
||||
* Remove ban from the database.
|
||||
*
|
||||
* Triggers {@link \Mibew\EventDispatcher\Events::BAN_DELETE} event.
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
@ -187,11 +189,13 @@ class Ban
|
||||
throw new \RuntimeException('You cannot delete a ban without id');
|
||||
}
|
||||
|
||||
$db = Database::getInstance();
|
||||
$db->query(
|
||||
Database::getInstance()->query(
|
||||
"DELETE FROM {ban} WHERE banid = :id LIMIT 1",
|
||||
array(':id' => $this->id)
|
||||
);
|
||||
|
||||
$args = array('id' => $this->id);
|
||||
EventDispatcher::getInstance()->triggerEvent(Events::BAN_DELETE, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,6 +33,15 @@ final class Events
|
||||
*/
|
||||
const BAN_CREATE = 'banCreate';
|
||||
|
||||
/**
|
||||
* A ban is deleted.
|
||||
*
|
||||
* This event is triggered after a ban has been deleted. An associative
|
||||
* array with the following items is passed to the event handlers:
|
||||
* - "id": int, deleted ban ID.
|
||||
*/
|
||||
const BAN_DELETE = 'banDelete';
|
||||
|
||||
/**
|
||||
* Cron is run.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user