]> git.agnieray.net Git - galette.git/commitdiff
Fix reminders con; check for db update, fix cron login
authorJohan Cwiklinski <jcwiklinski@teclib.com>
Mon, 27 Jan 2020 17:01:33 +0000 (18:01 +0100)
committerJohan Cwiklinski <jcwiklinski@teclib.com>
Mon, 27 Jan 2020 17:01:33 +0000 (18:01 +0100)
galette/cron/reminder.php
galette/includes/galette.inc.php
galette/lib/Galette/Repository/Reminders.php

index f6b853f983f1f0f519622ba3d51422d4ee297e10..bddc7d177b3d50d32b045b425fe88cb46435fda6 100644 (file)
@@ -52,8 +52,18 @@ $app = new \Slim\App(
 session_start();
 require_once __DIR__ . '/../includes/dependencies.php';
 
+if (isset($needs_update) && $needs_update === true) {
+    echo _T("Your Galette database is not present, or not up to date.");
+    die(1);
+}
+
+/** TODO: login is now handled in dependencies.php; the cron case should be aswell */
+if ($cron) {
+    $container->get('login')->logCron(basename($argv[0], '.php'));
+}
+
 if (!$container->get('login')->isCron()) {
-    die();
+    die(1);
 }
 
 $texts = new Texts(
@@ -67,7 +77,7 @@ $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, $container->get('hist'), $container->get('zdb'));
+        $sent = $reminder->send($texts, $container->get('history'), $container->get('zdb'));
 
         if ($sent === true) {
             $success_detected[] = $reminder->getMessage();
index ce1ba9eefde8d9f0c2c0440caba62232a5220d05..85a1f7655e93ed6739b23b2843b7e3589ed5ebae 100644 (file)
@@ -48,7 +48,7 @@ if (version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<')) {
     echo 'Galette is NOT compliant with your current PHP version. ' .
         'Galette requires PHP ' . GALETTE_PHP_MIN  .
         ' minimum and current version is ' . phpversion();
-    die();
+    die(1);
 }
 
 $time_start = microtime(true);
@@ -251,11 +251,6 @@ if (!$installer and !defined('GALETTE_TESTS')) {
                 'themes/' . $preferences->pref_theme . '/'
             );
         }
-
-        /** TODO: login is now handled in dependencies.php; the cron case should be aswell */
-        if ($cron) {
-            $container->get('login')->logCron(basename($argv[0], '.php'));
-        }
     } else {
         $needs_update = true;
     }
index 4024c09282e468c4e5a64653b03450c6dbf78056..20cda1647bc3e33df748c3fbd63ec46a7b26e7f0 100644 (file)
@@ -70,7 +70,7 @@ class Reminders
      *
      * @param array $selected Selected types for sending
      */
-    public function __construct($selected)
+    public function __construct($selected = null)
     {
         if (isset($selected) && is_array($selected)) {
             $this->selected = array_map('intval', $selected);