mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Avoid duplicate loading of hooks
This commit is contained in:
parent
5d741944f7
commit
b517a12f8a
@ -10,10 +10,6 @@ require SYSTEM . 'functions.php';
|
||||
require SYSTEM . 'init.php';
|
||||
require SYSTEM . 'login.php';
|
||||
|
||||
// event system
|
||||
$hooks = new Hooks();
|
||||
$hooks->load();
|
||||
|
||||
if(!admin()) {
|
||||
http_response_code(500);
|
||||
die('Access denied.');
|
||||
|
@ -7,12 +7,7 @@ use Symfony\Component\Console\Command\Command as SymfonyCommand;
|
||||
|
||||
class Command extends SymfonyCommand
|
||||
{
|
||||
protected Hooks $hooks;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->hooks = new Hooks();
|
||||
$this->hooks->load();
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ class CronjobCommand extends Command
|
||||
// Create a new scheduler
|
||||
$scheduler = new Scheduler();
|
||||
|
||||
$this->hooks->trigger(HOOK_CRONJOB, ['scheduler' => $scheduler]);
|
||||
global $hooks;
|
||||
$hooks->trigger(HOOK_CRONJOB, ['scheduler' => $scheduler]);
|
||||
|
||||
// Let the scheduler execute jobs which are due.
|
||||
$scheduler->run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user