PluginProbe ʕ •ᴥ•ʔ
Backup Migration / 1.3.7
Backup Migration v1.3.7
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-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
221 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_TMP')) {
121 define('BMI_TMP', BMI_BACKUPS_ROOT . DIRECTORY_SEPARATOR . 'tmp');
122 }
123 if (!defined('BMI_BACKUPS')) {
124 define('BMI_BACKUPS', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration' . DIRECTORY_SEPARATOR . 'backups');
125 }
126 if (!defined('BMI_STAGING')) {
127 define('BMI_STAGING', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'backup-migration' . DIRECTORY_SEPARATOR . 'staging');
128 }
129
130 // Fill folders if not removed (security)
131 if (!file_exists(BMI_BACKUPS)) {
132 mkdir(BMI_BACKUPS, 0755, true);
133 }
134 if (!file_exists(BMI_STAGING)) {
135 mkdir(BMI_STAGING, 0755, true);
136 }
137 if (!file_exists(BMI_CONFIG_DIR)) {
138 mkdir(BMI_CONFIG_DIR, 0755, true);
139 }
140 if (!file_exists(BMI_TMP)) {
141 mkdir(BMI_TMP, 0755, true);
142 }
143
144 // Secure config and logs
145 if (!file_exists(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.php')) {
146 touch(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.php');
147 }
148 if (!file_exists(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.html')) {
149 touch(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'index.html');
150 }
151 if (!file_exists(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . '.htaccess')) {
152 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . '.htaccess');
153 }
154 if (!file_exists(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.php')) {
155 touch(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.php');
156 }
157 if (!file_exists(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.html')) {
158 touch(BMI_STAGING . DIRECTORY_SEPARATOR . 'index.html');
159 }
160 if (!file_exists(BMI_STAGING . DIRECTORY_SEPARATOR . '.htaccess')) {
161 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_STAGING . DIRECTORY_SEPARATOR . '.htaccess');
162 }
163 if (!file_exists(BMI_TMP . DIRECTORY_SEPARATOR . 'index.php')) {
164 touch(BMI_TMP . DIRECTORY_SEPARATOR . 'index.php');
165 }
166 if (!file_exists(BMI_TMP . DIRECTORY_SEPARATOR . 'index.html')) {
167 touch(BMI_TMP . DIRECTORY_SEPARATOR . 'index.html');
168 }
169 if (!file_exists(BMI_TMP . DIRECTORY_SEPARATOR . '.htaccess')) {
170 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_TMP . DIRECTORY_SEPARATOR . '.htaccess');
171 }
172
173 // Secure backups (if in backup dir)
174 if (!file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.php')) {
175 touch(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.php');
176 }
177 if (!file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.html')) {
178 touch(BMI_BACKUPS . DIRECTORY_SEPARATOR . 'index.html');
179 }
180 if (!file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . '.htaccess')) {
181 copy(BMI_INCLUDES . DIRECTORY_SEPARATOR . 'htaccess' . DIRECTORY_SEPARATOR . '.htaccess', BMI_BACKUPS . DIRECTORY_SEPARATOR . '.htaccess');
182 }
183
184 // Tooltips
185 if (!defined('BMI_PREMIUM_TOOLTIP')) {
186 $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'));
187 $tooltip .= '&nbsp;– <a href="' . BMI_AUTHOR_URI . '" target="_blank">' . sanitize_text_field(__('learn more', 'backup-backup')) . '</a>.';
188 define('BMI_PREMIUM_TOOLTIP', $tooltip);
189 }
190 if (!defined('BMI_PREMIUM_TOOLTIP_R')) {
191 $tooltip_r = '– <a href="' . BMI_AUTHOR_URI . '" target="_blank">' . sanitize_text_field(__('check it out', 'backup-backup')) . '</a>.';
192 define('BMI_PREMIUM_TOOLTIP_R', $tooltip_r);
193 }
194 if (!defined('BMI_COMMING_SOON_TUNED')) {
195 $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>';
196 define('BMI_COMMING_SOON_TUNED', $cmsx);
197 }
198 if (!defined('BMI_COMMING_SOON_PRO')) {
199 $cmsv = '<p class="f16">';
200 $cmsv .= sanitize_text_field(__("Coming soon in the Premium Plugin", 'backup-backup'));
201 $cmsv .= '&nbsp;–&nbsp;' . BMI_COMMING_SOON_TUNED;
202 $cmsv .= '</p>';
203 define('BMI_COMMING_SOON_PRO', $cmsv);
204 }
205 if (!defined('BMI_ALREADY_IN_PRO')) {
206 $aisv = '<p class="f16">';
207 $aisv .= sanitize_text_field(__("Already included in the Premium Plugin", 'backup-backup'));
208 $aisv .= '&nbsp;–&nbsp;' . BMI_COMMING_SOON_TUNED;
209 $aisv .= '</p>';
210 define('BMI_ALREADY_IN_PRO', $aisv);
211 }
212 if (!defined('BMI_COMMING_SOON_FREE')) {
213 $cmsne = '<p class="f16">';
214 $cmsne .= __("Coming soon also in the free plugin", 'backup-backup') . ' – <b>' . __("stay tuned!", 'backup-backup') . '</b>';
215 $cmsne .= '</p>';
216 define('BMI_COMMING_SOON_FREE', $cmsne);
217 }
218 if (!defined('BMI_CHAT_SUPPORT_URL')) {
219 define('BMI_CHAT_SUPPORT_URL', '//code.jivosite.com/widget/qli4YP0snZ');
220 }
221