]> git.agnieray.net Git - galette.git/commitdiff
Cron script was not using DI; fixes #1384
authorJohan Cwiklinski <jcwiklinski@teclib.com>
Sun, 26 Jan 2020 07:16:04 +0000 (08:16 +0100)
committerJohan Cwiklinski <jcwiklinski@teclib.com>
Sun, 26 Jan 2020 07:24:14 +0000 (08:24 +0100)
galette/cron/reminder.php
galette/includes/galette.inc.php

index dae53f963d77f858c4523168293c113fe550ad46..631e02784197f2696ec9c7fa3240689be57a3431 100644 (file)
@@ -41,22 +41,24 @@ use Galette\Repository\Reminders;
 use Galette\Filters\MembersList;
 
 /** @ignore */
-require_once '../includes/galette.inc.php';
+require_once __DIR__ . '/../includes/galette.inc.php';
 
 if (!$login->isCron()) {
     die();
 }
 
-//FIXME: connect this script to the DI, or instanciate what is required.
-$texts = new Texts($texts_fields, $preferences);
+$texts = new Texts(
+    $container->get('texts_fields'),
+    $container->get('preferences')
+);
 $reminders = new Reminders();
 
 
-$list_reminders = $reminders->getList($zdb, false);
+$list_reminders = $reminders->getList($container->get('zdb'), false);
 if (count($list_reminders) > 0) {
     foreach ($list_reminders as $reminder) {
         //send reminders by mail
-        $sent = $reminder->send($texts, $hist, $zdb);
+        $sent = $reminder->send($texts, $container->get('hist'), $container->get('zdb'));
 
         if ($sent === true) {
             $success_detected[] = $reminder->getMessage();
index 439a2e53ce7e5a4f86d0044dbd255fd559d27b17..ce1ba9eefde8d9f0c2c0440caba62232a5220d05 100644 (file)
@@ -254,7 +254,7 @@ if (!$installer and !defined('GALETTE_TESTS')) {
 
         /** TODO: login is now handled in dependencies.php; the cron case should be aswell */
         if ($cron) {
-            $login->logCron(basename($argv[0], '.php'));
+            $container->get('login')->logCron(basename($argv[0], '.php'));
         }
     } else {
         $needs_update = true;