Commit 08c21062 authored by Michael Iseard's avatar Michael Iseard
Browse files

Minor service refactor

parent e00fa5a2
......@@ -32,11 +32,11 @@ class ActivatorService {
*/
public static function activate( $old_version = null ) {
$logger = LoggerService::factory();
$logger::init();
$logger = new LoggerService();
$logger->init();
$twig = new TwigService();
$twig->initCache();
$twig->init();
self::create_donors_table();
self::create_transactions_table();
self::create_subscriptions_table();
......
......@@ -38,13 +38,17 @@ class LoggerService extends Monolog {
*
* @since 1.0.0
*/
public static function init() {
public function init() {
if ( wp_mkdir_p( self::LOG_DIR ) ) {
Utils::schedule_recurring_action(strtotime( 'tomorrow' ), DAY_IN_SECONDS, 'kudos_clear_log');
$this->info( 'Log directory created successfully' );
Utils::schedule_recurring_action(
strtotime( 'tomorrow' ),
WEEK_IN_SECONDS,
'kudos_clear_log'
);
return;
}
}
/**
......
......@@ -147,7 +147,7 @@ class TwigService extends AbstractService {
*
* @since 2.0.0
*/
public function initCache() {
public function init() {
$logger = $this->logger;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment