Ich komme tatsächlich nicht weiter..... vielleicht findet sich aber jemand, der mir auf die Sprünge hilt....
Ladet Euch die jetzige Extension herunter und tauscht noch folgende Dateien aus:
config / services.yml
Code: Alles auswählen
imports:
- { resource: tables.yml }
services:
drdeath.f1webtip.controller:
class: drdeath\f1webtip\controller\main
arguments:
- @config
- @controller.helper
- @template
- @user
drdeath.f1webtip.listener:
class: drdeath\f1webtip\event\main_listener
arguments:
- @controller.helper
- @template
tags:
- { name: event.listener }
cron.task.core.email_reminder:
class: drdeath\f1webtip\cron\task\core\email_reminder
arguments:
- @config
- @controller.helper
- @template
- @user
calls:
- [set_name, [cron.task.core.email_reminder]]
tags:
- { name: cron.task }
cron / task / core / email_reminder.php
Code: Alles auswählen
<?php
/**
*
* @package phpBB Extension - DrDeath F1WebTip
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace drdeath\f1webtip\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
class email_reminder extends \phpbb\cron\task\base
{
/* @var \phpbb\config\config */
protected $config;
/* @var \phpbb\controller\helper */
protected $helper;
/* @var \phpbb\template\template */
protected $template;
/* @var \phpbb\user */
protected $user;
/**
* Constructor
*
* @param \phpbb\config\config $config
* @param \phpbb\controller\helper $helper
* @param \phpbb\template\template $template
* @param \phpbb\user $user
*/
public function __construct(\phpbb\config\config $config, \phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\user $user)
{
$this->config = $config;
$this->helper = $helper;
$this->template = $template;
$this->user = $user;
}
/**
* Runs this cron task.
*
* @return null
*/
public function run()
{
global $db, $user, $auth, $template, $cache, $request;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $phpbb_container, $phpbb_extension_manager, $phpbb_path_helper, $phpbb_log, $datetime, $lang;
// Update the last run timestamp to today (i.e. 6192013 --> 06.19.2013)
$check_time = (int) gmdate('mdY',time());
$this->config->set('drdeath_f1webtip_reminder_last_run', $check_time, true);
//Debug: Reset cron lock
$config->set('cron_lock', '0');
$config->set('drdeath_f1webtip_reminder_last_run', '1', true);
$race_time = time();
$event_stop = date($race_time - $config['drdeath_f1webtip_deadline_offset']);
echo "<br/>Var event_stop = $event_stop <br/>";
echo "<pre>";print_r($user);echo "</pre>";
$b_day = $this->user->format_date($event_stop, 'd');
// Log the cronjob run
add_log('admin', 'LOG_FORMEL_CRON');
return;
}
/**
* Returns whether this cron task can run, given current board configuration.
*
* @return bool
*/
public function is_runnable()
{
return true;
// return (bool) $this->config['drdeath_f1webtip_reminder_enabled'];
}
/**
* Returns whether this cron task should run now, because enough time
* has passed since it was last run.
*
* @return bool
*/
public function should_run()
{
//$check_time = (int) gmdate('mdY',time());
//return $this->config['drdeath_f1webtip_reminder_last_run'] != $check_time;
return true;
}
}
?>
Dann aktiviert ihr die Extension im ACP und setzt folgende Option in
ACP / General / Server settings / Run periodic tasks from system cron: YES
Aktiviert in der config.php noch die DEBUG Ausgabe.
Wenn man jetzt sein lokales Forum mit
http:// localhost / dein_forum / cron.php
aufruft, erscheinen alle Cronjobs, die gerade verfügbar sind.
Beispielausgabe:
[phpBB cron] Running task 'cron.task.core.prune_all_forums' [phpBB cron] Running task 'cron.task.core.email_reminder'
Allerdings scheitere ich beim Versuch eines simplen Befehls:
$event_stop
beinhaltet einen normalen Timestamp, mehr nicht
Fehlermeldung sind:
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/user.php on line 712: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, null given
[phpBB Debug] PHP Notice: in file [ROOT]/phpbb/datetime.php on line 148: Undefined index: datetime
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/datetime.php on line 148: array_filter() expects parameter 1 to be array, null given
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/datetime.php on line 112: strtr(): The second argument is not an array
Anscheinen wird das $user array nicht komplett gefüllt (von mir aus nehme ich auch den User ANONYMOUS....)
Teile vom
$user array
sehen zu diesem Zeitpunkt so aus:
Code: Alles auswählen
phpbb\user Object
(
[lang] => Array
(
)
[help] => Array
(
)
[style] => Array
(
)
[date_format] =>
[timezone] =>
[lang_name] =>
[lang_id] =>
[lang_path] => ./language/
[img_lang] =>
Was habe ich vergessen?
Ich sehe momentan den Wald vor lauter Bäumen nicht ;-(