PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 5.0.3.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v5.0.3.2
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
mainwp / modules / common / class-module-log.php

class-module-log.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 5.0.3.2, at modules/common/class-module-log.php

79 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Module Logs class loading.
4 *
5 * @package MainWP\Dashboard\Module\Log
6 * @version 4.5.1
7 */
8
9 namespace MainWP\Dashboard\Module\Log;
10
11 use MainWP\Dashboard\MainWP_Includes;
12
13 defined( 'ABSPATH' ) || exit;
14
15 /**
16 * Logs class.
17 */
18 class MainWP_Module_Log {
19 /**
20 * Load required files and hooks to make the CLI work.
21 */
22 public function __construct() {
23 $this->includes();
24 add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
25 add_filter( 'mainwp_init_load_all_options', array( $this, 'hook_load_options' ) );
26 add_action( 'mainwp_system_init', array( $this, 'hook_mainwp_system_init' ) );
27 }
28
29 /**
30 * Init method.
31 */
32 public function plugins_loaded() {
33 if ( class_exists( '\MainWP\Dashboard\Module\Log\Log_Install' ) ) {
34 Log_Install::instance()->install();
35 }
36 }
37
38 /**
39 * Load files.
40 */
41 private function includes() {
42 $dir = MAINWP_MODULES_DIR;
43 // need to load log db install.
44 if ( file_exists( $dir . 'logs/classes/class-log-install.php' ) ) {
45 require_once $dir . 'logs/classes/class-log-install.php';
46 }
47 if ( mainwp_modules_is_enabled( 'logs' ) ) {
48 if ( file_exists( $dir . 'logs/classes/class-log-manager.php' ) ) {
49 require_once $dir . 'logs/classes/class-log-manager.php';
50 }
51 }
52 }
53
54 /**
55 * Handle mainwp system init load options.
56 *
57 * @param array $all_opts All loading mainwp options.
58 * @return array $all_opts All loading mainwp options.
59 */
60 public function hook_load_options( $all_opts ) {
61 if ( is_array( $all_opts ) ) {
62 $all_opts[] = 'mainwp_module_log_last_time_auto_purge_logs';
63 $all_opts[] = 'mainwp_module_log_next_time_auto_purge_logs';
64 }
65 return $all_opts;
66 }
67
68 /**
69 * Handle mainwp system init.
70 */
71 public function hook_mainwp_system_init() {
72 if ( mainwp_modules_is_enabled( 'logs' ) && class_exists( '\MainWP\Dashboard\Module\Log\Log_Manager' ) ) {
73 Log_Manager::instance();
74 }
75 }
76 }
77
78 new MainWP_Module_Log();
79