/** * Test clear() * * @since 1.0.0 */ public function test_clear() { $log = ac_get_logger(); $log->add('unit-tests', 'this is a message'); $log->clear('unit-tests'); $this->assertEquals('', $this->read_content('unit-tests')); }
/** * Push all needed DB updates to the queue for processing. */ private static function update() { $current_db_version = get_option('axiscomposer_db_version'); $logger = ac_get_logger(); $update_queued = false; foreach (self::$db_updates as $version => $update_callbacks) { if (version_compare($current_db_version, $version, '<')) { foreach ($update_callbacks as $update_callback) { $logger->add('ac_db_updates', sprintf('Queuing %s - %s', $version, $update_callback)); self::$background_updater->push_to_queue($update_callback); $update_queued = true; } } } if ($update_queued) { self::$background_updater->save()->dispatch(); } }
/** * Remove/delete the chosen file. */ public static function remove_log() { if (empty($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'], 'remove_log')) { wp_die(__('Action failed. Please refresh the page and retry.', 'axiscomposer')); } if (!empty($_REQUEST['handle'])) { $logger = ac_get_logger(); $logger->remove($_REQUEST['handle']); } wp_safe_redirect(esc_url_raw(admin_url('admin.php?page=ac-status&tab=logs'))); exit; }
/** * Complete * * Override if applicable, but ensure that the below actions are * performed, or, call parent::complete(). */ protected function complete() { $logger = ac_get_logger(); $logger->add('ac_db_updates', 'Data update complete'); AC_Install::update_db_version(); parent::complete(); }