diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-08-10 12:55:49 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-08-10 13:41:08 +0200 |
commit | a57a96cbddbfdad65823aeca2901f26b62c9b12d (patch) | |
tree | 22ef0efa2366d64f71f99f38f0403f1ef4ea17db /phpBB/phpbb | |
parent | 7cc9f216e71de8515d5adb8e4fb48e3f6456d689 (diff) | |
download | forums-a57a96cbddbfdad65823aeca2901f26b62c9b12d.tar forums-a57a96cbddbfdad65823aeca2901f26b62c9b12d.tar.gz forums-a57a96cbddbfdad65823aeca2901f26b62c9b12d.tar.bz2 forums-a57a96cbddbfdad65823aeca2901f26b62c9b12d.tar.xz forums-a57a96cbddbfdad65823aeca2901f26b62c9b12d.zip |
[ticket/12932] Add method for getting the datetime class and allow overriding
An extension can now override the datetime class by overwriting the
datetime.class parameter in their own yml file.
PHPBB3-12932
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/user.php | 24 |
2 files changed, 23 insertions, 3 deletions
diff --git a/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php index 6335c75398..58845b88ec 100644 --- a/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php +++ b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php @@ -121,7 +121,7 @@ class soft_delete_mod_convert extends \phpbb\db\migration\migration new \phpbb\auth\auth(), $this->config, $this->db, - new \phpbb\user(), + new \phpbb\user('\phpbb\datetime'), $this->phpbb_root_path, $this->php_ext, $this->table_prefix . 'forums', diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index 4e90044395..40845b75b1 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -31,6 +31,11 @@ class user extends \phpbb\session */ public $timezone; + /** + * @var string Class name of datetime object + */ + protected $datetime; + var $lang_name = false; var $lang_id = false; var $lang_path; @@ -42,12 +47,14 @@ class user extends \phpbb\session /** * Constructor to set the lang path + * @param string $datetime_class Class name of datetime class */ - function __construct() + function __construct($datetime_class) { global $phpbb_root_path; $this->lang_path = $phpbb_root_path . 'language/'; + $this->datetime = $datetime_class; } /** @@ -727,7 +734,7 @@ class user extends \phpbb\session public function create_datetime($time = 'now', \DateTimeZone $timezone = null) { $timezone = $timezone ?: $this->timezone; - return new \phpbb\datetime($this, $time, $timezone); + return new $this->datetime($this, $time, $timezone); } /** @@ -918,4 +925,17 @@ class user extends \phpbb\session return $forum_ids; } + + /** + * Set class name of datetime class + * + * @param string $datetime Class name to set + * @return null + */ + public function set_datetime_class($datetime) + { + $this->datetime = $datetime; + } + + } |