PluginProbe ʕ •ᴥ•ʔ
Backup Migration / 1.4.9
Backup Migration v1.4.9
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 11 months ago bodies 11 months ago check 11 months ago cli 11 months ago cron 11 months ago dashboard 11 months ago database 11 months ago external 11 months ago extracter 11 months ago htaccess 11 months ago notices 11 months ago progress 11 months ago scanner 11 months ago staging 11 months ago traits 11 months ago uploader 11 months ago zipper 11 months ago .htaccess 11 months ago activation.php 11 months ago ajax.php 11 months ago ajax_offline.php 11 months ago analyst.php 11 months ago backup-process.php 11 months ago class-backup-method-mananger.php 11 months ago cli-handler.php 11 months ago compatibility.php 11 months ago config.php 11 months ago constants.php 11 months ago initializer.php 11 months ago logger.php 11 months ago offline.php 11 months ago
constants.php
262 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_BB_STORAGE_URI')) {
16 define('BMI_BB_STORAGE_URI', 'https://storage.backupbliss.com/');
17 }
18 if (!defined('BMI_BB_STORAGE_API_URI')) {
19 define('BMI_BB_STORAGE_API_URI', 'https://apistorage.backupbliss.com/');
20 }
21 if (!defined('BMI_API_BACKUPBLISS_PUSH')) {
22 define('BMI_API_BACKUPBLISS_PUSH', 'api.backupbliss.com');
23 }
24 if (!defined('BMI_SUPPORT_EMAIL')) {
25 define('BMI_SUPPORT_EMAIL', 'support@backupbliss.com');
26 }
27 if (!defined('BMI_BACKUPS_DEFAULT')) {
28 define('BMI_BACKUPS_DEFAULT', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration');
29 }
30 if (!defined('BMI_CONFIG_DEFAULT')) {
31 define('BMI_CONFIG_DEFAULT', BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . 'default.json');
32 }
33 if (!defined('BMI_STATIC_PHP_CONFIG')) {
34 define('BMI_STATIC_PHP_CONFIG', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration-config.php');
35 }
36 if (!defined('BMI_REV')) {
37 define('BMI_REV', 4);
38 }
39
40 // Load configuration
41 require_once BMI_INCLUDES . DIRECTORY_SEPARATOR . 'config.php';
42
43 // Database queries amount
44 if (!defined('BMI_DB_MAX_ROWS_PER_QUERY')) {
45 $db_queries = Dashboard\bmi_get_config('OTHER:DB:QUERIES');
46 if (is_numeric($db_queries)) {
47 $db_queries = intval($db_queries);
48
49 if ($db_queries > 15000 || $db_queries < 15) {
50 $db_queries = 2000;
51 }
52 }
53
54 if (!isset($db_queries) || is_null($db_queries) || !is_numeric($db_queries)) {
55 $db_queries = 2000;
56 }
57
58 define('BMI_DB_MAX_ROWS_PER_QUERY', $db_queries);
59 }
60
61 // Default constants
62 if (!defined('BMI_MAX_SEARCH_REPLACE_PAGE')) {
63 $db_sr_max_page = Dashboard\bmi_get_config('OTHER:DB:SEARCHREPLACE:MAX');
64 if (is_numeric($db_sr_max_page)) {
65 $db_sr_max_page = intval($db_sr_max_page);
66
67 if ($db_sr_max_page > 30000 || $db_sr_max_page < 10) {
68 $db_sr_max_page = 300;
69 }
70 }
71
72 if (!isset($db_sr_max_page) || is_null($db_sr_max_page) || !is_numeric($db_sr_max_page)) {
73 $db_sr_max_page = 300;
74 }
75
76 define('BMI_MAX_SEARCH_REPLACE_PAGE', $db_sr_max_page);
77 }
78 if (!defined('BMI_MAX_FILE_EXTRACTION_LIMIT')) {
79 $file_ex_max_limit = Dashboard\bmi_get_config('OTHER:FILE:EXTRACT:MAX');
80 if (is_numeric($file_ex_max_limit)) {
81 $file_ex_max_limit = intval($file_ex_max_limit);
82
83 if ($file_ex_max_limit > 20000 || $file_ex_max_limit < 50) {
84 $file_ex_max_limit = 'auto';
85 }
86 } else if (trim(strtolower($file_ex_max_limit)) == 'auto') {
87 $file_ex_max_limit = 'auto';
88 }
89
90 if ((!isset($file_ex_max_limit) || is_null($file_ex_max_limit) || !is_numeric($file_ex_max_limit)) && $file_ex_max_limit != 'auto') {
91 $file_ex_max_limit = 'auto';
92 }
93
94 define('BMI_MAX_FILE_EXTRACTION_LIMIT', $file_ex_max_limit);
95 }
96 if (!defined('BMI_CLI_EXECUTABLE')) {
97 $php_cli_path = Dashboard\bmi_get_config('OTHER:CLI:PATH');
98 if (strlen(trim($php_cli_path)) > 0) {
99 define('BMI_CLI_EXECUTABLE', $php_cli_path);
100 }
101 }
102 if (!defined('BMI_CLI_ENABLED')) {
103 $cli_enabled = Dashboard\bmi_get_config('OTHER:CLI:DISABLE') === true ? false : true;
104 if ($cli_enabled === false) {
105 define('BMI_CLI_ENABLED', $cli_enabled);
106 }
107 }
108
109 if (Dashboard\bmi_get_config('OTHER:EXPERIMENT:TIMEOUT') === true) {
110 $disabled = explode(',', ini_get('disable_functions'));
111
112 if (!function_exists('curl_version') || !function_exists('curl_exec') || !function_exists('curl_init') || in_array('curl_exec', $disabled) || in_array('curl_init', $disabled) || in_array('curl_version', $disabled)) {
113 Dashboard\bmi_set_config('OTHER:EXPERIMENT:TIMEOUT', false);
114 Dashboard\bmi_set_config('OTHER:USE:TIMEOUT:NORMAL', true);
115 }
116 }
117
118 if (!defined('BMI_LEGACY_VERSION')) {
119 $legacy = (Dashboard\bmi_get_config('OTHER:EXPERIMENT:TIMEOUT') == 'true' || Dashboard\bmi_get_config('OTHER:EXPERIMENT:TIMEOUT') === true) ? false : true;
120 define('BMI_LEGACY_VERSION', $legacy);
121 }
122 if (!defined('BMI_LEGACY_HARD_VERSION')) {
123 $legacy_hard = (Dashboard\bmi_get_config('OTHER:EXPERIMENT:TIMEOUT:HARD') == 'true' || Dashboard\bmi_get_config('OTHER:EXPERIMENT:TIMEOUT:HARD') === true) ? false : true;
124 define('BMI_LEGACY_HARD_VERSION', $legacy_hard);
125 }
126 if (!defined('BMI_FUNCTION_NORMAL')) {
127 if (BMI_LEGACY_VERSION && BMI_LEGACY_HARD_VERSION) {
128 define('BMI_FUNCTION_NORMAL', true);
129 } else {
130 define('BMI_FUNCTION_NORMAL', false);
131 }
132 }
133 if (!defined('BMI_ASSETS')) {
134 define('BMI_ASSETS', plugin_dir_url(BMI_ROOT_FILE) . 'admin');
135 }
136 if (!defined('BMI_BACKUPS_ROOT')) {
137 define('BMI_BACKUPS_ROOT', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration');
138 }
139 if (!defined('BMI_TMP')) {
140 define('BMI_TMP', BMI_BACKUPS_ROOT . DIRECTORY_SEPARATOR . 'tmp');
141 }
142 if (!defined('BMI_BACKUPS')) {
143 define('BMI_BACKUPS', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration' . DIRECTORY_SEPARATOR . 'backups');
144 }
145 if (!defined('BMI_STAGING')) {
146 define('BMI_STAGING', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration' . DIRECTORY_SEPARATOR . 'staging');
147 }
148
149 // Fill folders if not removed (security)
150 if (!file_exists(BMI_BACKUPS)) {
151 mkdir(BMI_BACKUPS, 0755, true);
152 }
153 if (!file_exists(BMI_STAGING)) {
154 mkdir(BMI_STAGING, 0755, true);
155 }
156 if (!file_exists(BMI_CONFIG_DIR)) {
157 mkdir(BMI_CONFIG_DIR, 0755, true);
158 }
159 if (!file_exists(BMI_TMP)) {
160 mkdir(BMI_TMP, 0755, true);
161 }
162
163 // Secure config and logs
164 if (!file_exists(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.php')) {
165 touch(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.php');
166 }
167 if (!file_exists(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.html')) {
168 touch(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.html');
169 }
170 if (!file_exists(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . '.htaccess')) {
171 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . '.htaccess');
172 }
173 if (!file_exists(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.php')) {
174 touch(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.php');
175 }
176 if (!file_exists(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.html')) {
177 touch(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.html');
178 }
179 if (!file_exists(BMI_STAGING . DIRECTORY_SEPARATOR . '.htaccess')) {
180 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_STAGING . DIRECTORY_SEPARATOR . '.htaccess');
181 }
182 if (!file_exists(BMI_TMP . DIRECTORY_SEPARATOR . 'index.php')) {
183 touch(BMI_TMP . DIRECTORY_SEPARATOR . 'index.php');
184 }
185 if (!file_exists(BMI_TMP . DIRECTORY_SEPARATOR . 'index.html')) {
186 touch(BMI_TMP . DIRECTORY_SEPARATOR . 'index.html');
187 }
188 if (!file_exists(BMI_TMP . DIRECTORY_SEPARATOR . '.htaccess')) {
189 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_TMP . DIRECTORY_SEPARATOR . '.htaccess');
190 }
191
192 // Secure backups (if in backup dir)
193 if (!file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.php')) {
194 touch(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.php');
195 }
196 if (!file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.html')) {
197 touch(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.html');
198 }
199 if (!file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . '.htaccess')) {
200 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_BACKUPS . DIRECTORY_SEPARATOR . '.htaccess');
201 }
202
203 // Tooltips
204 if (!defined('BMI_PREMIUM_TOOLTIP')) {
205 $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'));
206 $tooltip .= '&nbsp;– <a href="' . BMI_AUTHOR_URI . '" target="_blank">' . sanitize_text_field(__('learn more', 'backup-backup')) . '</a>.';
207 define('BMI_PREMIUM_TOOLTIP', $tooltip);
208 }
209 if (!defined('BMI_PREMIUM_TOOLTIP_R')) {
210 $tooltip_r = '– <a href="' . BMI_AUTHOR_URI . '" target="_blank">' . sanitize_text_field(__('check it out', 'backup-backup')) . '</a>.';
211 define('BMI_PREMIUM_TOOLTIP_R', $tooltip_r);
212 }
213 if (!defined('BMI_COMMING_SOON_TUNED')) {
214 $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>';
215 define('BMI_COMMING_SOON_TUNED', $cmsx);
216 }
217 if (!defined('BMI_COMMING_SOON_PRO')) {
218 $cmsv = '<p class="f16">';
219 $cmsv .= sanitize_text_field(__("Coming soon in the Premium Plugin", 'backup-backup'));
220 $cmsv .= '&nbsp;–&nbsp;' . BMI_COMMING_SOON_TUNED;
221 $cmsv .= '</p>';
222 define('BMI_COMMING_SOON_PRO', $cmsv);
223 }
224 if (!defined('BMI_ALREADY_IN_PRO')) {
225 $aisv = '<p class="f16">';
226 $aisv .= sanitize_text_field(__("Already included in the Premium Plugin", 'backup-backup'));
227 $aisv .= '&nbsp;–&nbsp;' . BMI_COMMING_SOON_TUNED;
228 $aisv .= '</p>';
229 define('BMI_ALREADY_IN_PRO', $aisv);
230 }
231 if (!defined('BMI_COMMING_SOON_FREE')) {
232 $cmsne = '<p class="f16">';
233 $cmsne .= __("Coming soon also in the free plugin", 'backup-backup') . ' – <b>' . __("stay tuned!", 'backup-backup') . '</b>';
234 $cmsne .= '</p>';
235 define('BMI_COMMING_SOON_FREE', $cmsne);
236 }
237 if (!defined('BMI_CHAT_SUPPORT_URL')) {
238 define('BMI_CHAT_SUPPORT_URL', '//code.jivosite.com/widget/qli4YP0snZ');
239 }
240
241 // SINCE 1.4.6
242 if (!defined('BMI_BACKUP_FULL')) {
243 define('BMI_BACKUP_FULL', 'full-backup');
244 }
245 if (!defined('BMI_BACKUP_CORE')) {
246 define('BMI_BACKUP_CORE', 'core-database-backup');
247 }
248 if (!defined('BMI_BACKUP_PLUGIN')) {
249 define('BMI_BACKUP_PLUGIN', 'plugin-backup');
250 }
251 if (!defined('BMI_BACKUP_THEME')) {
252 define('BMI_BACKUP_THEME', 'theme-backup');
253 }
254 if(!defined('BMI_METHOD_CURL')) {
255 define('BMI_METHOD_CURL', 'cURL');
256 }
257 if(!defined('BMI_METHOD_DEFAULT')) {
258 define('BMI_METHOD_DEFAULT', 'default');
259 }
260 if(!defined('BMI_METHOD_BROWSER')) {
261 define('BMI_METHOD_BROWSER', 'browser-method');
262 }