* @param string $name Service name
* @param Preferences $preferences Preferences instance
*
- * @return void
+ * @return bool
*/
- public function logCron($name, Preferences $preferences)
- {
- //known cronable files
- $ok = array('reminder');
-
- if (in_array($name, $ok)) {
- $this->logged = true;
- $this->cron = true;
- $this->login = 'cron';
- $this->lang = $preferences->pref_lang;
- } else {
- trigger_error('Not authorized!', E_USER_ERROR);
- }
- }
+ abstract public function logCron(string $name, Preferences $preferences): bool;
/**
* Log out user and unset variables
$this->impersonated = false;
}
+ /**
+ * Authenticate from cron
+ *
+ * @param string $name Service name
+ * @param Preferences $preferences Preferences instance
+ *
+ * @return bool
+ */
+ public function logCron(string $name, Preferences $preferences): bool
+ {
+ //known cronable files
+ $ok = array('reminder');
+
+ if (in_array($name, $ok)) {
+ $this->logged = true;
+ $this->cron = true;
+ $this->login = 'cron';
+ $this->name = 'cron';
+ $this->lang = $preferences->pref_lang;
+ $this->i18n->changeLanguage($this->lang);
+ return true;
+ } else {
+ trigger_error('Not authorized!', E_USER_ERROR);
+ }
+ }
+
/**
* Log out user and unset variables
*