PluginProbe ʕ •ᴥ•ʔ
Backup Migration / 1.3.5
Backup Migration v1.3.5
2.1.6 2.1.5.2 trunk 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.6.1 1.4.7 1.4.8 1.4.9 1.4.9.1 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.5.1
backup-backup / includes / constants.php
backup-backup / includes Last commit date
banner 2 years ago check 2 years ago cli 2 years ago cron 2 years ago dashboard 2 years ago database 2 years ago extracter 2 years ago htaccess 2 years ago progress 2 years ago scanner 2 years ago staging 2 years ago uploader 2 years ago zipper 2 years ago .htaccess 2 years ago activation.php 2 years ago ajax.php 2 years ago analyst.php 2 years ago backup-cli.php 2 years ago backup-heart.php 2 years ago bypasser.php 2 years ago cli-handler.php 2 years ago compatibility.php 2 years ago config.php 2 years ago constants.php 2 years ago initializer.php 2 years ago logger.php 2 years ago restore-batching.php 2 years ago
constants.php
206 lines
1 <?php
2
3 // Namespace
4 namespace BMI\Plugin;
5
6 // Exit on direct access
7 if (!defined('ABSPATH')) {
8 exit;
9 }
10
11 // Plugin includes
12 if (!defined('BMI_AUTHOR_URI')) {
13 define('BMI_AUTHOR_URI', 'https://backupbliss.com/');
14 }
15 if (!defined('BMI_API_BACKUPBLISS_PUSH')) {
16 define('BMI_API_BACKUPBLISS_PUSH', 'api.backupbliss.com');
17 }
18 if (!defined('BMI_BACKUPS_DEFAULT')) {
19 define('BMI_BACKUPS_DEFAULT', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration');
20 }
21 if (!defined('BMI_CONFIG_DEFAULT')) {
22 define('BMI_CONFIG_DEFAULT', BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'default.json');
23 }
24 if (!defined('BMI_STATIC_PHP_CONFIG')) {
25 define('BMI_STATIC_PHP_CONFIG', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration-config.php');
26 }
27 if (!defined('BMI_REV')) {
28 define('BMI_REV', 2);
29 }
30
31 // Load configuration
32 require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'config.php';
33
34 // Database queries amount
35 if (!defined('BMI_DB_MAX_ROWS_PER_QUERY')) {
36 $db_queries = Dashboard\bmi_get_config('OTHER:DB:QUERIES');
37 if (is_numeric($db_queries)) {
38 $db_queries = intval($db_queries);
39
40 if ($db_queries > 15000 || $db_queries < 15) {
41 $db_queries = 2000;
42 }
43 }
44
45 if (!isset($db_queries) || is_null($db_queries) || !is_numeric($db_queries)) {
46 $db_queries = 2000;
47 }
48
49 define('BMI_DB_MAX_ROWS_PER_QUERY', $db_queries);
50 }
51
52 // Default constants
53 if (!defined('BMI_MAX_SEARCH_REPLACE_PAGE')) {
54 $db_sr_max_page = Dashboard\bmi_get_config('OTHER:DB:SEARCHREPLACE:MAX');
55 if (is_numeric($db_sr_max_page)) {
56 $db_sr_max_page = intval($db_sr_max_page);
57
58 if ($db_sr_max_page > 30000 || $db_sr_max_page < 10) {
59 $db_sr_max_page = 300;
60 }
61 }
62
63 if (!isset($db_sr_max_page) || is_null($db_sr_max_page) || !is_numeric($db_sr_max_page)) {
64 $db_sr_max_page = 300;
65 }
66
67 define('BMI_MAX_SEARCH_REPLACE_PAGE', $db_sr_max_page);
68 }
69 if (!defined('BMI_MAX_FILE_EXTRACTION_LIMIT')) {
70 $file_ex_max_limit = Dashboard\bmi_get_config('OTHER:FILE:EXTRACT:MAX');
71 if (is_numeric($file_ex_max_limit)) {
72 $file_ex_max_limit = intval($file_ex_max_limit);
73
74 if ($file_ex_max_limit > 20000 || $file_ex_max_limit < 50) {
75 $file_ex_max_limit = 'auto';
76 }
77 } else if (trim(strtolower($file_ex_max_limit)) == 'auto') {
78 $file_ex_max_limit = 'auto';
79 }
80
81 if ((!isset($file_ex_max_limit) || is_null($file_ex_max_limit) || !is_numeric($file_ex_max_limit)) && $file_ex_max_limit != 'auto') {
82 $file_ex_max_limit = 'auto';
83 }
84
85 define('BMI_MAX_FILE_EXTRACTION_LIMIT', $file_ex_max_limit);
86 }
87 if (!defined('BMI_CLI_EXECUTABLE')) {
88 $php_cli_path = Dashboard\bmi_get_config('OTHER:CLI:PATH');
89 if (strlen(trim($php_cli_path)) > 0) {
90 define('BMI_CLI_EXECUTABLE', $php_cli_path);
91 }
92 }
93 if (!defined('BMI_CLI_ENABLED')) {
94 $cli_enabled = Dashboard\bmi_get_config('OTHER:CLI:DISABLE') === true ? false : true;
95 if ($cli_enabled === false) {
96 define('BMI_CLI_ENABLED', $cli_enabled);
97 }
98 }
99 if (!defined('BMI_LEGACY_VERSION')) {
100 $legacy = (Dashboard\bmi_get_config('OTHER:EXPERIMENT:TIMEOUT') == 'true' || Dashboard\bmi_get_config('OTHER:EXPERIMENT:TIMEOUT') === true) ? false : true;
101 define('BMI_LEGACY_VERSION', $legacy);
102 }
103 if (!defined('BMI_LEGACY_HARD_VERSION')) {
104 $legacy_hard = (Dashboard\bmi_get_config('OTHER:EXPERIMENT:TIMEOUT:HARD') == 'true' || Dashboard\bmi_get_config('OTHER:EXPERIMENT:TIMEOUT:HARD') === true) ? false : true;
105 define('BMI_LEGACY_HARD_VERSION', $legacy_hard);
106 }
107 if (!defined('BMI_FUNCTION_NORMAL')) {
108 if (BMI_LEGACY_VERSION && BMI_LEGACY_HARD_VERSION) {
109 define('BMI_FUNCTION_NORMAL', true);
110 } else {
111 define('BMI_FUNCTION_NORMAL', false);
112 }
113 }
114 if (!defined('BMI_ASSETS')) {
115 define('BMI_ASSETS', plugin_dir_url(BMI_ROOT_FILE) . 'admin');
116 }
117 if (!defined('BMI_BACKUPS_ROOT')) {
118 define('BMI_BACKUPS_ROOT', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration');
119 }
120 if (!defined('BMI_BACKUPS')) {
121 define('BMI_BACKUPS', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration' . DIRECTORY_SEPARATOR . 'backups');
122 }
123 if (!defined('BMI_STAGING')) {
124 define('BMI_STAGING', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration' . DIRECTORY_SEPARATOR . 'staging');
125 }
126
127 // Fill folders if not removed (security)
128 if (!file_exists(BMI_BACKUPS)) {
129 mkdir(BMI_BACKUPS, 0755, true);
130 }
131 if (!file_exists(BMI_STAGING)) {
132 mkdir(BMI_STAGING, 0755, true);
133 }
134 if (!file_exists(BMI_CONFIG_DIR)) {
135 mkdir(BMI_CONFIG_DIR, 0755, true);
136 }
137
138 // Secure config and logs
139 if (!file_exists(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.php')) {
140 touch(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.php');
141 }
142 if (!file_exists(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.html')) {
143 touch(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.html');
144 }
145 if (!file_exists(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . '.htaccess')) {
146 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . '.htaccess');
147 }
148 if (!file_exists(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.php')) {
149 touch(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.php');
150 }
151 if (!file_exists(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.html')) {
152 touch(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.html');
153 }
154 if (!file_exists(BMI_STAGING . DIRECTORY_SEPARATOR . '.htaccess')) {
155 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_STAGING . DIRECTORY_SEPARATOR . '.htaccess');
156 }
157
158 // Secure backups (if in backup dir)
159 if (!file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.php')) {
160 touch(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.php');
161 }
162 if (!file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.html')) {
163 touch(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.html');
164 }
165 if (!file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . '.htaccess')) {
166 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_BACKUPS . DIRECTORY_SEPARATOR . '.htaccess');
167 }
168
169 // Tooltips
170 if (!defined('BMI_PREMIUM_TOOLTIP')) {
171 $tooltip = sanitize_text_field(__("This feature isn’t ready yet in the premium plugin, that’s why you can buy it at a <b>big discount</b>", 'backup-backup'));
172 $tooltip .= '&nbsp;– <a href="' . BMI_AUTHOR_URI . '" target="_blank">' . sanitize_text_field(__('learn more', 'backup-backup')) . '</a>.';
173 define('BMI_PREMIUM_TOOLTIP', $tooltip);
174 }
175 if (!defined('BMI_PREMIUM_TOOLTIP_R')) {
176 $tooltip_r = '– <a href="' . BMI_AUTHOR_URI . '" target="_blank">' . sanitize_text_field(__('check it out', 'backup-backup')) . '</a>.';
177 define('BMI_PREMIUM_TOOLTIP_R', $tooltip_r);
178 }
179 if (!defined('BMI_COMMING_SOON_TUNED')) {
180 $cmsx = '<b><a href="' . BMI_AUTHOR_URI . '" target="_blank" class="link-white">' . sanitize_text_field(__('Order it now at a big discount!', 'backup-backup')) . '</a></b>';
181 define('BMI_COMMING_SOON_TUNED', $cmsx);
182 }
183 if (!defined('BMI_COMMING_SOON_PRO')) {
184 $cmsv = '<p class="f16">';
185 $cmsv .= sanitize_text_field(__("Coming soon in the Premium Plugin", 'backup-backup'));
186 $cmsv .= '&nbsp;–&nbsp;' . BMI_COMMING_SOON_TUNED;
187 $cmsv .= '</p>';
188 define('BMI_COMMING_SOON_PRO', $cmsv);
189 }
190 if (!defined('BMI_ALREADY_IN_PRO')) {
191 $aisv = '<p class="f16">';
192 $aisv .= sanitize_text_field(__("Already included in the Premium Plugin", 'backup-backup'));
193 $aisv .= '&nbsp;–&nbsp;' . BMI_COMMING_SOON_TUNED;
194 $aisv .= '</p>';
195 define('BMI_ALREADY_IN_PRO', $aisv);
196 }
197 if (!defined('BMI_COMMING_SOON_FREE')) {
198 $cmsne = '<p class="f16">';
199 $cmsne .= __("Coming soon also in the free plugin", 'backup-backup') . ' – <b>' . __("stay tuned!", 'backup-backup') . '</b>';
200 $cmsne .= '</p>';
201 define('BMI_COMMING_SOON_FREE', $cmsne);
202 }
203 if (!defined('BMI_CHAT_SUPPORT_URL')) {
204 define('BMI_CHAT_SUPPORT_URL', '//code.jivosite.com/widget/qli4YP0snZ');
205 }
206