1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-23 05:51:14 +01:00

Add onStop method into __destruct()

This commit is contained in:
amir 2023-10-01 21:50:24 +03:30
parent 1ca83568cf
commit 2310da7d39

View File

@ -149,9 +149,6 @@ abstract class EventHandler extends AbstractAPI
$r = $r->await();
}
}
if (\method_exists($this, 'onStop')) {
Shutdown::addCallback([$this, 'onStop']);
}
if ($main) {
$this->setReportPeers($this->getReportPeers());
}
@ -480,4 +477,10 @@ abstract class EventHandler extends AbstractAPI
return $plugins;
}
public function __destruct()
{
if (\method_exists($this, 'onStop')) {
$this->onStop();
}
}
}