mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 13:24:41 +03:00
Add "threadCreate" event
This commit is contained in:
parent
ab942731e6
commit
336d8c1faa
@ -319,6 +319,15 @@ final class Events
|
||||
*/
|
||||
const THREAD_FUNCTION_CALL = 'threadFunctionCall';
|
||||
|
||||
/**
|
||||
* A thread is created.
|
||||
*
|
||||
* This event is triggered after a thread has been created. An associative
|
||||
* array with the following items is passed to the event handlers:
|
||||
* - "thread": an instance of {@link \Mibew\Thread}.
|
||||
*/
|
||||
const THREAD_CREATE = 'threadCreate';
|
||||
|
||||
/**
|
||||
* Thread is updated.
|
||||
*
|
||||
|
@ -601,7 +601,8 @@ class Thread
|
||||
/**
|
||||
* Save the thread to the database
|
||||
*
|
||||
* Triggers {@link \Mibew\EventDispatcher\Events::THREAD_UPDATE} event.
|
||||
* Triggers {@link \Mibew\EventDispatcher\Events::THREAD_UPDATE} and
|
||||
* {@link \Mibew\EventDispatcher\Events::THREAD_CREATE} events.
|
||||
*
|
||||
* @param boolean $update_revision Indicates if last modified time and last
|
||||
* revision should be updated.
|
||||
@ -660,6 +661,9 @@ class Thread
|
||||
)
|
||||
);
|
||||
$this->id = $db->insertedId();
|
||||
|
||||
$args = array('thread' => $this);
|
||||
EventDispatcher::getInstance()->triggerEvent(Events::THREAD_CREATE, $args);
|
||||
} else {
|
||||
// Get the original state of the thread to trigger event later.
|
||||
$original_thread = Thread::load($this->id);
|
||||
|
Loading…
Reference in New Issue
Block a user