Version Description
- Add OneDrive to export/import pages
- Fix a bug when WordPress was used without a db prefix
- Fix a problem when downloading wpress files
- Improve the log system
Download this release
Release Info
Developer | bangelov |
Plugin | All-in-One WP Migration |
Version | 5.35 |
Comparing to | |
See all releases |
Code changes from version 4.19 to 5.35
- all-in-one-wp-migration.php +5 -2
- constants.php +59 -17
- lib/exception/class-ai1wm-backup-exception.php → deprecated.php +2 -4
- functions.php +489 -11
- lib/controller/{class-ai1wm-backup-controller.php → class-ai1wm-backups-controller.php} +10 -10
- lib/controller/class-ai1wm-export-controller.php +57 -86
- lib/controller/class-ai1wm-feedback-controller.php +12 -11
- lib/controller/class-ai1wm-import-controller.php +59 -95
- lib/controller/class-ai1wm-main-controller.php +217 -173
- lib/controller/class-ai1wm-report-controller.php +10 -9
- lib/controller/class-ai1wm-resolve-controller.php +13 -16
- lib/controller/class-ai1wm-updater-controller.php +1 -1
- lib/{controller/class-ai1wm-message-controller.php → exception/class-ai1wm-archive-exception.php} +2 -19
- lib/exception/class-ai1wm-backups-exception.php +26 -0
- lib/exception/class-ai1wm-export-exception.php +2 -4
- lib/exception/class-ai1wm-http-exception.php +2 -4
- lib/exception/class-ai1wm-import-exception.php +2 -56
- lib/exception/class-ai1wm-not-accessible-exception.php +2 -4
- lib/exception/class-ai1wm-not-found-exception.php +3 -4
- lib/exception/class-ai1wm-not-readable-exception.php +2 -4
- lib/exception/class-ai1wm-not-writable-exception.php +2 -4
- lib/exception/class-ai1wm-storage-exception.php +2 -4
- lib/model/{class-ai1wm-backup.php → class-ai1wm-backups.php} +4 -4
- lib/model/class-ai1wm-config.php +26 -0
- lib/model/{service/class-ai1wm-service-interface.php → class-ai1wm-deprecated.php} +3 -6
- lib/model/class-ai1wm-export-abstract.php +0 -507
- lib/model/class-ai1wm-feedback.php +10 -8
- lib/model/class-ai1wm-handler.php +45 -0
- lib/model/class-ai1wm-http.php +6 -1
- lib/model/class-ai1wm-import-abstract.php +0 -437
- lib/model/class-ai1wm-log.php +48 -91
- lib/model/class-ai1wm-report.php +8 -7
- lib/model/class-ai1wm-status.php +22 -108
- lib/model/class-ai1wm-storage.php +0 -157
- lib/model/class-ai1wm-template.php +1 -1
- lib/model/class-ai1wm-updater.php +1 -1
- lib/model/export/class-ai1wm-export-archive.php +42 -0
- lib/{vendor/mysqldump-factory/mysqldump-factory/lib/MysqlDumpFactory.php → model/export/class-ai1wm-export-clean.php} +28 -20
- lib/model/{class-ai1wm-logger.php → export/class-ai1wm-export-config.php} +46 -37
- lib/model/export/class-ai1wm-export-content.php +149 -0
- lib/model/export/class-ai1wm-export-database.php +122 -0
- lib/model/{class-ai1wm-export-file.php → export/class-ai1wm-export-download.php} +21 -24
- lib/model/{class-ai1wm-message.php → export/class-ai1wm-export-enumerate.php} +55 -56
- lib/model/export/class-ai1wm-export-resolve.php +51 -0
- lib/model/import/class-ai1wm-import-blogs.php +94 -0
- lib/model/import/class-ai1wm-import-clean.php +58 -0
- lib/model/import/class-ai1wm-import-confirm.php +66 -0
- lib/model/import/class-ai1wm-import-content.php +166 -0
- lib/model/import/class-ai1wm-import-database.php +396 -0
- lib/model/import/class-ai1wm-import-done.php +49 -0
- lib/model/import/class-ai1wm-import-enumerate.php +50 -0
- lib/model/import/class-ai1wm-import-resolve.php +41 -0
- lib/model/{class-ai1wm-import-file.php → import/class-ai1wm-import-upload.php} +13 -14
- lib/model/import/class-ai1wm-import-validate.php +58 -0
- lib/model/service/class-ai1wm-service-database.php +0 -307
- lib/model/service/class-ai1wm-service-package.php +0 -142
- lib/vendor/mysqldump-factory/mysqldump-factory/LICENSE +0 -20
- lib/vendor/mysqldump-factory/mysqldump-factory/lib/MysqlDumpInterface.php +0 -196
- lib/vendor/mysqldump-factory/mysqldump-factory/lib/MysqlDumpPDO.php +0 -974
- lib/vendor/mysqldump-factory/mysqldump-factory/lib/MysqlDumpSQL.php +0 -924
- lib/vendor/servmask/archiver/class-ai1wm-archiver.php +2 -3
- lib/vendor/servmask/archiver/class-ai1wm-compressor.php +3 -3
- lib/vendor/servmask/archiver/class-ai1wm-extractor.php +11 -3
- lib/vendor/servmask/cron/class-ai1wm-cron.php +2 -2
- lib/{model/class-ai1wm-maintenance.php → vendor/servmask/database/class-ai1wm-database-mysql.php} +54 -27
- lib/{model/class-ai1wm-error.php → vendor/servmask/database/class-ai1wm-database-mysqli.php} +56 -46
- lib/vendor/{mysqldump-factory/mysqldump-factory/lib/MysqlDumpUtility.php → servmask/database/class-ai1wm-database-utility.php} +38 -39
- lib/vendor/servmask/database/class-ai1wm-database.php +864 -0
- lib/vendor/servmask/filesystem/class-ai1wm-file-index.php +43 -15
- lib/vendor/servmask/filter/class-ai1wm-extension-filter.php +2 -2
- lib/vendor/servmask/filter/class-ai1wm-recursive-exclude-filter.php +2 -2
- lib/vendor/servmask/iterator/class-ai1wm-recursive-directory-iterator.php +2 -2
- lib/view/assets/css/{backup.min.css → backups.min.css} +1 -1
- lib/view/assets/css/export.min.css +1 -1
- lib/view/assets/css/import.min.css +1 -1
- lib/view/assets/css/updater.min.css +1 -1
- lib/view/assets/javascript/backup.min.js +0 -1
- lib/view/assets/javascript/backups.min.js +1 -0
- lib/view/assets/javascript/export.min.js +1 -1
- lib/view/assets/javascript/import.min.js +1 -1
- lib/view/{backup → backups}/index.php +4 -6
- lib/view/common/maintenance-mode.php +0 -11
- lib/view/export/advanced-settings.php +0 -5
- lib/view/export/button-onedrive.php +1 -0
- lib/view/export/export-buttons.php +17 -32
- lib/view/export/index.php +2 -18
- lib/view/import/button-onedrive.php +1 -0
- lib/view/import/index.php +1 -3
- lib/view/main/admin-head.php +2 -3
- lib/view/main/backups-notice.php +1 -1
- loader.php +110 -52
- readme.txt +8 -3
- uninstall.php +1 -1
all-in-one-wp-migration.php
CHANGED
@@ -5,12 +5,12 @@
|
|
5 |
* Description: Migration tool for all your blog data. Import or Export your blog content with a single click.
|
6 |
* Author: ServMask
|
7 |
* Author URI: https://servmask.com/
|
8 |
-
* Version:
|
9 |
* Text Domain: all-in-one-wp-migration
|
10 |
* Domain Path: /languages
|
11 |
* Network: True
|
12 |
*
|
13 |
-
* Copyright (C) 2014 ServMask Inc.
|
14 |
*
|
15 |
* This program is free software: you can redistribute it and/or modify
|
16 |
* it under the terms of the GNU General Public License as published by
|
@@ -63,6 +63,9 @@ define( 'AI1WM_THEMES_PATH', get_theme_root() );
|
|
63 |
// Include constants
|
64 |
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'constants.php';
|
65 |
|
|
|
|
|
|
|
66 |
// Include functions
|
67 |
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'functions.php';
|
68 |
|
5 |
* Description: Migration tool for all your blog data. Import or Export your blog content with a single click.
|
6 |
* Author: ServMask
|
7 |
* Author URI: https://servmask.com/
|
8 |
+
* Version: 5.35
|
9 |
* Text Domain: all-in-one-wp-migration
|
10 |
* Domain Path: /languages
|
11 |
* Network: True
|
12 |
*
|
13 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
14 |
*
|
15 |
* This program is free software: you can redistribute it and/or modify
|
16 |
* it under the terms of the GNU General Public License as published by
|
63 |
// Include constants
|
64 |
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'constants.php';
|
65 |
|
66 |
+
// Include deprecated
|
67 |
+
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'deprecated.php';
|
68 |
+
|
69 |
// Include functions
|
70 |
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'functions.php';
|
71 |
|
constants.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -25,8 +25,9 @@
|
|
25 |
|
26 |
$local = array(
|
27 |
'iliev.local',
|
28 |
-
'
|
29 |
'Borislav-MacBook-Pro.local',
|
|
|
30 |
);
|
31 |
|
32 |
if ( function_exists( 'gethostname' ) && in_array( gethostname(), $local ) ) {
|
@@ -38,7 +39,7 @@ if ( function_exists( 'gethostname' ) && in_array( gethostname(), $local ) ) {
|
|
38 |
// ==================
|
39 |
// = Plugin Version =
|
40 |
// ==================
|
41 |
-
define( 'AI1WM_VERSION', '
|
42 |
|
43 |
// ===============
|
44 |
// = Plugin Name =
|
@@ -58,7 +59,7 @@ define( 'AI1WM_STORAGE_PATH', AI1WM_PATH . DIRECTORY_SEPARATOR . 'storage' );
|
|
58 |
// ==================
|
59 |
// = Error Log Path =
|
60 |
// ==================
|
61 |
-
define( '
|
62 |
|
63 |
// ===============
|
64 |
// = Status Path =
|
@@ -80,10 +81,15 @@ define( 'AI1WM_CONTROLLER_PATH', AI1WM_LIB_PATH . DIRECTORY_SEPARATOR . 'control
|
|
80 |
// ==============
|
81 |
define( 'AI1WM_MODEL_PATH', AI1WM_LIB_PATH . DIRECTORY_SEPARATOR . 'model' );
|
82 |
|
83 |
-
//
|
84 |
-
// =
|
85 |
-
//
|
86 |
-
define( '
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
// =============
|
89 |
// = View Path =
|
@@ -135,6 +141,16 @@ define( 'AI1WM_DATABASE_NAME', 'database.sql' );
|
|
135 |
// ========================
|
136 |
define( 'AI1WM_PACKAGE_NAME', 'package.json' );
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
// ========================
|
139 |
// = Archive Status Name =
|
140 |
// ========================
|
@@ -145,6 +161,21 @@ define( 'AI1WM_STATUS_NAME', 'status.js' );
|
|
145 |
// ========================
|
146 |
define( 'AI1WM_FILEMAP_NAME', 'filemap.list' );
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
// ======================
|
149 |
// = Export Options Key =
|
150 |
// ======================
|
@@ -160,11 +191,6 @@ define( 'AI1WM_ERROR_HANDLER', 'ai1wm_error_handler' );
|
|
160 |
// =========================
|
161 |
define( 'AI1WM_EXCEPTION_HANDLER', 'ai1wm_exception_handler' );
|
162 |
|
163 |
-
// ========================
|
164 |
-
// = Maintenance Mode Key =
|
165 |
-
// ========================
|
166 |
-
define( 'AI1WM_MAINTENANCE_MODE', 'ai1wm_maintenance_mode' );
|
167 |
-
|
168 |
// ==========
|
169 |
// = URL IP =
|
170 |
// ==========
|
@@ -195,10 +221,10 @@ define( 'AI1WM_AUTH_PASSWORD', 'ai1wm_auth_password' );
|
|
195 |
// ==================
|
196 |
define( 'AI1WM_ACTIVE_PLUGINS', 'active_plugins' );
|
197 |
|
198 |
-
//
|
199 |
-
// =
|
200 |
-
//
|
201 |
-
define( '
|
202 |
|
203 |
// ===============
|
204 |
// = Updater Key =
|
@@ -232,6 +258,16 @@ if ( ! defined( 'WP_CONTENT_DIR' ) ) {
|
|
232 |
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
|
233 |
}
|
234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
// ================
|
236 |
// = Backups Path =
|
237 |
// ================
|
@@ -247,6 +283,11 @@ define( 'AI1WM_STORAGE_INDEX', AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . 'index
|
|
247 |
// ======================
|
248 |
define( 'AI1WM_BACKUPS_INDEX', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . 'index.php' );
|
249 |
|
|
|
|
|
|
|
|
|
|
|
250 |
// ====================================
|
251 |
// = WP Migration Plugin Base Dir =
|
252 |
// ====================================
|
@@ -439,3 +480,4 @@ if ( ! defined( 'AI1WMOE_PLUGIN_ABOUT' ) ) {
|
|
439 |
if ( ! defined( 'AI1WMOE_PLUGIN_KEY' ) ) {
|
440 |
define( 'AI1WMOE_PLUGIN_KEY', 'ai1wmoe_plugin_key' );
|
441 |
}
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
25 |
|
26 |
$local = array(
|
27 |
'iliev.local',
|
28 |
+
'develop.servmask.com',
|
29 |
'Borislav-MacBook-Pro.local',
|
30 |
+
'Simeon-PC',
|
31 |
);
|
32 |
|
33 |
if ( function_exists( 'gethostname' ) && in_array( gethostname(), $local ) ) {
|
39 |
// ==================
|
40 |
// = Plugin Version =
|
41 |
// ==================
|
42 |
+
define( 'AI1WM_VERSION', '5.35' );
|
43 |
|
44 |
// ===============
|
45 |
// = Plugin Name =
|
59 |
// ==================
|
60 |
// = Error Log Path =
|
61 |
// ==================
|
62 |
+
define( 'AI1WM_ERROR_FILE', AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . 'error.log' );
|
63 |
|
64 |
// ===============
|
65 |
// = Status Path =
|
81 |
// ==============
|
82 |
define( 'AI1WM_MODEL_PATH', AI1WM_LIB_PATH . DIRECTORY_SEPARATOR . 'model' );
|
83 |
|
84 |
+
// ===============
|
85 |
+
// = Export Path =
|
86 |
+
// ===============
|
87 |
+
define( 'AI1WM_EXPORT_PATH', AI1WM_MODEL_PATH . DIRECTORY_SEPARATOR . 'export' );
|
88 |
+
|
89 |
+
// ===============
|
90 |
+
// = Import Path =
|
91 |
+
// ===============
|
92 |
+
define( 'AI1WM_IMPORT_PATH', AI1WM_MODEL_PATH . DIRECTORY_SEPARATOR . 'import' );
|
93 |
|
94 |
// =============
|
95 |
// = View Path =
|
141 |
// ========================
|
142 |
define( 'AI1WM_PACKAGE_NAME', 'package.json' );
|
143 |
|
144 |
+
// ==========================
|
145 |
+
// = Archive Multisite Name =
|
146 |
+
// ==========================
|
147 |
+
define( 'AI1WM_MULTISITE_NAME', 'multisite.json' );
|
148 |
+
|
149 |
+
// ======================
|
150 |
+
// = Archive Blogs Name =
|
151 |
+
// ======================
|
152 |
+
define( 'AI1WM_BLOGS_NAME', 'blogs.json' );
|
153 |
+
|
154 |
// ========================
|
155 |
// = Archive Status Name =
|
156 |
// ========================
|
161 |
// ========================
|
162 |
define( 'AI1WM_FILEMAP_NAME', 'filemap.list' );
|
163 |
|
164 |
+
// ===================
|
165 |
+
// = Export Log Name =
|
166 |
+
// ===================
|
167 |
+
define( 'AI1WM_EXPORT_NAME', 'export.log' );
|
168 |
+
|
169 |
+
// ===================
|
170 |
+
// = Import Log Name =
|
171 |
+
// ===================
|
172 |
+
define( 'AI1WM_IMPORT_NAME', 'import.log' );
|
173 |
+
|
174 |
+
// ==================
|
175 |
+
// = Error Log Name =
|
176 |
+
// ==================
|
177 |
+
define( 'AI1WM_ERROR_NAME', 'error.log' );
|
178 |
+
|
179 |
// ======================
|
180 |
// = Export Options Key =
|
181 |
// ======================
|
191 |
// =========================
|
192 |
define( 'AI1WM_EXCEPTION_HANDLER', 'ai1wm_exception_handler' );
|
193 |
|
|
|
|
|
|
|
|
|
|
|
194 |
// ==========
|
195 |
// = URL IP =
|
196 |
// ==========
|
221 |
// ==================
|
222 |
define( 'AI1WM_ACTIVE_PLUGINS', 'active_plugins' );
|
223 |
|
224 |
+
// ===========================
|
225 |
+
// = Active Sitewide Plugins =
|
226 |
+
// ===========================
|
227 |
+
define( 'AI1WM_ACTIVE_SITEWIDE_PLUGINS', 'active_sitewide_plugins' );
|
228 |
|
229 |
// ===============
|
230 |
// = Updater Key =
|
258 |
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
|
259 |
}
|
260 |
|
261 |
+
// ================
|
262 |
+
// = Uploads Path =
|
263 |
+
// ================
|
264 |
+
define( 'AI1WM_UPLOADS_PATH', 'uploads' );
|
265 |
+
|
266 |
+
// ==============
|
267 |
+
// = Sites Path =
|
268 |
+
// ==============
|
269 |
+
define( 'AI1WM_SITES_PATH', AI1WM_UPLOADS_PATH . DIRECTORY_SEPARATOR . 'sites' );
|
270 |
+
|
271 |
// ================
|
272 |
// = Backups Path =
|
273 |
// ================
|
283 |
// ======================
|
284 |
define( 'AI1WM_BACKUPS_INDEX', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . 'index.php' );
|
285 |
|
286 |
+
// ======================
|
287 |
+
// = Backups Htaccess File =
|
288 |
+
// ======================
|
289 |
+
define( 'AI1WM_BACKUPS_HTACCESS', AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . '.htaccess' );
|
290 |
+
|
291 |
// ====================================
|
292 |
// = WP Migration Plugin Base Dir =
|
293 |
// ====================================
|
480 |
if ( ! defined( 'AI1WMOE_PLUGIN_KEY' ) ) {
|
481 |
define( 'AI1WMOE_PLUGIN_KEY', 'ai1wmoe_plugin_key' );
|
482 |
}
|
483 |
+
|
lib/exception/class-ai1wm-backup-exception.php → deprecated.php
RENAMED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,5 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
-
class Ai1wm_Backup_Exception extends Exception {
|
27 |
|
28 |
-
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
|
|
25 |
|
26 |
+
function ai1wm_progress_path( $params ) {}
|
functions.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -24,23 +24,481 @@
|
|
24 |
*/
|
25 |
|
26 |
/**
|
27 |
-
*
|
28 |
*
|
29 |
-
* @param
|
30 |
-
* @return
|
31 |
*/
|
32 |
-
function
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
-
*
|
38 |
*
|
39 |
-
* @param
|
40 |
-
* @return
|
41 |
*/
|
42 |
-
function
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
|
46 |
/**
|
@@ -97,3 +555,23 @@ function ai1wm_active_plugins( $plugins = array() ) {
|
|
97 |
|
98 |
return $plugins;
|
99 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
24 |
*/
|
25 |
|
26 |
/**
|
27 |
+
* Get storage absolute path
|
28 |
*
|
29 |
+
* @param array $params Request parameters
|
30 |
+
* @return string
|
31 |
*/
|
32 |
+
function ai1wm_storage_path( $params ) {
|
33 |
+
if ( empty( $params['storage'] ) ) {
|
34 |
+
throw new Ai1wm_Storage_Exception( 'Unable to locate storage path' );
|
35 |
+
}
|
36 |
+
|
37 |
+
// Get storage path
|
38 |
+
$storage = AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . basename( $params['storage'] );
|
39 |
+
if ( ! is_dir( $storage ) ) {
|
40 |
+
mkdir( $storage );
|
41 |
+
}
|
42 |
+
|
43 |
+
return $storage;
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
+
* Get backups absolute path
|
48 |
*
|
49 |
+
* @param array $params Request parameters
|
50 |
+
* @return string
|
51 |
*/
|
52 |
+
function ai1wm_backups_path( $params ) {
|
53 |
+
if ( empty( $params['archive'] ) ) {
|
54 |
+
throw new Ai1wm_Archive_Exception( 'Unable to locate archive path' );
|
55 |
+
}
|
56 |
+
|
57 |
+
return AI1WM_BACKUPS_PATH;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get archive absolute path
|
62 |
+
*
|
63 |
+
* @param array $params Request parameters
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
function ai1wm_archive_path( $params ) {
|
67 |
+
if ( empty( $params['archive'] ) ) {
|
68 |
+
throw new Ai1wm_Storage_Exception( 'Unable to locate archive path' );
|
69 |
+
}
|
70 |
+
|
71 |
+
// Get archive path
|
72 |
+
if ( empty( $params['backups'] ) ) {
|
73 |
+
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . basename( $params['archive'] );
|
74 |
+
}
|
75 |
+
|
76 |
+
return ai1wm_backups_path( $params ) . DIRECTORY_SEPARATOR . basename( $params['archive'] );
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Get download absolute path
|
81 |
+
*
|
82 |
+
* @param array $params Request parameters
|
83 |
+
* @return string
|
84 |
+
*/
|
85 |
+
function ai1wm_download_path( $params ) {
|
86 |
+
return ai1wm_backups_path( $params ) . DIRECTORY_SEPARATOR . basename( $params['archive'] );
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get export log absolute path
|
91 |
+
*
|
92 |
+
* @param array $params Request parameters
|
93 |
+
* @return string
|
94 |
+
*/
|
95 |
+
function ai1wm_export_path( $params ) {
|
96 |
+
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_EXPORT_NAME;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get import log absolute path
|
101 |
+
*
|
102 |
+
* @param array $params Request parameters
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
function ai1wm_import_path( $params ) {
|
106 |
+
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_IMPORT_NAME;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Get filemap.list absolute path
|
111 |
+
*
|
112 |
+
* @param array $params Request parameters
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
function ai1wm_filemap_path( $params ) {
|
116 |
+
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_FILEMAP_NAME;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Get package.json absolute path
|
121 |
+
*
|
122 |
+
* @param array $params Request parameters
|
123 |
+
* @return string
|
124 |
+
*/
|
125 |
+
function ai1wm_package_path( $params ) {
|
126 |
+
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_PACKAGE_NAME;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Get multisite.json absolute path
|
131 |
+
*
|
132 |
+
* @param array $params Request parameters
|
133 |
+
* @return string
|
134 |
+
*/
|
135 |
+
function ai1wm_multisite_path( $params ) {
|
136 |
+
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MULTISITE_NAME;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Get blogs.json absolute path
|
141 |
+
*
|
142 |
+
* @param array $params Request parameters
|
143 |
+
* @return string
|
144 |
+
*/
|
145 |
+
function ai1wm_blogs_path( $params ) {
|
146 |
+
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_BLOGS_NAME;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Get database.sql absolute path
|
151 |
+
*
|
152 |
+
* @param array $params Request parameters
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
+
function ai1wm_database_path( $params ) {
|
156 |
+
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_DATABASE_NAME;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Get error log absolute path
|
161 |
+
*
|
162 |
+
* @return string
|
163 |
+
*/
|
164 |
+
function ai1wm_error_path() {
|
165 |
+
return AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . AI1WM_ERROR_NAME;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Get status.js absolute path
|
170 |
+
*
|
171 |
+
* @return string
|
172 |
+
*/
|
173 |
+
function ai1wm_status_path() {
|
174 |
+
return AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . AI1WM_STATUS_NAME;
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Get archive name
|
179 |
+
*
|
180 |
+
* @param array $params Request parameters
|
181 |
+
* @return string
|
182 |
+
*/
|
183 |
+
function ai1wm_archive_name( $params ) {
|
184 |
+
return basename( $params['archive'] );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Get backups URL address
|
189 |
+
*
|
190 |
+
* @param array $params Request parameters
|
191 |
+
* @return string
|
192 |
+
*/
|
193 |
+
function ai1wm_backups_url( $params ) {
|
194 |
+
return AI1WM_BACKUPS_URL . '/' . ai1wm_archive_name( $params );
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Get archive size in bytes
|
199 |
+
*
|
200 |
+
* @param array $params Request parameters
|
201 |
+
* @return integer
|
202 |
+
*/
|
203 |
+
function ai1wm_archive_bytes( $params ) {
|
204 |
+
return filesize( ai1wm_archive_path( $params ) );
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Get download size in bytes
|
209 |
+
*
|
210 |
+
* @param array $params Request parameters
|
211 |
+
* @return integer
|
212 |
+
*/
|
213 |
+
function ai1wm_download_bytes( $params ) {
|
214 |
+
return filesize( ai1wm_download_path( $params ) );
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Get archive size as text
|
219 |
+
*
|
220 |
+
* @param array $params Request parameters
|
221 |
+
* @return string
|
222 |
+
*/
|
223 |
+
function ai1wm_archive_size( $params ) {
|
224 |
+
return size_format( filesize( ai1wm_archive_path( $params ) ) );
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Get download size as text
|
229 |
+
*
|
230 |
+
* @param array $params Request parameters
|
231 |
+
* @return string
|
232 |
+
*/
|
233 |
+
function ai1wm_download_size( $params ) {
|
234 |
+
return size_format( filesize( ai1wm_download_path( $params ) ) );
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Parse file size
|
239 |
+
*
|
240 |
+
* @param string $size File size
|
241 |
+
* @param string $default Default size
|
242 |
+
* @return string
|
243 |
+
*/
|
244 |
+
function ai1wm_parse_size( $size, $default = null ) {
|
245 |
+
$suffixes = array(
|
246 |
+
'' => 1,
|
247 |
+
'k' => 1000,
|
248 |
+
'm' => 1000000,
|
249 |
+
'g' => 1000000000,
|
250 |
+
);
|
251 |
+
|
252 |
+
// Parse size format
|
253 |
+
if ( preg_match( '/([0-9]+)\s*(k|m|g)?(b?(ytes?)?)/i', $size, $match ) ) {
|
254 |
+
return $match[1] * $suffixes[strtolower( $match[2] )];
|
255 |
+
}
|
256 |
+
|
257 |
+
return $default;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Get current site name
|
262 |
+
*
|
263 |
+
* @return string
|
264 |
+
*/
|
265 |
+
function ai1wm_site_name() {
|
266 |
+
return parse_url( site_url(), PHP_URL_HOST );
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Get archive file name
|
271 |
+
*
|
272 |
+
* @return string
|
273 |
+
*/
|
274 |
+
function ai1wm_archive_file() {
|
275 |
+
$site = parse_url( site_url() );
|
276 |
+
$name = array();
|
277 |
+
|
278 |
+
// Add domain
|
279 |
+
if ( isset( $site['host'] ) ) {
|
280 |
+
$name[] = $site['host'];
|
281 |
+
}
|
282 |
+
|
283 |
+
// Add path
|
284 |
+
if ( isset( $site['path'] ) ) {
|
285 |
+
$name[] = trim( $site['path'], '/' );
|
286 |
+
}
|
287 |
+
|
288 |
+
// Add year, month and day
|
289 |
+
$name[] = date( 'Ymd' );
|
290 |
+
|
291 |
+
// Add hours, minutes and seconds
|
292 |
+
$name[] = date( 'His' );
|
293 |
+
|
294 |
+
// Add unique identifier
|
295 |
+
$name[] = rand( 100, 999 );
|
296 |
+
|
297 |
+
return sprintf( '%s.wpress', implode( '-', $name ) );
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Get archive folder name
|
302 |
+
*
|
303 |
+
* @return string
|
304 |
+
*/
|
305 |
+
function ai1wm_archive_folder() {
|
306 |
+
$site = parse_url( site_url() );
|
307 |
+
$name = array();
|
308 |
+
|
309 |
+
// Add domain
|
310 |
+
if ( isset( $site['host'] ) ) {
|
311 |
+
$name[] = $site['host'];
|
312 |
+
}
|
313 |
+
|
314 |
+
// Add path
|
315 |
+
if ( isset( $site['path'] ) ) {
|
316 |
+
$name[] = trim( $site['path'] , '/' );
|
317 |
+
}
|
318 |
+
|
319 |
+
return implode( '-', $name );
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Get storage folder name
|
324 |
+
*
|
325 |
+
* @return string
|
326 |
+
*/
|
327 |
+
function ai1wm_storage_folder() {
|
328 |
+
return uniqid();
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* Check whether blog ID is main site
|
333 |
+
*
|
334 |
+
* @param integer $blog_id Blog ID
|
335 |
+
* @return boolean
|
336 |
+
*/
|
337 |
+
function ai1wm_main_site( $blog_id = null) {
|
338 |
+
return $blog_id === null || $blog_id === 0 || $blog_id === 1;
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Get sites absolute path by blog ID
|
343 |
+
*
|
344 |
+
* @param integer $blog_id Blog ID
|
345 |
+
* @return string
|
346 |
+
*/
|
347 |
+
function ai1wm_sites_path( $blog_id = null ) {
|
348 |
+
if ( ai1wm_main_site( $blog_id ) ) {
|
349 |
+
return AI1WM_UPLOADS_PATH;
|
350 |
+
}
|
351 |
+
|
352 |
+
return AI1WM_SITES_PATH . DIRECTORY_SEPARATOR . $blog_id;
|
353 |
+
}
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Get uploads absolute path by blog ID
|
357 |
+
*
|
358 |
+
* @param integer $blog_id Blog ID
|
359 |
+
* @return string
|
360 |
+
*/
|
361 |
+
function ai1wm_uploads_path( $blog_id = null ) {
|
362 |
+
if ( ai1wm_main_site( $blog_id ) ) {
|
363 |
+
return "/wp-content/uploads/";
|
364 |
+
}
|
365 |
+
|
366 |
+
return "/wp-content/uploads/sites/{$blog_id}/";
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Get uploads URL by blog ID
|
371 |
+
*
|
372 |
+
* @param integer $blog_id Blog ID
|
373 |
+
* @return string
|
374 |
+
*/
|
375 |
+
function ai1wm_uploads_url( $blog_id = null ) {
|
376 |
+
if ( ai1wm_main_site( $blog_id ) ) {
|
377 |
+
return get_site_url( $blog_id, "/wp-content/uploads/" );
|
378 |
+
}
|
379 |
+
|
380 |
+
return get_site_url( $blog_id, "/wp-content/uploads/sites/{$blog_id}/" );
|
381 |
+
}
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Get ServMask table prefix by blog ID
|
385 |
+
*
|
386 |
+
* @param integer $blog_id Blog ID
|
387 |
+
* @return string
|
388 |
+
*/
|
389 |
+
function ai1wm_servmask_prefix( $blog_id = null ) {
|
390 |
+
// Set base table prefix
|
391 |
+
if ( ai1wm_main_site( $blog_id ) ) {
|
392 |
+
return AI1WM_TABLE_PREFIX;
|
393 |
+
}
|
394 |
+
|
395 |
+
return AI1WM_TABLE_PREFIX . $blog_id . '_';
|
396 |
+
}
|
397 |
+
|
398 |
+
/**
|
399 |
+
* Get WordPress table prefix by blog ID
|
400 |
+
*
|
401 |
+
* @param integer $blog_id Blog ID
|
402 |
+
* @return string
|
403 |
+
*/
|
404 |
+
function ai1wm_table_prefix( $blog_id = null ) {
|
405 |
+
global $wpdb;
|
406 |
+
|
407 |
+
// Set base table prefix
|
408 |
+
if ( ai1wm_main_site( $blog_id ) ) {
|
409 |
+
return $wpdb->base_prefix;
|
410 |
+
}
|
411 |
+
|
412 |
+
return $wpdb->base_prefix . $blog_id . '_';
|
413 |
+
}
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Get default content filters
|
417 |
+
*
|
418 |
+
* @param array $filters List of files and directories
|
419 |
+
* @return array
|
420 |
+
*/
|
421 |
+
function ai1wm_content_filters( $filters = array() ) {
|
422 |
+
return array_merge( $filters, array(
|
423 |
+
'index.php',
|
424 |
+
'ai1wm-backups',
|
425 |
+
'themes' . DIRECTORY_SEPARATOR . 'index.php',
|
426 |
+
'plugins' . DIRECTORY_SEPARATOR . 'index.php',
|
427 |
+
'uploads' . DIRECTORY_SEPARATOR . 'index.php',
|
428 |
+
) );
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* Get default plugin filters
|
433 |
+
*
|
434 |
+
* @param array $filters List of plugins
|
435 |
+
* @return array
|
436 |
+
*/
|
437 |
+
function ai1wm_plugin_filters( $filters = array() ) {
|
438 |
+
// WP Migration Plugin
|
439 |
+
if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) {
|
440 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WM_PLUGIN_BASENAME );
|
441 |
+
} else {
|
442 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration';
|
443 |
+
}
|
444 |
+
|
445 |
+
// Dropbox Extension
|
446 |
+
if ( defined( 'AI1WMDE_PLUGIN_BASENAME' ) ) {
|
447 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMDE_PLUGIN_BASENAME );
|
448 |
+
} else {
|
449 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-dropbox-extension';
|
450 |
+
}
|
451 |
+
|
452 |
+
// Google Drive Extension
|
453 |
+
if ( defined( 'AI1WMGE_PLUGIN_BASENAME' ) ) {
|
454 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMGE_PLUGIN_BASENAME );
|
455 |
+
} else {
|
456 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-gdrive-extension';
|
457 |
+
}
|
458 |
+
|
459 |
+
// Amazon S3 Extension
|
460 |
+
if ( defined( 'AI1WMSE_PLUGIN_BASENAME' ) ) {
|
461 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMSE_PLUGIN_BASENAME );
|
462 |
+
} else {
|
463 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-s3-extension';
|
464 |
+
}
|
465 |
+
|
466 |
+
// Multisite Extension
|
467 |
+
if ( defined( 'AI1WMME_PLUGIN_BASENAME' ) ) {
|
468 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMME_PLUGIN_BASENAME );
|
469 |
+
} else {
|
470 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-multisite-extension';
|
471 |
+
}
|
472 |
+
|
473 |
+
// Unlimited Extension
|
474 |
+
if ( defined( 'AI1WMUE_PLUGIN_BASENAME' ) ) {
|
475 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMUE_PLUGIN_BASENAME );
|
476 |
+
} else {
|
477 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-unlimited-extension';
|
478 |
+
}
|
479 |
+
|
480 |
+
// FTP Extension
|
481 |
+
if ( defined( 'AI1WMFE_PLUGIN_BASENAME' ) ) {
|
482 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMFE_PLUGIN_BASENAME );
|
483 |
+
} else {
|
484 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-ftp-extension';
|
485 |
+
}
|
486 |
+
|
487 |
+
// URL Extension
|
488 |
+
if ( defined( 'AI1WMLE_PLUGIN_BASENAME' ) ) {
|
489 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMLE_PLUGIN_BASENAME );
|
490 |
+
} else {
|
491 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-url-extension';
|
492 |
+
}
|
493 |
+
|
494 |
+
// OneDrive Extension
|
495 |
+
if ( defined( 'AI1WMOE_PLUGIN_BASENAME' ) ) {
|
496 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMOE_PLUGIN_BASENAME );
|
497 |
+
} else {
|
498 |
+
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-onedrive-extension';
|
499 |
+
}
|
500 |
+
|
501 |
+
return $filters;
|
502 |
}
|
503 |
|
504 |
/**
|
555 |
|
556 |
return $plugins;
|
557 |
}
|
558 |
+
|
559 |
+
/**
|
560 |
+
* URL encode
|
561 |
+
*
|
562 |
+
* @param mixed $value Value to encode
|
563 |
+
* @return mixed
|
564 |
+
*/
|
565 |
+
function ai1wm_urlencode( $value ) {
|
566 |
+
return is_array( $value ) ? array_map( 'ai1wm_urlencode', $value ) : urlencode( $value );
|
567 |
+
}
|
568 |
+
|
569 |
+
/**
|
570 |
+
* URL decode
|
571 |
+
*
|
572 |
+
* @param mixed $value Value to decode
|
573 |
+
* @return mixed
|
574 |
+
*/
|
575 |
+
function ai1wm_urldecode( $value ) {
|
576 |
+
return is_array( $value ) ? array_map( 'ai1wm_urldecode', $value ) : urldecode( stripslashes( $value ) );
|
577 |
+
}
|
lib/controller/{class-ai1wm-backup-controller.php → class-ai1wm-backups-controller.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,10 +23,10 @@
|
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
-
class
|
27 |
|
28 |
public static function index() {
|
29 |
-
$model = new
|
30 |
|
31 |
// Username
|
32 |
if ( isset( $_POST['ai1wm-username'] ) ) {
|
@@ -39,7 +39,7 @@ class Ai1wm_Backup_Controller {
|
|
39 |
}
|
40 |
|
41 |
Ai1wm_Template::render(
|
42 |
-
'
|
43 |
array(
|
44 |
'backups' => $model->get_files(),
|
45 |
'free_space' => $model->get_free_space(),
|
@@ -53,17 +53,17 @@ class Ai1wm_Backup_Controller {
|
|
53 |
public static function delete() {
|
54 |
$response = array( 'errors' => array() );
|
55 |
|
56 |
-
// Set
|
57 |
-
$
|
58 |
-
if ( isset( $_POST['
|
59 |
-
$
|
60 |
}
|
61 |
|
62 |
-
$model
|
63 |
|
64 |
try {
|
65 |
// Delete file
|
66 |
-
$model->delete_file( $
|
67 |
} catch ( Exception $e ) {
|
68 |
$response['errors'][] = $e->getMessage();
|
69 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Backups_Controller {
|
27 |
|
28 |
public static function index() {
|
29 |
+
$model = new Ai1wm_Backups;
|
30 |
|
31 |
// Username
|
32 |
if ( isset( $_POST['ai1wm-username'] ) ) {
|
39 |
}
|
40 |
|
41 |
Ai1wm_Template::render(
|
42 |
+
'backups/index',
|
43 |
array(
|
44 |
'backups' => $model->get_files(),
|
45 |
'free_space' => $model->get_free_space(),
|
53 |
public static function delete() {
|
54 |
$response = array( 'errors' => array() );
|
55 |
|
56 |
+
// Set archive
|
57 |
+
$archive = null;
|
58 |
+
if ( isset( $_POST['archive'] ) ) {
|
59 |
+
$archive = trim( $_POST['archive'] );
|
60 |
}
|
61 |
|
62 |
+
$model = new Ai1wm_Backups;
|
63 |
|
64 |
try {
|
65 |
// Delete file
|
66 |
+
$model->delete_file( $archive );
|
67 |
} catch ( Exception $e ) {
|
68 |
$response['errors'][] = $e->getMessage();
|
69 |
}
|
lib/controller/class-ai1wm-export-controller.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -26,101 +26,71 @@
|
|
26 |
class Ai1wm_Export_Controller {
|
27 |
|
28 |
public static function index() {
|
29 |
-
|
30 |
-
$model = new Ai1wm_Message;
|
31 |
-
|
32 |
-
Ai1wm_Template::render(
|
33 |
-
'export/index',
|
34 |
-
array(
|
35 |
-
'messages' => $model->get_messages(),
|
36 |
-
)
|
37 |
-
);
|
38 |
}
|
39 |
|
40 |
-
public static function export( $
|
|
|
41 |
|
42 |
// Set error handler
|
43 |
-
@set_error_handler( '
|
44 |
-
|
45 |
-
try {
|
46 |
-
|
47 |
-
// Set arguments
|
48 |
-
if ( empty( $args ) ) {
|
49 |
-
$args = ai1wm_urldecode( $_REQUEST );
|
50 |
-
}
|
51 |
-
|
52 |
-
// Set storage path
|
53 |
-
if ( empty( $args['storage'] ) ) {
|
54 |
-
$args['storage'] = uniqid();
|
55 |
-
}
|
56 |
-
|
57 |
-
// Set secret key
|
58 |
-
$secret_key = null;
|
59 |
-
if ( isset( $args['secret_key'] ) ) {
|
60 |
-
$secret_key = $args['secret_key'];
|
61 |
-
}
|
62 |
-
|
63 |
-
// Verify secret key by using the value in the database, not in cache
|
64 |
-
if ( $secret_key !== get_site_option( AI1WM_SECRET_KEY, false, false ) ) {
|
65 |
-
throw new Ai1wm_Export_Exception(
|
66 |
-
sprintf(
|
67 |
-
__( 'Unable to authenticate your request with secret_key = %s', AI1WM_PLUGIN_NAME ),
|
68 |
-
$secret_key
|
69 |
-
)
|
70 |
-
);
|
71 |
-
}
|
72 |
-
|
73 |
-
// Set provider
|
74 |
-
$provider = null;
|
75 |
-
if ( isset( $args['provider'] ) ) {
|
76 |
-
$provider = $args['provider'];
|
77 |
-
}
|
78 |
-
|
79 |
-
$class = "Ai1wm_Export_$provider";
|
80 |
-
if ( ! class_exists( $class ) ) {
|
81 |
-
throw new Ai1wm_Export_Exception(
|
82 |
-
sprintf(
|
83 |
-
__( 'Unknown provider: <strong>"%s"</strong>', AI1WM_PLUGIN_NAME ),
|
84 |
-
$class
|
85 |
-
)
|
86 |
-
);
|
87 |
-
}
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
}
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
__( 'Unknown method: <strong>"%s"</strong>', AI1WM_PLUGIN_NAME ),
|
101 |
-
$method
|
102 |
-
)
|
103 |
-
);
|
104 |
-
}
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
Ai1wm_Log::error( 'Exception while exporting: ' . $e->getMessage() );
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
'message' => $e->getMessage(),
|
119 |
-
)
|
120 |
);
|
|
|
|
|
121 |
|
122 |
-
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
}
|
126 |
|
@@ -131,6 +101,7 @@ class Ai1wm_Export_Controller {
|
|
131 |
apply_filters( 'ai1wm_export_dropbox', Ai1wm_Template::get_content( 'export/button-dropbox' ) ),
|
132 |
apply_filters( 'ai1wm_export_gdrive', Ai1wm_Template::get_content( 'export/button-gdrive' ) ),
|
133 |
apply_filters( 'ai1wm_export_s3', Ai1wm_Template::get_content( 'export/button-s3' ) ),
|
|
|
134 |
);
|
135 |
}
|
136 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
26 |
class Ai1wm_Export_Controller {
|
27 |
|
28 |
public static function index() {
|
29 |
+
Ai1wm_Template::render( 'export/index' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
+
public static function export( $params = array() ) {
|
33 |
+
global $wp_filter;
|
34 |
|
35 |
// Set error handler
|
36 |
+
@set_error_handler( 'Ai1wm_Handler::error' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
// Set params
|
39 |
+
if ( empty( $params ) ) {
|
40 |
+
$params = ai1wm_urldecode( $_REQUEST );
|
41 |
+
}
|
|
|
42 |
|
43 |
+
// Set priority
|
44 |
+
$priority = 5;
|
45 |
+
if ( isset( $params['priority'] ) ) {
|
46 |
+
$priority = (int) $params['priority'];
|
47 |
+
}
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
+
// Set secret key
|
50 |
+
$secret_key = null;
|
51 |
+
if ( isset( $params['secret_key'] ) ) {
|
52 |
+
$secret_key = $params['secret_key'];
|
53 |
+
}
|
|
|
54 |
|
55 |
+
// Verify secret key by using the value in the database, not in cache
|
56 |
+
if ( $secret_key !== get_site_option( AI1WM_SECRET_KEY, false, false ) ) {
|
57 |
+
Ai1wm_Status::error(
|
58 |
+
__( "Unable to authenticate your request with secret_key = \"{$secret_key}\"", AI1WM_PLUGIN_NAME ),
|
59 |
+
__( "Unable to export", AI1WM_PLUGIN_NAME )
|
|
|
|
|
60 |
);
|
61 |
+
exit;
|
62 |
+
}
|
63 |
|
64 |
+
// Get hook
|
65 |
+
if ( isset( $wp_filter['ai1wm_export'] ) && ( $filters = $wp_filter['ai1wm_export'] ) && ksort( $filters ) ) {
|
66 |
+
while ( $hooks = current( $filters ) ) {
|
67 |
+
if ( $priority == key( $filters ) ) {
|
68 |
+
foreach ( $hooks as $hook ) {
|
69 |
+
try {
|
70 |
+
$params = call_user_func_array( $hook['function'], array( $params ) );
|
71 |
+
} catch ( Exception $e ) {
|
72 |
+
Ai1wm_Status::error( $e->getMessage(), __( 'Unable to export', AI1WM_PLUGIN_NAME ) );
|
73 |
+
exit;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
// Set completed
|
78 |
+
$completed = true;
|
79 |
+
if ( isset( $params['completed'] ) ) {
|
80 |
+
$completed = (bool) $params['completed'];
|
81 |
+
}
|
82 |
+
|
83 |
+
// Log request
|
84 |
+
Ai1wm_Log::export( $params );
|
85 |
+
|
86 |
+
// Do request
|
87 |
+
if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
|
88 |
+
return Ai1wm_Http::get( admin_url( 'admin-ajax.php?action=ai1wm_export' ), $params );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
next( $filters );
|
93 |
+
}
|
94 |
}
|
95 |
}
|
96 |
|
101 |
apply_filters( 'ai1wm_export_dropbox', Ai1wm_Template::get_content( 'export/button-dropbox' ) ),
|
102 |
apply_filters( 'ai1wm_export_gdrive', Ai1wm_Template::get_content( 'export/button-gdrive' ) ),
|
103 |
apply_filters( 'ai1wm_export_s3', Ai1wm_Template::get_content( 'export/button-s3' ) ),
|
104 |
+
apply_filters( 'ai1wm_export_onedrive', Ai1wm_Template::get_content( 'export/button-onedrive' ) ),
|
105 |
);
|
106 |
}
|
107 |
}
|
lib/controller/class-ai1wm-feedback-controller.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -25,34 +25,35 @@
|
|
25 |
|
26 |
class Ai1wm_Feedback_Controller {
|
27 |
|
28 |
-
public static function
|
|
|
29 |
// Set Type
|
30 |
$type = null;
|
31 |
-
if ( isset( $_POST['type'] ) ) {
|
32 |
-
$type = trim( $_POST['type'] );
|
33 |
}
|
34 |
|
35 |
// Set E-mail
|
36 |
$email = null;
|
37 |
-
if ( isset( $_POST['email'] ) ) {
|
38 |
-
$email = trim( $_POST['email'] );
|
39 |
}
|
40 |
|
41 |
// Set Message
|
42 |
$message = null;
|
43 |
-
if ( isset( $_POST['message'] ) ) {
|
44 |
-
$message = trim( $_POST['message'] );
|
45 |
}
|
46 |
|
47 |
// Set Terms
|
48 |
$terms = false;
|
49 |
-
if ( isset( $_POST['terms'] ) ) {
|
50 |
-
$terms = (bool) $_POST['terms'];
|
51 |
}
|
52 |
|
53 |
// Send Feedback
|
54 |
$model = new Ai1wm_Feedback;
|
55 |
-
$result = $model->
|
56 |
|
57 |
echo json_encode( $result );
|
58 |
exit;
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
25 |
|
26 |
class Ai1wm_Feedback_Controller {
|
27 |
|
28 |
+
public static function feedback() {
|
29 |
+
|
30 |
// Set Type
|
31 |
$type = null;
|
32 |
+
if ( isset( $_POST['ai1wm-type'] ) ) {
|
33 |
+
$type = trim( $_POST['ai1wm-type'] );
|
34 |
}
|
35 |
|
36 |
// Set E-mail
|
37 |
$email = null;
|
38 |
+
if ( isset( $_POST['ai1wm-email'] ) ) {
|
39 |
+
$email = trim( $_POST['ai1wm-email'] );
|
40 |
}
|
41 |
|
42 |
// Set Message
|
43 |
$message = null;
|
44 |
+
if ( isset( $_POST['ai1wm-message'] ) ) {
|
45 |
+
$message = trim( $_POST['ai1wm-message'] );
|
46 |
}
|
47 |
|
48 |
// Set Terms
|
49 |
$terms = false;
|
50 |
+
if ( isset( $_POST['ai1wm-terms'] ) ) {
|
51 |
+
$terms = (bool) $_POST['ai1wm-terms'];
|
52 |
}
|
53 |
|
54 |
// Send Feedback
|
55 |
$model = new Ai1wm_Feedback;
|
56 |
+
$result = $model->add( $type, $email, $message, $terms );
|
57 |
|
58 |
echo json_encode( $result );
|
59 |
exit;
|
lib/controller/class-ai1wm-import-controller.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -29,90 +29,68 @@ class Ai1wm_Import_Controller {
|
|
29 |
Ai1wm_Template::render( 'import/index' );
|
30 |
}
|
31 |
|
32 |
-
public static function import( $
|
|
|
33 |
|
34 |
// Set error handler
|
35 |
-
@set_error_handler( '
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
$args = ai1wm_urldecode( $_REQUEST );
|
42 |
-
}
|
43 |
-
|
44 |
-
// Set storage path
|
45 |
-
if ( empty( $args['storage'] ) ) {
|
46 |
-
$args['storage'] = uniqid();
|
47 |
-
}
|
48 |
-
|
49 |
-
// Set secret key
|
50 |
-
$secret_key = null;
|
51 |
-
if ( isset( $args['secret_key'] ) ) {
|
52 |
-
$secret_key = $args['secret_key'];
|
53 |
-
}
|
54 |
-
|
55 |
-
// Verify secret key by using the value in the database, not in cache
|
56 |
-
if ( $secret_key !== get_site_option( AI1WM_SECRET_KEY, false, false ) ) {
|
57 |
-
throw new Ai1wm_Import_Exception(
|
58 |
-
sprintf(
|
59 |
-
__( 'Unable to authenticate your request with secret_key = <strong>"%s"</strong>', AI1WM_PLUGIN_NAME ),
|
60 |
-
$secret_key
|
61 |
-
)
|
62 |
-
);
|
63 |
-
}
|
64 |
-
|
65 |
-
// Set provider
|
66 |
-
$provider = null;
|
67 |
-
if ( isset( $args['provider'] ) ) {
|
68 |
-
$provider = $args['provider'];
|
69 |
-
}
|
70 |
-
|
71 |
-
$class = "Ai1wm_Import_$provider";
|
72 |
-
if ( ! class_exists( $class ) ) {
|
73 |
-
throw new Ai1wm_Import_Exception(
|
74 |
-
sprintf(
|
75 |
-
__( 'Unknown provider: <strong>"%s"</strong>', AI1WM_PLUGIN_NAME ),
|
76 |
-
$class
|
77 |
-
)
|
78 |
-
);
|
79 |
-
}
|
80 |
-
|
81 |
-
// Set method
|
82 |
-
$method = null;
|
83 |
-
if ( isset( $args['method'] ) ) {
|
84 |
-
$method = $args['method'];
|
85 |
-
}
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
__( 'Unknown method: <strong>"%s"</strong>', AI1WM_PLUGIN_NAME ),
|
93 |
-
$method
|
94 |
-
)
|
95 |
-
);
|
96 |
-
}
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
Ai1wm_Log::error( 'Exception while importing: ' . $e->getMessage() );
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
'message' => $e->getMessage(),
|
111 |
-
)
|
112 |
);
|
|
|
|
|
113 |
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
}
|
118 |
|
@@ -124,29 +102,15 @@ class Ai1wm_Import_Controller {
|
|
124 |
apply_filters( 'ai1wm_import_dropbox', Ai1wm_Template::get_content( 'import/button-dropbox' ) ),
|
125 |
apply_filters( 'ai1wm_import_gdrive', Ai1wm_Template::get_content( 'import/button-gdrive' ) ),
|
126 |
apply_filters( 'ai1wm_import_s3', Ai1wm_Template::get_content( 'import/button-s3' ) ),
|
|
|
127 |
);
|
128 |
}
|
129 |
|
130 |
public static function max_chunk_size() {
|
131 |
return min(
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
);
|
136 |
-
}
|
137 |
-
|
138 |
-
protected static function parse_size( $size ) {
|
139 |
-
$suffixes = array(
|
140 |
-
'' => 1,
|
141 |
-
'k' => 1000,
|
142 |
-
'm' => 1000000,
|
143 |
-
'g' => 1000000000,
|
144 |
);
|
145 |
-
|
146 |
-
if ( preg_match( '/([0-9]+)\s*(k|m|g)?(b?(ytes?)?)/i', $size, $match ) ) {
|
147 |
-
return $match[1] * $suffixes[strtolower( $match[2] )];
|
148 |
-
}
|
149 |
-
|
150 |
-
return AI1WM_MAX_CHUNK_SIZE;
|
151 |
}
|
152 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
29 |
Ai1wm_Template::render( 'import/index' );
|
30 |
}
|
31 |
|
32 |
+
public static function import( $params = array() ) {
|
33 |
+
global $wp_filter;
|
34 |
|
35 |
// Set error handler
|
36 |
+
@set_error_handler( 'Ai1wm_Handler::error' );
|
37 |
|
38 |
+
// Set params
|
39 |
+
if ( empty( $params ) ) {
|
40 |
+
$params = ai1wm_urldecode( $_REQUEST );
|
41 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
+
// Set priority
|
44 |
+
$priority = 10;
|
45 |
+
if ( isset( $params['priority'] ) ) {
|
46 |
+
$priority = (int) $params['priority'];
|
47 |
+
}
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
+
// Set secret key
|
50 |
+
$secret_key = null;
|
51 |
+
if ( isset( $params['secret_key'] ) ) {
|
52 |
+
$secret_key = $params['secret_key'];
|
53 |
+
}
|
|
|
54 |
|
55 |
+
// Verify secret key by using the value in the database, not in cache
|
56 |
+
if ( $secret_key !== get_site_option( AI1WM_SECRET_KEY, false, false ) ) {
|
57 |
+
Ai1wm_Status::error(
|
58 |
+
__( "Unable to authenticate your request with secret_key = \"{$secret_key}\"", AI1WM_PLUGIN_NAME ),
|
59 |
+
__( "Unable to import", AI1WM_PLUGIN_NAME )
|
|
|
|
|
60 |
);
|
61 |
+
exit;
|
62 |
+
}
|
63 |
|
64 |
+
// Get hook
|
65 |
+
if ( isset( $wp_filter['ai1wm_import'] ) && ( $filters = $wp_filter['ai1wm_import'] ) && ksort( $filters ) ) {
|
66 |
+
while ( $hooks = current( $filters ) ) {
|
67 |
+
if ( $priority == key( $filters ) ) {
|
68 |
+
foreach ( $hooks as $hook ) {
|
69 |
+
try {
|
70 |
+
$params = call_user_func_array( $hook['function'], array( $params ) );
|
71 |
+
} catch ( Exception $e ) {
|
72 |
+
Ai1wm_Status::error( $e->getMessage(), __( 'Unable to import', AI1WM_PLUGIN_NAME ) );
|
73 |
+
exit;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
// Set completed
|
78 |
+
$completed = true;
|
79 |
+
if ( isset( $params['completed'] ) ) {
|
80 |
+
$completed = (bool) $params['completed'];
|
81 |
+
}
|
82 |
+
|
83 |
+
// Log request
|
84 |
+
Ai1wm_Log::import( $params );
|
85 |
+
|
86 |
+
// Do request
|
87 |
+
if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
|
88 |
+
return Ai1wm_Http::get( admin_url( 'admin-ajax.php?action=ai1wm_import' ), $params );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
next( $filters );
|
93 |
+
}
|
94 |
}
|
95 |
}
|
96 |
|
102 |
apply_filters( 'ai1wm_import_dropbox', Ai1wm_Template::get_content( 'import/button-dropbox' ) ),
|
103 |
apply_filters( 'ai1wm_import_gdrive', Ai1wm_Template::get_content( 'import/button-gdrive' ) ),
|
104 |
apply_filters( 'ai1wm_import_s3', Ai1wm_Template::get_content( 'import/button-s3' ) ),
|
105 |
+
apply_filters( 'ai1wm_import_onedrive', Ai1wm_Template::get_content( 'import/button-onedrive' ) ),
|
106 |
);
|
107 |
}
|
108 |
|
109 |
public static function max_chunk_size() {
|
110 |
return min(
|
111 |
+
ai1wm_parse_size( ini_get( 'post_max_size' ), AI1WM_MAX_CHUNK_SIZE ),
|
112 |
+
ai1wm_parse_size( ini_get( 'upload_max_filesize' ), AI1WM_MAX_CHUNK_SIZE ),
|
113 |
+
ai1wm_parse_size( AI1WM_MAX_CHUNK_SIZE )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
}
|
lib/controller/class-ai1wm-main-controller.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -65,24 +65,26 @@ class Ai1wm_Main_Controller {
|
|
65 |
* @return Object Instance of this class
|
66 |
*/
|
67 |
private function activate_actions() {
|
68 |
-
|
69 |
-
if ( apply_filters( 'ai1wm_multisite_menu', false ) ) {
|
70 |
-
add_action( 'network_admin_menu', array( $this, 'admin_menu' ) );
|
71 |
-
} else {
|
72 |
-
add_action( 'network_admin_notices', array( $this, 'multisite_notice' ) );
|
73 |
-
}
|
74 |
-
} else {
|
75 |
-
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
76 |
-
}
|
77 |
-
|
78 |
add_action( 'admin_init', array( $this, 'init' ) );
|
|
|
|
|
79 |
add_action( 'admin_init', array( $this, 'router' ) );
|
80 |
-
|
|
|
81 |
add_action( 'admin_head', array( $this, 'admin_head' ) );
|
82 |
-
add_action( 'get_header', array( $this, 'get_header' ) );
|
83 |
|
84 |
-
//
|
85 |
-
add_action( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
// Add updater scripts and styles
|
88 |
add_action( 'admin_enqueue_scripts', array( $this, 'register_updater_scripts_and_styles' ) );
|
@@ -99,11 +101,69 @@ class Ai1wm_Main_Controller {
|
|
99 |
// Add a links to plugin list page
|
100 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
// Add export buttons
|
103 |
add_filter( 'ai1wm_export_buttons', 'Ai1wm_Export_Controller::buttons' );
|
104 |
|
105 |
// Add import buttons
|
106 |
add_filter( 'ai1wm_import_buttons', 'Ai1wm_Import_Controller::buttons' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
// Add chunk size limit
|
109 |
add_filter( 'ai1wm_max_chunk_size', 'Ai1wm_Import_Controller::max_chunk_size' );
|
@@ -119,8 +179,6 @@ class Ai1wm_Main_Controller {
|
|
119 |
|
120 |
// Add "Check for updates" link to plugin list page
|
121 |
add_filter( 'plugin_row_meta', 'Ai1wm_Updater_Controller::plugin_row_meta', 10, 2 );
|
122 |
-
|
123 |
-
return $this;
|
124 |
}
|
125 |
|
126 |
/**
|
@@ -172,83 +230,6 @@ class Ai1wm_Main_Controller {
|
|
172 |
return $links;
|
173 |
}
|
174 |
|
175 |
-
/**
|
176 |
-
* Show maintenance page
|
177 |
-
*
|
178 |
-
* @return void
|
179 |
-
*/
|
180 |
-
public function get_header() {
|
181 |
-
Ai1wm_Maintenance::display();
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Register initial parameters
|
186 |
-
*
|
187 |
-
* @return void
|
188 |
-
*/
|
189 |
-
public function init() {
|
190 |
-
// Set secret key
|
191 |
-
if ( ! get_site_option( AI1WM_SECRET_KEY, false, false ) ) {
|
192 |
-
update_site_option( AI1WM_SECRET_KEY, wp_generate_password( 12, false ) );
|
193 |
-
}
|
194 |
-
|
195 |
-
// Set username
|
196 |
-
if ( isset( $_SERVER['PHP_AUTH_USER'] ) ) {
|
197 |
-
update_site_option( AI1WM_AUTH_USER, $_SERVER['PHP_AUTH_USER'] );
|
198 |
-
} else if ( isset( $_SERVER['REMOTE_USER'] ) ) {
|
199 |
-
update_site_option( AI1WM_AUTH_USER, $_SERVER['REMOTE_USER'] );
|
200 |
-
}
|
201 |
-
|
202 |
-
// Set password
|
203 |
-
if ( isset( $_SERVER['PHP_AUTH_PW'] ) ) {
|
204 |
-
update_site_option( AI1WM_AUTH_PASSWORD, $_SERVER['PHP_AUTH_PW'] );
|
205 |
-
}
|
206 |
-
|
207 |
-
// Check for updates
|
208 |
-
if ( isset( $_GET['ai1wm_updater'] ) ) {
|
209 |
-
if ( current_user_can( 'update_plugins' ) && check_admin_referer( 'ai1wm_updater_nonce' ) ) {
|
210 |
-
Ai1wm_Updater::check_for_updates();
|
211 |
-
}
|
212 |
-
}
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Register initial router
|
217 |
-
*
|
218 |
-
* @return void
|
219 |
-
*/
|
220 |
-
public function router() {
|
221 |
-
// Public
|
222 |
-
add_action( 'wp_ajax_nopriv_ai1wm_export', 'Ai1wm_Export_Controller::export' );
|
223 |
-
add_action( 'wp_ajax_nopriv_ai1wm_import', 'Ai1wm_Import_Controller::import' );
|
224 |
-
add_action( 'wp_ajax_nopriv_ai1wm_resolve', 'Ai1wm_Resolve_Controller::resolve' );
|
225 |
-
|
226 |
-
// Update
|
227 |
-
if ( current_user_can( 'update_plugins' ) ) {
|
228 |
-
add_action( 'wp_ajax_ai1wm_updater', 'Ai1wm_Updater_Controller::updater' );
|
229 |
-
}
|
230 |
-
|
231 |
-
// Export
|
232 |
-
if ( current_user_can( 'export' ) ) {
|
233 |
-
add_action( 'wp_ajax_ai1wm_export', 'Ai1wm_Export_Controller::export' );
|
234 |
-
}
|
235 |
-
|
236 |
-
// Import
|
237 |
-
if ( current_user_can( 'import' ) ) {
|
238 |
-
add_action( 'wp_ajax_ai1wm_import', 'Ai1wm_Import_Controller::import' );
|
239 |
-
}
|
240 |
-
|
241 |
-
// Both
|
242 |
-
if ( current_user_can( 'export' ) || current_user_can( 'import' ) ) {
|
243 |
-
add_action( 'wp_ajax_ai1wm_backup_delete', 'Ai1wm_Backup_Controller::delete' );
|
244 |
-
add_action( 'wp_ajax_ai1wm_leave_feedback', 'Ai1wm_Feedback_Controller::leave_feedback' );
|
245 |
-
add_action( 'wp_ajax_ai1wm_report_problem', 'Ai1wm_Report_Controller::report_problem' );
|
246 |
-
add_action( 'wp_ajax_ai1wm_close_message', 'Ai1wm_Message_Controller::close_message' );
|
247 |
-
add_action( 'wp_ajax_ai1wm_disable_maintenance', 'Ai1wm_Maintenance::disable' );
|
248 |
-
add_action( 'wp_ajax_ai1wm_resolve', 'Ai1wm_Resolve_Controller::resolve' );
|
249 |
-
}
|
250 |
-
}
|
251 |
-
|
252 |
/**
|
253 |
* Create folders needed for plugin operation, if they don't exist
|
254 |
*
|
@@ -256,7 +237,7 @@ class Ai1wm_Main_Controller {
|
|
256 |
*/
|
257 |
public function create_folders() {
|
258 |
// Check if storage folder exist
|
259 |
-
if ( !
|
260 |
|
261 |
// Folder doesn't exist, attempt to create it
|
262 |
if ( ! mkdir( AI1WM_STORAGE_PATH ) ) {
|
@@ -274,7 +255,7 @@ class Ai1wm_Main_Controller {
|
|
274 |
Ai1wm_File_Index::create( AI1WM_STORAGE_INDEX );
|
275 |
|
276 |
// Check if backups folder exist
|
277 |
-
if ( !
|
278 |
|
279 |
// Folder doesn't exist, attempt to create it
|
280 |
if ( ! mkdir( AI1WM_BACKUPS_PATH ) ) {
|
@@ -290,6 +271,9 @@ class Ai1wm_Main_Controller {
|
|
290 |
|
291 |
// Create index.php in backups folder
|
292 |
Ai1wm_File_Index::create( AI1WM_BACKUPS_INDEX );
|
|
|
|
|
|
|
293 |
}
|
294 |
|
295 |
/**
|
@@ -307,7 +291,7 @@ class Ai1wm_Main_Controller {
|
|
307 |
$file = $path . DIRECTORY_SEPARATOR . AI1WM_DIRECTORY_INDEX;
|
308 |
|
309 |
// Check if the file exists
|
310 |
-
if ( !
|
311 |
|
312 |
// File doesn't exist attempt to create ti
|
313 |
$handle = fopen( $file, 'w' );
|
@@ -344,6 +328,7 @@ class Ai1wm_Main_Controller {
|
|
344 |
'',
|
345 |
'76.295'
|
346 |
);
|
|
|
347 |
// sublevel Export menu
|
348 |
$export_page_hook_suffix = add_submenu_page(
|
349 |
'site-migration-export',
|
@@ -357,6 +342,7 @@ class Ai1wm_Main_Controller {
|
|
357 |
'admin_print_scripts-' . $export_page_hook_suffix,
|
358 |
array( $this, 'register_export_scripts_and_styles' )
|
359 |
);
|
|
|
360 |
// sublevel Import menu
|
361 |
$import_page_hook_suffix = add_submenu_page(
|
362 |
'site-migration-export',
|
@@ -370,32 +356,22 @@ class Ai1wm_Main_Controller {
|
|
370 |
'admin_print_scripts-' . $import_page_hook_suffix,
|
371 |
array( $this, 'register_import_scripts_and_styles' )
|
372 |
);
|
|
|
373 |
// sublevel Backups menu
|
374 |
-
$
|
375 |
'site-migration-export',
|
376 |
__( 'Backups', AI1WM_PLUGIN_NAME ),
|
377 |
__( 'Backups', AI1WM_PLUGIN_NAME ),
|
378 |
-
'
|
379 |
-
'site-migration-
|
380 |
-
'
|
381 |
);
|
382 |
add_action(
|
383 |
-
'admin_print_scripts-' . $
|
384 |
-
array( $this, '
|
385 |
);
|
386 |
}
|
387 |
|
388 |
-
/**
|
389 |
-
* Outputs menu icon between head tags
|
390 |
-
*
|
391 |
-
* @return void
|
392 |
-
*/
|
393 |
-
public function admin_head() {
|
394 |
-
global $wp_version;
|
395 |
-
|
396 |
-
Ai1wm_Template::render( 'main/admin-head', array( 'version' => $wp_version ) );
|
397 |
-
}
|
398 |
-
|
399 |
/**
|
400 |
* Register scripts and styles for Export Controller
|
401 |
*
|
@@ -418,22 +394,12 @@ class Ai1wm_Main_Controller {
|
|
418 |
);
|
419 |
wp_localize_script( 'ai1wm-js-export', 'ai1wm_feedback', array(
|
420 |
'ajax' => array(
|
421 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=
|
422 |
),
|
423 |
) );
|
424 |
wp_localize_script( 'ai1wm-js-export', 'ai1wm_report', array(
|
425 |
'ajax' => array(
|
426 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=
|
427 |
-
),
|
428 |
-
) );
|
429 |
-
wp_localize_script( 'ai1wm-js-export', 'ai1wm_message', array(
|
430 |
-
'ajax' => array(
|
431 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_close_message' ) ),
|
432 |
-
),
|
433 |
-
) );
|
434 |
-
wp_localize_script( 'ai1wm-js-export', 'ai1wm_maintenance', array(
|
435 |
-
'ajax' => array(
|
436 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_disable_maintenance' ) ),
|
437 |
),
|
438 |
) );
|
439 |
wp_localize_script( 'ai1wm-js-export', 'ai1wm_export', array(
|
@@ -448,44 +414,6 @@ class Ai1wm_Main_Controller {
|
|
448 |
) );
|
449 |
}
|
450 |
|
451 |
-
/**
|
452 |
-
* Register scripts and styles for Backup Controller
|
453 |
-
*
|
454 |
-
* @return void
|
455 |
-
*/
|
456 |
-
public function register_backup_scripts_and_styles() {
|
457 |
-
do_action( 'ai1mw-register-backup-scripts-and-styles' );
|
458 |
-
wp_enqueue_script(
|
459 |
-
'ai1wm-js-backup',
|
460 |
-
Ai1wm_Template::asset_link( 'javascript/backup.min.js' ),
|
461 |
-
array( 'jquery' )
|
462 |
-
);
|
463 |
-
wp_enqueue_style(
|
464 |
-
'ai1wm-css-backup',
|
465 |
-
Ai1wm_Template::asset_link( 'css/backup.min.css' )
|
466 |
-
);
|
467 |
-
wp_localize_script( 'ai1wm-js-backup', 'ai1wm_feedback', array(
|
468 |
-
'ajax' => array(
|
469 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_leave_feedback' ) ),
|
470 |
-
),
|
471 |
-
) );
|
472 |
-
wp_localize_script( 'ai1wm-js-backup', 'ai1wm_report', array(
|
473 |
-
'ajax' => array(
|
474 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report_problem' ) ),
|
475 |
-
),
|
476 |
-
) );
|
477 |
-
wp_localize_script( 'ai1wm-js-backup', 'ai1wm_maintenance', array(
|
478 |
-
'ajax' => array(
|
479 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_disable_maintenance' ) ),
|
480 |
-
),
|
481 |
-
) );
|
482 |
-
wp_localize_script( 'ai1wm-js-backup', 'ai1wm_backup', array(
|
483 |
-
'ajax' => array(
|
484 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_backup_delete' ) ),
|
485 |
-
),
|
486 |
-
) );
|
487 |
-
}
|
488 |
-
|
489 |
/**
|
490 |
* Register scripts and styles for Import Controller
|
491 |
*
|
@@ -523,8 +451,7 @@ class Ai1wm_Main_Controller {
|
|
523 |
'unique_names' => true,
|
524 |
'multipart' => true,
|
525 |
'multipart_params' => array(
|
526 |
-
'
|
527 |
-
'method' => 'import',
|
528 |
'secret_key' => get_site_option( AI1WM_SECRET_KEY, false, false ),
|
529 |
),
|
530 |
'filters' => array(
|
@@ -534,17 +461,12 @@ class Ai1wm_Main_Controller {
|
|
534 |
) );
|
535 |
wp_localize_script( 'ai1wm-js-import', 'ai1wm_feedback', array(
|
536 |
'ajax' => array(
|
537 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=
|
538 |
),
|
539 |
) );
|
540 |
wp_localize_script( 'ai1wm-js-import', 'ai1wm_report', array(
|
541 |
'ajax' => array(
|
542 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=
|
543 |
-
),
|
544 |
-
) );
|
545 |
-
wp_localize_script( 'ai1wm-js-import', 'ai1wm_maintenance', array(
|
546 |
-
'ajax' => array(
|
547 |
-
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_disable_maintenance' ) ),
|
548 |
),
|
549 |
) );
|
550 |
wp_localize_script( 'ai1wm-js-import', 'ai1wm_import', array(
|
@@ -582,6 +504,50 @@ class Ai1wm_Main_Controller {
|
|
582 |
) );
|
583 |
}
|
584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
/**
|
586 |
* Register scripts and styles for Updater Controller
|
587 |
*
|
@@ -609,4 +575,82 @@ class Ai1wm_Main_Controller {
|
|
609 |
),
|
610 |
) );
|
611 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
612 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
65 |
* @return Object Instance of this class
|
66 |
*/
|
67 |
private function activate_actions() {
|
68 |
+
// Init
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
add_action( 'admin_init', array( $this, 'init' ) );
|
70 |
+
|
71 |
+
// Router
|
72 |
add_action( 'admin_init', array( $this, 'router' ) );
|
73 |
+
|
74 |
+
// Admin header
|
75 |
add_action( 'admin_head', array( $this, 'admin_head' ) );
|
|
|
76 |
|
77 |
+
// Create initial folders
|
78 |
+
add_action( 'admin_init', array( $this, 'create_folders' ) );
|
79 |
+
|
80 |
+
// All in One WP Migration
|
81 |
+
add_action( 'plugins_loaded', array( $this, 'ai1wm_loaded' ), 20 );
|
82 |
+
|
83 |
+
// Export and import commands
|
84 |
+
add_action( 'plugins_loaded', array( $this, 'ai1wm_commands' ), 10 );
|
85 |
+
|
86 |
+
// Export and import buttons
|
87 |
+
add_action( 'plugins_loaded', array( $this, 'ai1wm_buttons' ), 10 );
|
88 |
|
89 |
// Add updater scripts and styles
|
90 |
add_action( 'admin_enqueue_scripts', array( $this, 'register_updater_scripts_and_styles' ) );
|
101 |
// Add a links to plugin list page
|
102 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
103 |
|
104 |
+
return $this;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Export and import commands
|
109 |
+
*
|
110 |
+
* @return void
|
111 |
+
*/
|
112 |
+
public function ai1wm_commands() {
|
113 |
+
// Add export commands
|
114 |
+
add_filter( 'ai1wm_export', 'Ai1wm_Export_Resolve::execute', 5 );
|
115 |
+
add_filter( 'ai1wm_export', 'Ai1wm_Export_Archive::execute', 10 );
|
116 |
+
add_filter( 'ai1wm_export', 'Ai1wm_Export_Config::execute', 50 );
|
117 |
+
add_filter( 'ai1wm_export', 'Ai1wm_Export_Enumerate::execute', 100 );
|
118 |
+
add_filter( 'ai1wm_export', 'Ai1wm_Export_Content::execute', 150 );
|
119 |
+
add_filter( 'ai1wm_export', 'Ai1wm_Export_Database::execute', 200 );
|
120 |
+
add_filter( 'ai1wm_export', 'Ai1wm_Export_Download::execute', 250 );
|
121 |
+
add_filter( 'ai1wm_export', 'Ai1wm_Export_Clean::execute', 300 );
|
122 |
+
|
123 |
+
// Add import commands
|
124 |
+
add_filter( 'ai1wm_import', 'Ai1wm_Import_Upload::execute', 5 );
|
125 |
+
add_filter( 'ai1wm_import', 'Ai1wm_Import_Resolve::execute', 10 );
|
126 |
+
add_filter( 'ai1wm_import', 'Ai1wm_Import_Validate::execute', 50 );
|
127 |
+
add_filter( 'ai1wm_import', 'Ai1wm_Import_Confirm::execute', 100 );
|
128 |
+
add_filter( 'ai1wm_import', 'Ai1wm_Import_Blogs::execute', 150 );
|
129 |
+
add_filter( 'ai1wm_import', 'Ai1wm_Import_Enumerate::execute', 200 );
|
130 |
+
add_filter( 'ai1wm_import', 'Ai1wm_Import_Content::execute', 250 );
|
131 |
+
add_filter( 'ai1wm_import', 'Ai1wm_Import_Database::execute', 300 );
|
132 |
+
add_filter( 'ai1wm_import', 'Ai1wm_Import_Done::execute', 350 );
|
133 |
+
add_filter( 'ai1wm_import', 'Ai1wm_Import_Clean::execute', 400 );
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Export and import buttons
|
138 |
+
*
|
139 |
+
* @return void
|
140 |
+
*/
|
141 |
+
public function ai1wm_buttons() {
|
142 |
// Add export buttons
|
143 |
add_filter( 'ai1wm_export_buttons', 'Ai1wm_Export_Controller::buttons' );
|
144 |
|
145 |
// Add import buttons
|
146 |
add_filter( 'ai1wm_import_buttons', 'Ai1wm_Import_Controller::buttons' );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* All in One WP Migration loaded
|
151 |
+
*
|
152 |
+
* @return void
|
153 |
+
*/
|
154 |
+
public function ai1wm_loaded() {
|
155 |
+
if ( is_multisite() ) {
|
156 |
+
if ( apply_filters( 'ai1wm_multisite_menu', false ) ) {
|
157 |
+
add_action( 'network_admin_menu', array( $this, 'admin_menu' ) );
|
158 |
+
} else {
|
159 |
+
add_action( 'network_admin_notices', array( $this, 'multisite_notice' ) );
|
160 |
+
}
|
161 |
+
} else {
|
162 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
163 |
+
}
|
164 |
+
|
165 |
+
// Add automatic plugins update
|
166 |
+
add_action( 'wp_maybe_auto_update', 'Ai1wm_Updater_Controller::check_for_updates' );
|
167 |
|
168 |
// Add chunk size limit
|
169 |
add_filter( 'ai1wm_max_chunk_size', 'Ai1wm_Import_Controller::max_chunk_size' );
|
179 |
|
180 |
// Add "Check for updates" link to plugin list page
|
181 |
add_filter( 'plugin_row_meta', 'Ai1wm_Updater_Controller::plugin_row_meta', 10, 2 );
|
|
|
|
|
182 |
}
|
183 |
|
184 |
/**
|
230 |
return $links;
|
231 |
}
|
232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
/**
|
234 |
* Create folders needed for plugin operation, if they don't exist
|
235 |
*
|
237 |
*/
|
238 |
public function create_folders() {
|
239 |
// Check if storage folder exist
|
240 |
+
if ( ! is_dir( AI1WM_STORAGE_PATH ) ) {
|
241 |
|
242 |
// Folder doesn't exist, attempt to create it
|
243 |
if ( ! mkdir( AI1WM_STORAGE_PATH ) ) {
|
255 |
Ai1wm_File_Index::create( AI1WM_STORAGE_INDEX );
|
256 |
|
257 |
// Check if backups folder exist
|
258 |
+
if ( ! is_dir( AI1WM_BACKUPS_PATH ) ) {
|
259 |
|
260 |
// Folder doesn't exist, attempt to create it
|
261 |
if ( ! mkdir( AI1WM_BACKUPS_PATH ) ) {
|
271 |
|
272 |
// Create index.php in backups folder
|
273 |
Ai1wm_File_Index::create( AI1WM_BACKUPS_INDEX );
|
274 |
+
|
275 |
+
// Create .htaccess in backups folder
|
276 |
+
Ai1wm_File_Htaccess::create( AI1WM_BACKUPS_HTACCESS );
|
277 |
}
|
278 |
|
279 |
/**
|
291 |
$file = $path . DIRECTORY_SEPARATOR . AI1WM_DIRECTORY_INDEX;
|
292 |
|
293 |
// Check if the file exists
|
294 |
+
if ( ! is_file( $file ) ) {
|
295 |
|
296 |
// File doesn't exist attempt to create ti
|
297 |
$handle = fopen( $file, 'w' );
|
328 |
'',
|
329 |
'76.295'
|
330 |
);
|
331 |
+
|
332 |
// sublevel Export menu
|
333 |
$export_page_hook_suffix = add_submenu_page(
|
334 |
'site-migration-export',
|
342 |
'admin_print_scripts-' . $export_page_hook_suffix,
|
343 |
array( $this, 'register_export_scripts_and_styles' )
|
344 |
);
|
345 |
+
|
346 |
// sublevel Import menu
|
347 |
$import_page_hook_suffix = add_submenu_page(
|
348 |
'site-migration-export',
|
356 |
'admin_print_scripts-' . $import_page_hook_suffix,
|
357 |
array( $this, 'register_import_scripts_and_styles' )
|
358 |
);
|
359 |
+
|
360 |
// sublevel Backups menu
|
361 |
+
$backups_page_hook_suffix = add_submenu_page(
|
362 |
'site-migration-export',
|
363 |
__( 'Backups', AI1WM_PLUGIN_NAME ),
|
364 |
__( 'Backups', AI1WM_PLUGIN_NAME ),
|
365 |
+
'import',
|
366 |
+
'site-migration-backups',
|
367 |
+
'Ai1wm_Backups_Controller::index'
|
368 |
);
|
369 |
add_action(
|
370 |
+
'admin_print_scripts-' . $backups_page_hook_suffix,
|
371 |
+
array( $this, 'register_backups_scripts_and_styles' )
|
372 |
);
|
373 |
}
|
374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
/**
|
376 |
* Register scripts and styles for Export Controller
|
377 |
*
|
394 |
);
|
395 |
wp_localize_script( 'ai1wm-js-export', 'ai1wm_feedback', array(
|
396 |
'ajax' => array(
|
397 |
+
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ),
|
398 |
),
|
399 |
) );
|
400 |
wp_localize_script( 'ai1wm-js-export', 'ai1wm_report', array(
|
401 |
'ajax' => array(
|
402 |
+
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
),
|
404 |
) );
|
405 |
wp_localize_script( 'ai1wm-js-export', 'ai1wm_export', array(
|
414 |
) );
|
415 |
}
|
416 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
/**
|
418 |
* Register scripts and styles for Import Controller
|
419 |
*
|
451 |
'unique_names' => true,
|
452 |
'multipart' => true,
|
453 |
'multipart_params' => array(
|
454 |
+
'priority' => 5,
|
|
|
455 |
'secret_key' => get_site_option( AI1WM_SECRET_KEY, false, false ),
|
456 |
),
|
457 |
'filters' => array(
|
461 |
) );
|
462 |
wp_localize_script( 'ai1wm-js-import', 'ai1wm_feedback', array(
|
463 |
'ajax' => array(
|
464 |
+
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ),
|
465 |
),
|
466 |
) );
|
467 |
wp_localize_script( 'ai1wm-js-import', 'ai1wm_report', array(
|
468 |
'ajax' => array(
|
469 |
+
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ),
|
|
|
|
|
|
|
|
|
|
|
470 |
),
|
471 |
) );
|
472 |
wp_localize_script( 'ai1wm-js-import', 'ai1wm_import', array(
|
504 |
) );
|
505 |
}
|
506 |
|
507 |
+
/**
|
508 |
+
* Register scripts and styles for Backups Controller
|
509 |
+
*
|
510 |
+
* @return void
|
511 |
+
*/
|
512 |
+
public function register_backups_scripts_and_styles() {
|
513 |
+
do_action( 'ai1mw-register-backups-scripts-and-styles' );
|
514 |
+
|
515 |
+
wp_enqueue_script(
|
516 |
+
'ai1wm-js-backups',
|
517 |
+
Ai1wm_Template::asset_link( 'javascript/backups.min.js' ),
|
518 |
+
array( 'jquery' )
|
519 |
+
);
|
520 |
+
wp_enqueue_style(
|
521 |
+
'ai1wm-css-backups',
|
522 |
+
Ai1wm_Template::asset_link( 'css/backups.min.css' )
|
523 |
+
);
|
524 |
+
wp_localize_script( 'ai1wm-js-backups', 'ai1wm_feedback', array(
|
525 |
+
'ajax' => array(
|
526 |
+
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_feedback' ) ),
|
527 |
+
),
|
528 |
+
) );
|
529 |
+
wp_localize_script( 'ai1wm-js-backups', 'ai1wm_report', array(
|
530 |
+
'ajax' => array(
|
531 |
+
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_report' ) ),
|
532 |
+
),
|
533 |
+
) );
|
534 |
+
wp_localize_script( 'ai1wm-js-backups', 'ai1wm_backups', array(
|
535 |
+
'ajax' => array(
|
536 |
+
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_backups' ) ),
|
537 |
+
),
|
538 |
+
) );
|
539 |
+
wp_localize_script( 'ai1wm-js-backups', 'ai1wm_import', array(
|
540 |
+
'ajax' => array(
|
541 |
+
'url' => wp_make_link_relative( admin_url( 'admin-ajax.php?action=ai1wm_import' ) ),
|
542 |
+
),
|
543 |
+
'status' => array(
|
544 |
+
'php' => wp_make_link_relative( plugins_url( 'status.php', AI1WM_PLUGIN_BASENAME ) ),
|
545 |
+
'js' => wp_make_link_relative( plugins_url( 'storage/status.js', AI1WM_PLUGIN_BASENAME ) ),
|
546 |
+
),
|
547 |
+
'secret_key' => get_site_option( AI1WM_SECRET_KEY, false, false ),
|
548 |
+
) );
|
549 |
+
}
|
550 |
+
|
551 |
/**
|
552 |
* Register scripts and styles for Updater Controller
|
553 |
*
|
575 |
),
|
576 |
) );
|
577 |
}
|
578 |
+
|
579 |
+
/**
|
580 |
+
* Outputs menu icon between head tags
|
581 |
+
*
|
582 |
+
* @return void
|
583 |
+
*/
|
584 |
+
public function admin_head() {
|
585 |
+
global $wp_version;
|
586 |
+
|
587 |
+
// Admin header
|
588 |
+
Ai1wm_Template::render( 'main/admin-head', array( 'version' => $wp_version ) );
|
589 |
+
}
|
590 |
+
|
591 |
+
/**
|
592 |
+
* Register initial parameters
|
593 |
+
*
|
594 |
+
* @return void
|
595 |
+
*/
|
596 |
+
public function init() {
|
597 |
+
// Set secret key
|
598 |
+
if ( ! get_site_option( AI1WM_SECRET_KEY, false, false ) ) {
|
599 |
+
update_site_option( AI1WM_SECRET_KEY, wp_generate_password( 12, false ) );
|
600 |
+
}
|
601 |
+
|
602 |
+
// Set username
|
603 |
+
if ( isset( $_SERVER['PHP_AUTH_USER'] ) ) {
|
604 |
+
update_site_option( AI1WM_AUTH_USER, $_SERVER['PHP_AUTH_USER'] );
|
605 |
+
} else if ( isset( $_SERVER['REMOTE_USER'] ) ) {
|
606 |
+
update_site_option( AI1WM_AUTH_USER, $_SERVER['REMOTE_USER'] );
|
607 |
+
}
|
608 |
+
|
609 |
+
// Set password
|
610 |
+
if ( isset( $_SERVER['PHP_AUTH_PW'] ) ) {
|
611 |
+
update_site_option( AI1WM_AUTH_PASSWORD, $_SERVER['PHP_AUTH_PW'] );
|
612 |
+
}
|
613 |
+
|
614 |
+
// Check for updates
|
615 |
+
if ( isset( $_GET['ai1wm_updater'] ) ) {
|
616 |
+
if ( current_user_can( 'update_plugins' ) && check_admin_referer( 'ai1wm_updater_nonce' ) ) {
|
617 |
+
Ai1wm_Updater::check_for_updates();
|
618 |
+
}
|
619 |
+
}
|
620 |
+
}
|
621 |
+
|
622 |
+
/**
|
623 |
+
* Register initial router
|
624 |
+
*
|
625 |
+
* @return void
|
626 |
+
*/
|
627 |
+
public function router() {
|
628 |
+
// Public
|
629 |
+
add_action( 'wp_ajax_nopriv_ai1wm_export', 'Ai1wm_Export_Controller::export' );
|
630 |
+
add_action( 'wp_ajax_nopriv_ai1wm_import', 'Ai1wm_Import_Controller::import' );
|
631 |
+
add_action( 'wp_ajax_nopriv_ai1wm_resolve', 'Ai1wm_Resolve_Controller::resolve' );
|
632 |
+
|
633 |
+
// Update
|
634 |
+
if ( current_user_can( 'update_plugins' ) ) {
|
635 |
+
add_action( 'wp_ajax_ai1wm_updater', 'Ai1wm_Updater_Controller::updater' );
|
636 |
+
}
|
637 |
+
|
638 |
+
// Export
|
639 |
+
if ( current_user_can( 'export' ) ) {
|
640 |
+
add_action( 'wp_ajax_ai1wm_export', 'Ai1wm_Export_Controller::export' );
|
641 |
+
}
|
642 |
+
|
643 |
+
// Import
|
644 |
+
if ( current_user_can( 'import' ) ) {
|
645 |
+
add_action( 'wp_ajax_ai1wm_import', 'Ai1wm_Import_Controller::import' );
|
646 |
+
}
|
647 |
+
|
648 |
+
// Both
|
649 |
+
if ( current_user_can( 'export' ) || current_user_can( 'import' ) ) {
|
650 |
+
add_action( 'wp_ajax_ai1wm_backups', 'Ai1wm_Backups_Controller::delete' );
|
651 |
+
add_action( 'wp_ajax_ai1wm_feedback', 'Ai1wm_Feedback_Controller::feedback' );
|
652 |
+
add_action( 'wp_ajax_ai1wm_report', 'Ai1wm_Report_Controller::report' );
|
653 |
+
add_action( 'wp_ajax_ai1wm_resolve', 'Ai1wm_Resolve_Controller::resolve' );
|
654 |
+
}
|
655 |
+
}
|
656 |
}
|
lib/controller/class-ai1wm-report-controller.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -25,28 +25,29 @@
|
|
25 |
|
26 |
class Ai1wm_Report_Controller {
|
27 |
|
28 |
-
public static function
|
|
|
29 |
// Set E-mail
|
30 |
$email = null;
|
31 |
-
if ( isset( $_POST['email'] ) ) {
|
32 |
-
$email = trim( $_POST['email'] );
|
33 |
}
|
34 |
|
35 |
// Set Message
|
36 |
$message = null;
|
37 |
-
if ( isset( $_POST['message'] ) ) {
|
38 |
-
$message = trim( $_POST['message'] );
|
39 |
}
|
40 |
|
41 |
// Set Terms
|
42 |
$terms = false;
|
43 |
-
if ( isset( $_POST['terms'] ) ) {
|
44 |
-
$terms = (bool) $_POST['terms'];
|
45 |
}
|
46 |
|
47 |
// Send Feedback
|
48 |
$model = new Ai1wm_Report;
|
49 |
-
$result = $model->
|
50 |
echo json_encode( $result );
|
51 |
exit;
|
52 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
25 |
|
26 |
class Ai1wm_Report_Controller {
|
27 |
|
28 |
+
public static function report() {
|
29 |
+
|
30 |
// Set E-mail
|
31 |
$email = null;
|
32 |
+
if ( isset( $_POST['ai1wm-email'] ) ) {
|
33 |
+
$email = trim( $_POST['ai1wm-email'] );
|
34 |
}
|
35 |
|
36 |
// Set Message
|
37 |
$message = null;
|
38 |
+
if ( isset( $_POST['ai1wm-message'] ) ) {
|
39 |
+
$message = trim( $_POST['ai1wm-message'] );
|
40 |
}
|
41 |
|
42 |
// Set Terms
|
43 |
$terms = false;
|
44 |
+
if ( isset( $_POST['ai1wm-terms'] ) ) {
|
45 |
+
$terms = (bool) $_POST['ai1wm-terms'];
|
46 |
}
|
47 |
|
48 |
// Send Feedback
|
49 |
$model = new Ai1wm_Report;
|
50 |
+
$result = $model->add( $email, $message, $terms );
|
51 |
echo json_encode( $result );
|
52 |
exit;
|
53 |
}
|
lib/controller/class-ai1wm-resolve-controller.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -25,41 +25,38 @@
|
|
25 |
|
26 |
class Ai1wm_Resolve_Controller {
|
27 |
|
28 |
-
public static function resolve( $
|
29 |
|
30 |
// Set error handler
|
31 |
-
@set_error_handler( '
|
32 |
|
33 |
-
// Set
|
34 |
-
if ( empty( $
|
35 |
-
$
|
36 |
}
|
37 |
|
38 |
// Set secret key
|
39 |
$secret_key = null;
|
40 |
-
if ( isset( $
|
41 |
-
$secret_key = $
|
42 |
}
|
43 |
|
44 |
// Verify secret key by using the value in the database, not in cache
|
45 |
if ( $secret_key !== get_site_option( AI1WM_SECRET_KEY, false, false ) ) {
|
46 |
-
Ai1wm_Status::
|
47 |
-
|
48 |
-
|
49 |
-
'title' => __( "Unable to resolve", AI1WM_PLUGIN_NAME ),
|
50 |
-
'message' => __( "Unable to authenticate your request with secret_key = \"{$secret_key}\"", AI1WM_PLUGIN_NAME ),
|
51 |
-
)
|
52 |
);
|
53 |
exit;
|
54 |
}
|
55 |
|
56 |
// Set IP address
|
57 |
-
if ( isset( $
|
58 |
update_site_option( AI1WM_URL_IP, $ip );
|
59 |
}
|
60 |
|
61 |
// Set transport layer
|
62 |
-
if ( isset( $
|
63 |
if ( $transport === 'curl' ) {
|
64 |
update_site_option( AI1WM_URL_TRANSPORT, array( 'curl', 'ai1wm' ) );
|
65 |
} else {
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
25 |
|
26 |
class Ai1wm_Resolve_Controller {
|
27 |
|
28 |
+
public static function resolve( $params = array() ) {
|
29 |
|
30 |
// Set error handler
|
31 |
+
@set_error_handler( 'Ai1wm_Handler::error' );
|
32 |
|
33 |
+
// Set params
|
34 |
+
if ( empty( $params ) ) {
|
35 |
+
$params = ai1wm_urldecode( $_REQUEST );
|
36 |
}
|
37 |
|
38 |
// Set secret key
|
39 |
$secret_key = null;
|
40 |
+
if ( isset( $params['secret_key'] ) ) {
|
41 |
+
$secret_key = $params['secret_key'];
|
42 |
}
|
43 |
|
44 |
// Verify secret key by using the value in the database, not in cache
|
45 |
if ( $secret_key !== get_site_option( AI1WM_SECRET_KEY, false, false ) ) {
|
46 |
+
Ai1wm_Status::error(
|
47 |
+
__( "Unable to authenticate your request with secret_key = \"{$secret_key}\"", AI1WM_PLUGIN_NAME ),
|
48 |
+
__( "Unable to resolve", AI1WM_PLUGIN_NAME )
|
|
|
|
|
|
|
49 |
);
|
50 |
exit;
|
51 |
}
|
52 |
|
53 |
// Set IP address
|
54 |
+
if ( isset( $params['url_ip'] ) && ( $ip = $params['url_ip' ] ) ) {
|
55 |
update_site_option( AI1WM_URL_IP, $ip );
|
56 |
}
|
57 |
|
58 |
// Set transport layer
|
59 |
+
if ( isset( $params['url_transport'] ) && ( $transport = $params['url_transport'] ) ) {
|
60 |
if ( $transport === 'curl' ) {
|
61 |
update_site_option( AI1WM_URL_TRANSPORT, array( 'curl', 'ai1wm' ) );
|
62 |
} else {
|
lib/controller/class-ai1wm-updater-controller.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
lib/{controller/class-ai1wm-message-controller.php → exception/class-ai1wm-archive-exception.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,21 +23,4 @@
|
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
-
class
|
27 |
-
|
28 |
-
public static function close_message() {
|
29 |
-
$errors = array();
|
30 |
-
|
31 |
-
// Set Key
|
32 |
-
$key = null;
|
33 |
-
if ( isset( $_POST['key'] ) ) {
|
34 |
-
$key = trim( $_POST['key'] );
|
35 |
-
}
|
36 |
-
|
37 |
-
// Close message
|
38 |
-
$model = new Ai1wm_Message;
|
39 |
-
$result = $model->close_message( $key );
|
40 |
-
echo json_encode( $result );
|
41 |
-
exit;
|
42 |
-
}
|
43 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Archive_Exception extends Exception {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/exception/class-ai1wm-backups-exception.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Backups_Exception extends Exception {}
|
lib/exception/class-ai1wm-export-exception.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,5 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
-
class Ai1wm_Export_Exception extends Exception {
|
27 |
|
28 |
-
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
|
|
25 |
|
26 |
+
class Ai1wm_Export_Exception extends Exception {}
|
lib/exception/class-ai1wm-http-exception.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,5 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
-
class Ai1wm_Http_Exception extends Exception {
|
27 |
|
28 |
-
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
|
|
25 |
|
26 |
+
class Ai1wm_Http_Exception extends Exception {}
|
lib/exception/class-ai1wm-import-exception.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,58 +22,5 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
-
class Ai1wm_Import_Exception extends Exception {
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Exception title
|
30 |
-
* @type string
|
31 |
-
*/
|
32 |
-
protected $title;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Extend constructor to accept message and title
|
36 |
-
*
|
37 |
-
* We want to be able to set the title of our modal and default Exception class
|
38 |
-
* doesn't have at title property so we have to extend the constructor to accept one
|
39 |
-
*
|
40 |
-
* @param string $message Exception message
|
41 |
-
* @param string $title Exception title
|
42 |
-
*/
|
43 |
-
public function __construct( $message = '', $title = '' ) {
|
44 |
-
// initialize our parent
|
45 |
-
parent::__construct( $message );
|
46 |
-
|
47 |
-
$this->title = $title;
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Get exception title
|
52 |
-
*
|
53 |
-
* We check if the title is set and return it if it is,
|
54 |
-
* if title is not set (empty string), we return a default string
|
55 |
-
* Site could not be imported, which should be a catch all phrase
|
56 |
-
*
|
57 |
-
* @return string
|
58 |
-
*/
|
59 |
-
public function get_title() {
|
60 |
-
if ( empty( $this->title ) ) {
|
61 |
-
// no title is set, return default title
|
62 |
-
return __( 'Site could not be imported', AI1WM_PLUGIN_NAME );
|
63 |
-
} else {
|
64 |
-
return $this->title;
|
65 |
-
}
|
66 |
-
}
|
67 |
|
68 |
-
|
69 |
-
* Get exception message
|
70 |
-
*
|
71 |
-
* We are creating our own WordPress code-style compatible function to
|
72 |
-
* return the value of getMessage method of our parent, Exception, class.
|
73 |
-
* This is only necessary so that we have a common way to name our methods
|
74 |
-
*
|
75 |
-
* @return string
|
76 |
-
*/
|
77 |
-
public function get_message() {
|
78 |
-
return $this->getMessage();
|
79 |
-
}
|
80 |
-
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
class Ai1wm_Import_Exception extends Exception {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/exception/class-ai1wm-not-accessible-exception.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,5 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
-
class Ai1wm_Not_Accesible_Exception extends Exception {
|
27 |
|
28 |
-
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
|
|
25 |
|
26 |
+
class Ai1wm_Not_Accesible_Exception extends Exception {}
|
lib/exception/class-ai1wm-not-found-exception.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,5 +22,5 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
-
|
27 |
-
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
+
|
26 |
+
class Ai1wm_Not_Found_Exception extends Exception {}
|
lib/exception/class-ai1wm-not-readable-exception.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,5 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
-
class Ai1wm_Not_Readable_Exception extends Exception {
|
27 |
|
28 |
-
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
|
|
25 |
|
26 |
+
class Ai1wm_Not_Readable_Exception extends Exception {}
|
lib/exception/class-ai1wm-not-writable-exception.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,5 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
-
class Ai1wm_Not_Writable_Exception extends Exception {
|
27 |
|
28 |
-
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
|
|
25 |
|
26 |
+
class Ai1wm_Not_Writable_Exception extends Exception {}
|
lib/exception/class-ai1wm-storage-exception.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,5 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
-
class Ai1wm_Storage_Exception extends Exception {
|
27 |
|
28 |
-
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
|
|
25 |
|
26 |
+
class Ai1wm_Storage_Exception extends Exception {}
|
lib/model/{class-ai1wm-backup.php → class-ai1wm-backups.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,7 +23,7 @@
|
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
-
class
|
27 |
|
28 |
/**
|
29 |
* Get all backup files
|
@@ -61,9 +61,9 @@ class Ai1wm_Backup {
|
|
61 |
*/
|
62 |
public function delete_file( $file ) {
|
63 |
if ( empty( $file ) ) {
|
64 |
-
throw new
|
65 |
} else if ( ! unlink( AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . $file ) ) {
|
66 |
-
throw new
|
67 |
sprintf(
|
68 |
__( 'Unable to delete <strong>"%s"</strong> file.', AI1WM_PLUGIN_NAME ),
|
69 |
AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . $file
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Backups {
|
27 |
|
28 |
/**
|
29 |
* Get all backup files
|
61 |
*/
|
62 |
public function delete_file( $file ) {
|
63 |
if ( empty( $file ) ) {
|
64 |
+
throw new Ai1wm_Backups_Exception( __( 'File name is not specified.', AI1WM_PLUGIN_NAME ) );
|
65 |
} else if ( ! unlink( AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . $file ) ) {
|
66 |
+
throw new Ai1wm_Backups_Exception(
|
67 |
sprintf(
|
68 |
__( 'Unable to delete <strong>"%s"</strong> file.', AI1WM_PLUGIN_NAME ),
|
69 |
AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . $file
|
lib/model/class-ai1wm-config.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Config {}
|
lib/model/{service/class-ai1wm-service-interface.php → class-ai1wm-deprecated.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,9 +23,6 @@
|
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
public function export();
|
31 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Export_Abstract {}
|
27 |
|
28 |
+
class Ai1wm_Import_Abstract {}
|
|
|
|
|
|
lib/model/class-ai1wm-export-abstract.php
DELETED
@@ -1,507 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
-
*
|
5 |
-
* This program is free software: you can redistribute it and/or modify
|
6 |
-
* it under the terms of the GNU General Public License as published by
|
7 |
-
* the Free Software Foundation, either version 3 of the License, or
|
8 |
-
* (at your option) any later version.
|
9 |
-
*
|
10 |
-
* This program is distributed in the hope that it will be useful,
|
11 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
-
* You should have received a copy of the GNU General Public License
|
16 |
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
-
*
|
18 |
-
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
-
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
-
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
-
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
-
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
-
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
-
*/
|
25 |
-
|
26 |
-
abstract class Ai1wm_Export_Abstract {
|
27 |
-
|
28 |
-
protected $args = array();
|
29 |
-
|
30 |
-
protected $storage = null;
|
31 |
-
|
32 |
-
public function __construct( array $args = array() ) {
|
33 |
-
$this->args = $args;
|
34 |
-
|
35 |
-
// HTTP resolve
|
36 |
-
if ( $this->args['method'] === 'start' ) {
|
37 |
-
Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Create empty archive and add package config
|
43 |
-
*
|
44 |
-
* @return void
|
45 |
-
*/
|
46 |
-
public function start() {
|
47 |
-
// Set default progress
|
48 |
-
Ai1wm_Status::set( array(
|
49 |
-
'type' => 'info',
|
50 |
-
'message' => __( 'Creating an empty archive...', AI1WM_PLUGIN_NAME )
|
51 |
-
) );
|
52 |
-
|
53 |
-
// Get package file
|
54 |
-
$service = new Ai1wm_Service_Package( $this->args );
|
55 |
-
$service->export();
|
56 |
-
|
57 |
-
// Get archive file
|
58 |
-
$archive = new Ai1wm_Compressor( $this->storage()->archive() );
|
59 |
-
|
60 |
-
// Add package file
|
61 |
-
$archive->add_file( $this->storage()->package(), AI1WM_PACKAGE_NAME );
|
62 |
-
$archive->close();
|
63 |
-
|
64 |
-
// Set progress
|
65 |
-
Ai1wm_Status::set( array(
|
66 |
-
'type' => 'info',
|
67 |
-
'message' => __( 'Done creating an empty archive.', AI1WM_PLUGIN_NAME )
|
68 |
-
) );
|
69 |
-
|
70 |
-
// Redirect
|
71 |
-
$this->route_to( 'enumerate' );
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Enumerate content files and directories
|
76 |
-
*
|
77 |
-
* @return void
|
78 |
-
*/
|
79 |
-
public function enumerate() {
|
80 |
-
// Set progress
|
81 |
-
Ai1wm_Status::set( array(
|
82 |
-
'type' => 'info',
|
83 |
-
'message' => __( 'Retrieving a list of all WordPress files...', AI1WM_PLUGIN_NAME )
|
84 |
-
) );
|
85 |
-
|
86 |
-
// Default filters
|
87 |
-
$filters = array(
|
88 |
-
'index.php',
|
89 |
-
'ai1wm-backups',
|
90 |
-
'themes' . DIRECTORY_SEPARATOR . 'index.php',
|
91 |
-
'plugins' . DIRECTORY_SEPARATOR . 'index.php',
|
92 |
-
'uploads' . DIRECTORY_SEPARATOR . 'index.php',
|
93 |
-
);
|
94 |
-
|
95 |
-
// Exclude media
|
96 |
-
if ( $this->should_exclude_media() ) {
|
97 |
-
$filters = array_merge( $filters, array( 'uploads' ) );
|
98 |
-
}
|
99 |
-
|
100 |
-
// Exclude themes
|
101 |
-
if ( $this->should_exclude_themes() ) {
|
102 |
-
$filters = array_merge( $filters, array( 'themes' ) );
|
103 |
-
}
|
104 |
-
|
105 |
-
// Exclude plugins
|
106 |
-
if ( $this->should_exclude_plugins() ) {
|
107 |
-
$filters = array_merge( $filters, array( 'plugins', 'mu-plugins' ) );
|
108 |
-
} else {
|
109 |
-
$filters = array_merge( $filters, array(
|
110 |
-
'plugins' . DIRECTORY_SEPARATOR . AI1WM_PLUGIN_BASEDIR,
|
111 |
-
'plugins' . DIRECTORY_SEPARATOR . AI1WMDE_PLUGIN_BASEDIR,
|
112 |
-
'plugins' . DIRECTORY_SEPARATOR . AI1WMGE_PLUGIN_BASEDIR,
|
113 |
-
'plugins' . DIRECTORY_SEPARATOR . AI1WMSE_PLUGIN_BASEDIR,
|
114 |
-
'plugins' . DIRECTORY_SEPARATOR . AI1WMME_PLUGIN_BASEDIR,
|
115 |
-
'plugins' . DIRECTORY_SEPARATOR . AI1WMUE_PLUGIN_BASEDIR,
|
116 |
-
'plugins' . DIRECTORY_SEPARATOR . AI1WMFE_PLUGIN_BASEDIR,
|
117 |
-
'plugins' . DIRECTORY_SEPARATOR . AI1WMLE_PLUGIN_BASEDIR,
|
118 |
-
'plugins' . DIRECTORY_SEPARATOR . AI1WMOE_PLUGIN_BASEDIR,
|
119 |
-
) );
|
120 |
-
}
|
121 |
-
|
122 |
-
// Create map file
|
123 |
-
$filemap = fopen( $this->storage()->filemap(), 'a+' );
|
124 |
-
|
125 |
-
// Total files
|
126 |
-
$total = 0;
|
127 |
-
|
128 |
-
// Iterate over WP_CONTENT_DIR directory
|
129 |
-
$iterator = new RecursiveIteratorIterator(
|
130 |
-
new Ai1wm_Recursive_Exclude_Filter(
|
131 |
-
new Ai1wm_Recursive_Directory_Iterator(
|
132 |
-
WP_CONTENT_DIR
|
133 |
-
),
|
134 |
-
apply_filters( 'ai1wm_exclude_content_from_export', $filters )
|
135 |
-
),
|
136 |
-
RecursiveIteratorIterator::SELF_FIRST
|
137 |
-
);
|
138 |
-
|
139 |
-
foreach ( $iterator as $item ) {
|
140 |
-
if ( $item->isFile() ) {
|
141 |
-
// Write path line
|
142 |
-
if ( fwrite( $filemap, $iterator->getSubPathName() . PHP_EOL ) ) {
|
143 |
-
$total++;
|
144 |
-
}
|
145 |
-
}
|
146 |
-
}
|
147 |
-
|
148 |
-
// Close handler
|
149 |
-
fclose( $filemap );
|
150 |
-
|
151 |
-
// Set total files
|
152 |
-
$this->args['total'] = $total;
|
153 |
-
|
154 |
-
// Set progress
|
155 |
-
Ai1wm_Status::set( array(
|
156 |
-
'type' => 'info',
|
157 |
-
'message' => __( 'Done retrieving a list of all WordPress files.', AI1WM_PLUGIN_NAME )
|
158 |
-
) );
|
159 |
-
|
160 |
-
// Redirect
|
161 |
-
$this->route_to( 'content' );
|
162 |
-
}
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Add content files and directories
|
166 |
-
*
|
167 |
-
* @return void
|
168 |
-
*/
|
169 |
-
public function content() {
|
170 |
-
// Set content offset
|
171 |
-
if ( isset( $this->args['content_offset'] ) ) {
|
172 |
-
$content_offset = $this->args['content_offset'];
|
173 |
-
} else {
|
174 |
-
$content_offset = 0;
|
175 |
-
}
|
176 |
-
|
177 |
-
// Set filemap offset
|
178 |
-
if ( isset( $this->args['filemap_offset'] ) ) {
|
179 |
-
$filemap_offset = $this->args['filemap_offset'];
|
180 |
-
} else {
|
181 |
-
$filemap_offset = 0;
|
182 |
-
}
|
183 |
-
|
184 |
-
// Set total files
|
185 |
-
if ( isset( $this->args['total'] ) ) {
|
186 |
-
$total = $this->args['total'];
|
187 |
-
} else {
|
188 |
-
$total = 1;
|
189 |
-
}
|
190 |
-
|
191 |
-
// Set processed files
|
192 |
-
if ( isset( $this->args['processed'] ) ) {
|
193 |
-
$processed = $this->args['processed'];
|
194 |
-
} else {
|
195 |
-
$processed = 0;
|
196 |
-
}
|
197 |
-
|
198 |
-
// What percent of files have we processed?
|
199 |
-
$progress = (int) ( ( $processed / $total ) * 100 );
|
200 |
-
|
201 |
-
// Set progress
|
202 |
-
if ( empty( $content_offset ) ) {
|
203 |
-
Ai1wm_Status::set( array(
|
204 |
-
'type' => 'info',
|
205 |
-
'message' => sprintf( __( 'Archiving %d files...<br />%.2f%% complete', AI1WM_PLUGIN_NAME ), $total, $progress )
|
206 |
-
) );
|
207 |
-
}
|
208 |
-
|
209 |
-
// Get map file
|
210 |
-
$filemap = fopen( $this->storage()->filemap(), 'r' );
|
211 |
-
|
212 |
-
// Start time
|
213 |
-
$start = microtime( true );
|
214 |
-
|
215 |
-
// Flag to hold if all files have been processed
|
216 |
-
$completed = true;
|
217 |
-
|
218 |
-
// Set file map pointer at the current index
|
219 |
-
if ( fseek( $filemap, $filemap_offset ) !== -1 ) {
|
220 |
-
|
221 |
-
// Get archive
|
222 |
-
$archive = new Ai1wm_Compressor( $this->storage()->archive() );
|
223 |
-
|
224 |
-
while ( $path = trim( fgets( $filemap ) ) ) {
|
225 |
-
try {
|
226 |
-
|
227 |
-
// Set absolute path
|
228 |
-
$abs_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path;
|
229 |
-
|
230 |
-
// Add file to archive
|
231 |
-
if ( ( $content_offset = $archive->add_file( $abs_path, $path, $content_offset, 3 ) ) ) {
|
232 |
-
|
233 |
-
// Set progress
|
234 |
-
if ( ( $sub_progress = ( $content_offset / $archive->get_current_filesize() ) ) < 1 ) {
|
235 |
-
$progress += $sub_progress;
|
236 |
-
}
|
237 |
-
|
238 |
-
// Set progress
|
239 |
-
Ai1wm_Status::set( array(
|
240 |
-
'type' => 'info',
|
241 |
-
'message' => sprintf( __( 'Archiving %d files...<br />%.2f%% complete', AI1WM_PLUGIN_NAME ), $total, $progress )
|
242 |
-
) );
|
243 |
-
|
244 |
-
// Set content offset
|
245 |
-
$this->args['content_offset'] = $content_offset;
|
246 |
-
|
247 |
-
// Set filemap offset
|
248 |
-
$this->args['filemap_offset'] = $filemap_offset;
|
249 |
-
|
250 |
-
// Close the filemap file
|
251 |
-
fclose( $filemap );
|
252 |
-
|
253 |
-
// Redirect
|
254 |
-
return $this->route_to( 'content' );
|
255 |
-
|
256 |
-
}
|
257 |
-
|
258 |
-
// Set content offset
|
259 |
-
$content_offset = 0;
|
260 |
-
|
261 |
-
// Set filemap offset
|
262 |
-
$filemap_offset = ftell( $filemap );
|
263 |
-
|
264 |
-
} catch ( Exception $e ) {
|
265 |
-
// Skip bad file permissions
|
266 |
-
}
|
267 |
-
|
268 |
-
$processed++;
|
269 |
-
|
270 |
-
// Time elapsed
|
271 |
-
if ( ( microtime( true ) - $start ) > 3 ) {
|
272 |
-
// More than 3 seconds have passed, break and do another request
|
273 |
-
$completed = false;
|
274 |
-
break;
|
275 |
-
}
|
276 |
-
}
|
277 |
-
|
278 |
-
$archive->close();
|
279 |
-
}
|
280 |
-
|
281 |
-
// Set content offset
|
282 |
-
$this->args['content_offset'] = $content_offset;
|
283 |
-
|
284 |
-
// Set filemap offset
|
285 |
-
$this->args['filemap_offset'] = $filemap_offset;
|
286 |
-
|
287 |
-
// Set processed files
|
288 |
-
$this->args['processed'] = $processed;
|
289 |
-
|
290 |
-
// Close the filemap file
|
291 |
-
fclose( $filemap );
|
292 |
-
|
293 |
-
// Redirect
|
294 |
-
if ( $completed ) {
|
295 |
-
$this->route_to( 'database' );
|
296 |
-
} else {
|
297 |
-
$this->route_to( 'content' );
|
298 |
-
}
|
299 |
-
}
|
300 |
-
|
301 |
-
/**
|
302 |
-
* Add database
|
303 |
-
*
|
304 |
-
* @return void
|
305 |
-
*/
|
306 |
-
public function database() {
|
307 |
-
// Set exclude database
|
308 |
-
if ( $this->should_exclude_database() ) {
|
309 |
-
// Disable maintenance mode
|
310 |
-
Ai1wm_Maintenance::disable();
|
311 |
-
|
312 |
-
// Redirect
|
313 |
-
return $this->route_to( 'export' );
|
314 |
-
}
|
315 |
-
|
316 |
-
// Set progress
|
317 |
-
Ai1wm_Status::set( array(
|
318 |
-
'type' => 'info',
|
319 |
-
'message' => __( 'Exporting database...', AI1WM_PLUGIN_NAME )
|
320 |
-
) );
|
321 |
-
|
322 |
-
// Get databsae file
|
323 |
-
$service = new Ai1wm_Service_Database( $this->args );
|
324 |
-
$service->export();
|
325 |
-
|
326 |
-
// Get archive file
|
327 |
-
$archive = new Ai1wm_Compressor( $this->storage()->archive() );
|
328 |
-
|
329 |
-
// Add database to archive
|
330 |
-
$archive->add_file( $this->storage()->database(), AI1WM_DATABASE_NAME );
|
331 |
-
$archive->close();
|
332 |
-
|
333 |
-
// Set progress
|
334 |
-
Ai1wm_Status::set( array(
|
335 |
-
'type' => 'info',
|
336 |
-
'message' => __( 'Done exporting database.', AI1WM_PLUGIN_NAME )
|
337 |
-
) );
|
338 |
-
|
339 |
-
// Disable maintenance mode
|
340 |
-
Ai1wm_Maintenance::disable();
|
341 |
-
|
342 |
-
// Redirect
|
343 |
-
$this->route_to( 'export' );
|
344 |
-
}
|
345 |
-
|
346 |
-
/**
|
347 |
-
* Stop export and clean storage
|
348 |
-
*
|
349 |
-
* @return void
|
350 |
-
*/
|
351 |
-
public function stop() {
|
352 |
-
$this->storage()->clean();
|
353 |
-
}
|
354 |
-
|
355 |
-
/**
|
356 |
-
* Clean storage path
|
357 |
-
*
|
358 |
-
* @return void
|
359 |
-
*/
|
360 |
-
public function clean() {
|
361 |
-
$this->storage()->clean();
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Get export package
|
366 |
-
*
|
367 |
-
* @return void
|
368 |
-
*/
|
369 |
-
abstract public function export();
|
370 |
-
|
371 |
-
/*
|
372 |
-
* Get storage object
|
373 |
-
*
|
374 |
-
* @return Ai1wm_Storage
|
375 |
-
*/
|
376 |
-
protected function storage() {
|
377 |
-
if ( $this->storage === null ) {
|
378 |
-
if ( isset( $this->args['archive'] ) ) {
|
379 |
-
$this->args['archive'] = basename( $this->args['archive'] );
|
380 |
-
} else {
|
381 |
-
$this->args['archive'] = $this->filename();
|
382 |
-
}
|
383 |
-
|
384 |
-
$this->storage = new Ai1wm_Storage( $this->args );
|
385 |
-
}
|
386 |
-
|
387 |
-
return $this->storage;
|
388 |
-
}
|
389 |
-
|
390 |
-
/**
|
391 |
-
* Get file name
|
392 |
-
*
|
393 |
-
* @return string
|
394 |
-
*/
|
395 |
-
protected function filename() {
|
396 |
-
$url = parse_url( home_url() );
|
397 |
-
$name = array();
|
398 |
-
|
399 |
-
// Add domain
|
400 |
-
if ( isset( $url['host'] ) ) {
|
401 |
-
$name[] = $url['host'];
|
402 |
-
}
|
403 |
-
|
404 |
-
// Add path
|
405 |
-
if ( isset( $url['path'] ) ) {
|
406 |
-
$name[] = trim( $url['path'], '/' );
|
407 |
-
}
|
408 |
-
|
409 |
-
// Add year, month and day
|
410 |
-
$name[] = date( 'Ymd' );
|
411 |
-
|
412 |
-
// Add hours, minutes and seconds
|
413 |
-
$name[] = date( 'His' );
|
414 |
-
|
415 |
-
// Add unique identifier
|
416 |
-
$name[] = rand( 100, 999 );
|
417 |
-
|
418 |
-
return sprintf( '%s.wpress', implode( '-', $name ) );
|
419 |
-
}
|
420 |
-
|
421 |
-
/**
|
422 |
-
* Get folder name
|
423 |
-
*
|
424 |
-
* @return string
|
425 |
-
*/
|
426 |
-
protected function foldername() {
|
427 |
-
$url = parse_url( home_url() );
|
428 |
-
$name = array();
|
429 |
-
|
430 |
-
// Add domain
|
431 |
-
if ( isset( $url['host'] ) ) {
|
432 |
-
$name[] = $url['host'];
|
433 |
-
}
|
434 |
-
|
435 |
-
// Add path
|
436 |
-
if ( isset( $url['path'] ) ) {
|
437 |
-
$name[] = trim( $url['path'] , '/' );
|
438 |
-
}
|
439 |
-
|
440 |
-
return implode( '-', $name );
|
441 |
-
}
|
442 |
-
|
443 |
-
/**
|
444 |
-
* Route to method
|
445 |
-
*
|
446 |
-
* @param string $method Name of the method
|
447 |
-
* @return void
|
448 |
-
*/
|
449 |
-
protected function route_to( $method ) {
|
450 |
-
// Redirect arguments
|
451 |
-
$this->args['method'] = $method;
|
452 |
-
$this->args['secret_key'] = get_site_option( AI1WM_SECRET_KEY, false, false );
|
453 |
-
|
454 |
-
// Check the status of the export, maybe we need to stop it
|
455 |
-
if ( ! is_file( $this->storage()->archive() ) ) {
|
456 |
-
exit;
|
457 |
-
}
|
458 |
-
|
459 |
-
// HTTP request
|
460 |
-
Ai1wm_Http::get( admin_url( 'admin-ajax.php?action=ai1wm_export' ), $this->args );
|
461 |
-
}
|
462 |
-
|
463 |
-
/**
|
464 |
-
* Should exclude database?
|
465 |
-
*
|
466 |
-
* @return boolean
|
467 |
-
*/
|
468 |
-
protected function should_exclude_database() {
|
469 |
-
return isset( $this->args['options']['no-database'] );
|
470 |
-
}
|
471 |
-
|
472 |
-
/**
|
473 |
-
* Should exclude media?
|
474 |
-
*
|
475 |
-
* @return boolean
|
476 |
-
*/
|
477 |
-
protected function should_exclude_media() {
|
478 |
-
return isset( $this->args['options']['no-media'] );
|
479 |
-
}
|
480 |
-
|
481 |
-
/**
|
482 |
-
* Should exclude themes?
|
483 |
-
*
|
484 |
-
* @return boolean
|
485 |
-
*/
|
486 |
-
protected function should_exclude_themes() {
|
487 |
-
return isset( $this->args['options']['no-themes'] );
|
488 |
-
}
|
489 |
-
|
490 |
-
/**
|
491 |
-
* Should exclude plugins?
|
492 |
-
*
|
493 |
-
* @return boolean
|
494 |
-
*/
|
495 |
-
protected function should_exclude_plugins() {
|
496 |
-
return isset( $this->args['options']['no-plugins'] );
|
497 |
-
}
|
498 |
-
|
499 |
-
/**
|
500 |
-
* Should enable maintenance?
|
501 |
-
*
|
502 |
-
* @return boolean
|
503 |
-
*/
|
504 |
-
protected function should_enable_maintenance() {
|
505 |
-
return isset( $this->args['options']['maintenance-mode'] );
|
506 |
-
}
|
507 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/model/class-ai1wm-feedback.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -35,17 +35,18 @@ class Ai1wm_Feedback {
|
|
35 |
*
|
36 |
* @return array
|
37 |
*/
|
38 |
-
public function
|
39 |
$errors = array();
|
|
|
40 |
// Submit feedback to ServMask
|
41 |
if ( empty( $type ) ) {
|
42 |
-
$errors[] = 'Feedback type is invalid.';
|
43 |
} else if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
|
44 |
-
$errors[] = 'Your email is not valid.';
|
45 |
} else if ( empty( $message ) ) {
|
46 |
-
$errors[] = 'Please enter comments in the text area.';
|
47 |
-
} else if (
|
48 |
-
$errors[] = 'Please accept feedback term conditions.';
|
49 |
} else {
|
50 |
$response = wp_remote_post(
|
51 |
AI1WM_FEEDBACK_URL,
|
@@ -60,8 +61,9 @@ class Ai1wm_Feedback {
|
|
60 |
),
|
61 |
)
|
62 |
);
|
|
|
63 |
if ( is_wp_error( $response ) ) {
|
64 |
-
$errors[] = 'Something went wrong: '
|
65 |
}
|
66 |
}
|
67 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
35 |
*
|
36 |
* @return array
|
37 |
*/
|
38 |
+
public function add( $type, $email, $message, $terms ) {
|
39 |
$errors = array();
|
40 |
+
|
41 |
// Submit feedback to ServMask
|
42 |
if ( empty( $type ) ) {
|
43 |
+
$errors[] = __( 'Feedback type is invalid.', AI1WM_PLUGIN_NAME );
|
44 |
} else if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
|
45 |
+
$errors[] = __( 'Your email is not valid.', AI1WM_PLUGIN_NAME );
|
46 |
} else if ( empty( $message ) ) {
|
47 |
+
$errors[] = __( 'Please enter comments in the text area.', AI1WM_PLUGIN_NAME );
|
48 |
+
} else if ( empty( $terms ) ) {
|
49 |
+
$errors[] = __( 'Please accept feedback term conditions.', AI1WM_PLUGIN_NAME );
|
50 |
} else {
|
51 |
$response = wp_remote_post(
|
52 |
AI1WM_FEEDBACK_URL,
|
61 |
),
|
62 |
)
|
63 |
);
|
64 |
+
|
65 |
if ( is_wp_error( $response ) ) {
|
66 |
+
$errors[] = sprintf( __( 'Something went wrong: %s', AI1WM_PLUGIN_NAME ), $response->get_error_message() );
|
67 |
}
|
68 |
}
|
69 |
|
lib/model/class-ai1wm-handler.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Handler {
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Error handler
|
30 |
+
*
|
31 |
+
* @param integer $errno Error level
|
32 |
+
* @param string $errstr Error message
|
33 |
+
* @param string $errfile Error file
|
34 |
+
* @param integer $errline Error line
|
35 |
+
* @return void
|
36 |
+
*/
|
37 |
+
public static function error( $errno, $errstr, $errfile, $errline ) {
|
38 |
+
Ai1wm_Log::error( array(
|
39 |
+
'Number' => $errno,
|
40 |
+
'Message' => $errstr,
|
41 |
+
'File' => $errfile,
|
42 |
+
'Line' => $errline,
|
43 |
+
) );
|
44 |
+
}
|
45 |
+
}
|
lib/model/class-ai1wm-http.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -29,6 +29,11 @@ class Ai1wm_Http {
|
|
29 |
|
30 |
public static function get( $url, $params = array() ) {
|
31 |
|
|
|
|
|
|
|
|
|
|
|
32 |
// Get IP address
|
33 |
$ip = get_site_option( AI1WM_URL_IP, false, false );
|
34 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
29 |
|
30 |
public static function get( $url, $params = array() ) {
|
31 |
|
32 |
+
// Check the status, maybe we need to stop it
|
33 |
+
if ( ! is_file( ai1wm_export_path( $params ) ) && ! is_file( ai1wm_import_path( $params ) ) ) {
|
34 |
+
exit;
|
35 |
+
}
|
36 |
+
|
37 |
// Get IP address
|
38 |
$ip = get_site_option( AI1WM_URL_IP, false, false );
|
39 |
|
lib/model/class-ai1wm-import-abstract.php
DELETED
@@ -1,437 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
-
*
|
5 |
-
* This program is free software: you can redistribute it and/or modify
|
6 |
-
* it under the terms of the GNU General Public License as published by
|
7 |
-
* the Free Software Foundation, either version 3 of the License, or
|
8 |
-
* (at your option) any later version.
|
9 |
-
*
|
10 |
-
* This program is distributed in the hope that it will be useful,
|
11 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
-
* You should have received a copy of the GNU General Public License
|
16 |
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
-
*
|
18 |
-
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
-
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
-
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
-
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
-
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
-
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
-
*/
|
25 |
-
|
26 |
-
abstract class Ai1wm_Import_Abstract {
|
27 |
-
|
28 |
-
protected $args = array();
|
29 |
-
|
30 |
-
protected $storage = null;
|
31 |
-
|
32 |
-
public function __construct( array $args = array() ) {
|
33 |
-
$this->args = $args;
|
34 |
-
|
35 |
-
// HTTP resolve
|
36 |
-
if ( $this->args['method'] === 'import' ) {
|
37 |
-
Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Unpack archive
|
43 |
-
*
|
44 |
-
* @return void
|
45 |
-
*/
|
46 |
-
public function start() {
|
47 |
-
// Set default progress
|
48 |
-
Ai1wm_Status::set( array(
|
49 |
-
'type' => 'info',
|
50 |
-
'message' => __( 'Unpacking archive...', AI1WM_PLUGIN_NAME ),
|
51 |
-
) );
|
52 |
-
|
53 |
-
// Open the archive file for reading
|
54 |
-
$archive = new Ai1wm_Extractor( $this->storage()->archive() );
|
55 |
-
|
56 |
-
// Unpack package.json and database.sql files
|
57 |
-
$archive->extract_by_files_array(
|
58 |
-
$this->storage()->path(),
|
59 |
-
array(
|
60 |
-
AI1WM_PACKAGE_NAME,
|
61 |
-
AI1WM_DATABASE_NAME,
|
62 |
-
)
|
63 |
-
);
|
64 |
-
|
65 |
-
// Close the archive file
|
66 |
-
$archive->close();
|
67 |
-
|
68 |
-
// Validate the archive file
|
69 |
-
if ( $this->validate() ) {
|
70 |
-
|
71 |
-
// Parse the package file
|
72 |
-
$service = new Ai1wm_Service_Package( $this->args );
|
73 |
-
if ( $service->import() ) {
|
74 |
-
$this->route_to( 'confirm' );
|
75 |
-
} else {
|
76 |
-
throw new Ai1wm_Import_Exception( __( 'Invalid package.json file.', AI1WM_PLUGIN_NAME ) );
|
77 |
-
}
|
78 |
-
|
79 |
-
} else {
|
80 |
-
throw new Ai1wm_Import_Exception(
|
81 |
-
__( 'Invalid archive file. It should contain <strong>package.json</strong> file.', AI1WM_PLUGIN_NAME )
|
82 |
-
);
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Confirm import
|
88 |
-
*
|
89 |
-
* @return void
|
90 |
-
*/
|
91 |
-
public function confirm() {
|
92 |
-
// Obtain the size of the archive
|
93 |
-
$size = @filesize( $this->storage()->archive() );
|
94 |
-
|
95 |
-
if ( false === $size ) {
|
96 |
-
throw new Ai1wm_Not_Accesible_Exception(
|
97 |
-
sprintf(
|
98 |
-
__(
|
99 |
-
'Unable to get the file size of <strong>"%s"</strong>',
|
100 |
-
AI1WM_PLUGIN_NAME
|
101 |
-
),
|
102 |
-
$this->storage()->archive()
|
103 |
-
)
|
104 |
-
);
|
105 |
-
}
|
106 |
-
|
107 |
-
$allowed_size = apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE );
|
108 |
-
|
109 |
-
// Let's check the size of the file to make sure it is less than the maximum allowed
|
110 |
-
if ( ( $allowed_size > 0 ) && ( $size > $allowed_size ) ) {
|
111 |
-
throw new Ai1wm_Import_Exception(
|
112 |
-
sprintf(
|
113 |
-
__(
|
114 |
-
'The file that you are trying to import is over the maximum upload file size limit of %s.' .
|
115 |
-
'<br />You can remove this restriction by purchasing our ' .
|
116 |
-
'<a href="https://servmask.com/products/unlimited-extension" target="_blank">Unlimited Extension</a>.',
|
117 |
-
AI1WM_PLUGIN_NAME
|
118 |
-
),
|
119 |
-
apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE )
|
120 |
-
)
|
121 |
-
);
|
122 |
-
}
|
123 |
-
|
124 |
-
// Set progress
|
125 |
-
Ai1wm_Status::set(
|
126 |
-
array(
|
127 |
-
'type' => 'confirm',
|
128 |
-
'message' => __(
|
129 |
-
'The import process will overwrite your database, media, plugins, and themes. ' .
|
130 |
-
'Please ensure that you have a backup of your data before proceeding to the next step.',
|
131 |
-
AI1WM_PLUGIN_NAME
|
132 |
-
),
|
133 |
-
)
|
134 |
-
);
|
135 |
-
}
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Enumerate content files and directories
|
139 |
-
*
|
140 |
-
* @return void
|
141 |
-
*/
|
142 |
-
public function enumerate() {
|
143 |
-
// Set progress
|
144 |
-
Ai1wm_Status::set( array(
|
145 |
-
'type' => 'info',
|
146 |
-
'message' => __( 'Retrieving a list of all WordPress files...', AI1WM_PLUGIN_NAME )
|
147 |
-
) );
|
148 |
-
|
149 |
-
// Open the archive file for reading
|
150 |
-
$archive = new Ai1wm_Extractor( $this->storage()->archive() );
|
151 |
-
|
152 |
-
// Get number of files
|
153 |
-
$total = $archive->get_number_of_files();
|
154 |
-
|
155 |
-
// Close the archive file
|
156 |
-
$archive->close();
|
157 |
-
|
158 |
-
// Set total
|
159 |
-
$this->args['total'] = $total;
|
160 |
-
|
161 |
-
// Set progress
|
162 |
-
Ai1wm_Status::set( array(
|
163 |
-
'type' => 'info',
|
164 |
-
'message' => __( 'Done retrieving a list of all WordPress files.', AI1WM_PLUGIN_NAME ),
|
165 |
-
) );
|
166 |
-
|
167 |
-
// Redirect
|
168 |
-
$this->route_to( 'truncate' );
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Truncate content files and directories
|
173 |
-
*
|
174 |
-
* @return void
|
175 |
-
*/
|
176 |
-
public function truncate() {
|
177 |
-
// Enable maintenance mode
|
178 |
-
Ai1wm_Maintenance::enable();
|
179 |
-
|
180 |
-
// Redirect
|
181 |
-
$this->route_to( 'content' );
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Add content files and directories
|
186 |
-
*
|
187 |
-
* @return void
|
188 |
-
*/
|
189 |
-
public function content() {
|
190 |
-
// Set content offset
|
191 |
-
if ( isset( $this->args['content_offset'] ) ) {
|
192 |
-
$content_offset = $this->args['content_offset'];
|
193 |
-
} else {
|
194 |
-
$content_offset = 0;
|
195 |
-
}
|
196 |
-
|
197 |
-
// Set archive offset
|
198 |
-
if ( isset( $this->args['archive_offset']) ) {
|
199 |
-
$archive_offset = $this->args['archive_offset'];
|
200 |
-
} else {
|
201 |
-
$archive_offset = 0;
|
202 |
-
}
|
203 |
-
|
204 |
-
// Set total files
|
205 |
-
if ( isset( $this->args['total'] ) ) {
|
206 |
-
$total = $this->args['total'];
|
207 |
-
} else {
|
208 |
-
$total = 1;
|
209 |
-
}
|
210 |
-
|
211 |
-
// Set processed files
|
212 |
-
if ( isset( $this->args['processed'] ) ) {
|
213 |
-
$processed = $this->args['processed'];
|
214 |
-
} else {
|
215 |
-
$processed = 0;
|
216 |
-
}
|
217 |
-
|
218 |
-
// What percent of files have we processed?
|
219 |
-
$progress = (int) ( ( $processed / $total ) * 100 );
|
220 |
-
|
221 |
-
// Set progress
|
222 |
-
if ( empty( $content_offset ) ) {
|
223 |
-
Ai1wm_Status::set( array(
|
224 |
-
'type' => 'info',
|
225 |
-
'message' => sprintf( __( 'Restoring %d files...<br />%.2f%% complete', AI1WM_PLUGIN_NAME ), $total, $progress ),
|
226 |
-
) );
|
227 |
-
}
|
228 |
-
|
229 |
-
// Start time
|
230 |
-
$start = microtime( true );
|
231 |
-
|
232 |
-
// Flag to hold if all files have been processed
|
233 |
-
$completed = true;
|
234 |
-
|
235 |
-
// Open the archive file for reading
|
236 |
-
$archive = new Ai1wm_Extractor( $this->storage()->archive() );
|
237 |
-
|
238 |
-
// Set the file pointer to the one that we have saved
|
239 |
-
$archive->set_file_pointer( null, $archive_offset );
|
240 |
-
|
241 |
-
while ( $archive->has_not_reached_eof() ) {
|
242 |
-
try {
|
243 |
-
|
244 |
-
// Extract a file from archive to WP_CONTENT_DIR
|
245 |
-
if ( ( $content_offset = $archive->extract_one_file_to( WP_CONTENT_DIR, array( AI1WM_PACKAGE_NAME, AI1WM_DATABASE_NAME ), $content_offset, 3 ) ) ) {
|
246 |
-
|
247 |
-
// Set progress
|
248 |
-
if ( ( $sub_progress = ( $content_offset / $archive->get_current_filesize() ) ) < 1 ) {
|
249 |
-
$progress += $sub_progress;
|
250 |
-
}
|
251 |
-
|
252 |
-
// Set progress
|
253 |
-
Ai1wm_Status::set( array(
|
254 |
-
'type' => 'info',
|
255 |
-
'message' => sprintf( __( 'Restoring %d files...<br />%.2f%% complete', AI1WM_PLUGIN_NAME ), $total, $progress ),
|
256 |
-
) );
|
257 |
-
|
258 |
-
// Set content offset
|
259 |
-
$this->args['content_offset'] = $content_offset;
|
260 |
-
|
261 |
-
// Set archive offset
|
262 |
-
$this->args['archive_offset'] = $archive_offset;
|
263 |
-
|
264 |
-
// Close the archive file
|
265 |
-
$archive->close();
|
266 |
-
|
267 |
-
// Redirect
|
268 |
-
return $this->route_to( 'content' );
|
269 |
-
|
270 |
-
}
|
271 |
-
|
272 |
-
// Set content offset
|
273 |
-
$content_offset = 0;
|
274 |
-
|
275 |
-
// Set archive offset
|
276 |
-
$archive_offset = $archive->get_file_pointer();
|
277 |
-
|
278 |
-
} catch ( Exception $e ) {
|
279 |
-
// Skip bad file permissions
|
280 |
-
}
|
281 |
-
|
282 |
-
// Increment processed files counter
|
283 |
-
$processed++;
|
284 |
-
|
285 |
-
// Time elapsed
|
286 |
-
if ( ( microtime( true ) - $start ) > 3 ) {
|
287 |
-
// More than 3 seconds have passed, break and do another request
|
288 |
-
$completed = false;
|
289 |
-
break;
|
290 |
-
}
|
291 |
-
}
|
292 |
-
|
293 |
-
// Set content offset
|
294 |
-
$this->args['content_offset'] = $content_offset;
|
295 |
-
|
296 |
-
// Set archive offset
|
297 |
-
$this->args['archive_offset'] = $archive_offset;
|
298 |
-
|
299 |
-
// Set processed files
|
300 |
-
$this->args['processed'] = $processed;
|
301 |
-
|
302 |
-
// Close the archive file
|
303 |
-
$archive->close();
|
304 |
-
|
305 |
-
// Redirect
|
306 |
-
if ( $completed ) {
|
307 |
-
$this->route_to( 'database' );
|
308 |
-
} else {
|
309 |
-
$this->route_to( 'content' );
|
310 |
-
}
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Add database
|
315 |
-
*
|
316 |
-
* @return void
|
317 |
-
*/
|
318 |
-
public function database() {
|
319 |
-
// Set exclude database
|
320 |
-
if ( ! is_file( $this->storage()->database() ) ) {
|
321 |
-
return $this->route_to( 'finish' );
|
322 |
-
}
|
323 |
-
|
324 |
-
// Display progress
|
325 |
-
Ai1wm_Status::set( array(
|
326 |
-
'type' => 'info',
|
327 |
-
'message' => __( 'Restoring database...', AI1WM_PLUGIN_NAME ),
|
328 |
-
) );
|
329 |
-
|
330 |
-
// Get database file
|
331 |
-
$service = new Ai1wm_Service_Database( $this->args );
|
332 |
-
$service->import();
|
333 |
-
|
334 |
-
// Redirect
|
335 |
-
$this->route_to( 'finish' );
|
336 |
-
}
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Finish import process
|
340 |
-
*
|
341 |
-
* @return void
|
342 |
-
*/
|
343 |
-
public function finish() {
|
344 |
-
// Set progress
|
345 |
-
Ai1wm_Status::set( array(
|
346 |
-
'type' => 'finish',
|
347 |
-
'title' => __( 'Your data has been imported successfuly!', AI1WM_PLUGIN_NAME ),
|
348 |
-
'message' => sprintf(
|
349 |
-
__(
|
350 |
-
'You need to perform two more steps:<br />' .
|
351 |
-
'<strong>1. You must save your permalinks structure twice. <a class="ai1wm-no-underline" href="%s" target="_blank">Permalinks Settings</a></strong> <small>(opens a new window)</small><br />' .
|
352 |
-
'<strong>2. <a class="ai1wm-no-underline" href="https://wordpress.org/support/view/plugin-reviews/all-in-one-wp-migration?rate=5#postform" target="_blank">Review the plugin</a>.</strong> <small>(opens a new window)</small>',
|
353 |
-
AI1WM_PLUGIN_NAME
|
354 |
-
),
|
355 |
-
admin_url( 'options-permalink.php#submit' )
|
356 |
-
)
|
357 |
-
) );
|
358 |
-
|
359 |
-
// Disable maintenance mode
|
360 |
-
Ai1wm_Maintenance::disable();
|
361 |
-
}
|
362 |
-
|
363 |
-
/**
|
364 |
-
* Stop import and clean storage
|
365 |
-
*
|
366 |
-
* @return void
|
367 |
-
*/
|
368 |
-
public function stop() {
|
369 |
-
$this->storage->clean();
|
370 |
-
}
|
371 |
-
|
372 |
-
/**
|
373 |
-
* Clean storage path
|
374 |
-
*
|
375 |
-
* @return void
|
376 |
-
*/
|
377 |
-
public function clean() {
|
378 |
-
$this->storage()->clean();
|
379 |
-
}
|
380 |
-
|
381 |
-
/**
|
382 |
-
* Get import archive
|
383 |
-
*
|
384 |
-
* @return void
|
385 |
-
*/
|
386 |
-
abstract public function import();
|
387 |
-
|
388 |
-
/**
|
389 |
-
* Validate archive and WP_CONTENT_DIR permissions
|
390 |
-
*
|
391 |
-
* @return boolean
|
392 |
-
*/
|
393 |
-
protected function validate() {
|
394 |
-
if ( is_file( $this->storage()->package() ) ) {
|
395 |
-
return true;
|
396 |
-
}
|
397 |
-
|
398 |
-
return false;
|
399 |
-
}
|
400 |
-
|
401 |
-
/*
|
402 |
-
* Get storage object
|
403 |
-
*
|
404 |
-
* @return Ai1wm_Storage
|
405 |
-
*/
|
406 |
-
protected function storage() {
|
407 |
-
if ( $this->storage === null ) {
|
408 |
-
if ( isset( $this->args['archive'] ) ) {
|
409 |
-
$this->args['archive'] = basename( $this->args['archive'] );
|
410 |
-
}
|
411 |
-
|
412 |
-
$this->storage = new Ai1wm_Storage( $this->args );
|
413 |
-
}
|
414 |
-
|
415 |
-
return $this->storage;
|
416 |
-
}
|
417 |
-
|
418 |
-
/**
|
419 |
-
* Route to method
|
420 |
-
*
|
421 |
-
* @param string $method Name of the method
|
422 |
-
* @return void
|
423 |
-
*/
|
424 |
-
protected function route_to( $method ) {
|
425 |
-
// Redirect arguments
|
426 |
-
$this->args['method'] = $method;
|
427 |
-
$this->args['secret_key'] = get_site_option( AI1WM_SECRET_KEY, false, false );
|
428 |
-
|
429 |
-
// Check the status of the export, maybe we need to stop it
|
430 |
-
if ( ! is_file( $this->storage()->archive() ) ) {
|
431 |
-
exit;
|
432 |
-
}
|
433 |
-
|
434 |
-
// HTTP request
|
435 |
-
Ai1wm_Http::get( admin_url( 'admin-ajax.php?action=ai1wm_import' ), $this->args );
|
436 |
-
}
|
437 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/model/class-ai1wm-log.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -25,107 +25,64 @@
|
|
25 |
|
26 |
class Ai1wm_Log {
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
*
|
31 |
-
* @param string $message Log message
|
32 |
-
* @return void
|
33 |
-
*/
|
34 |
-
public static function info( $message ) {
|
35 |
-
self::write( $message, 'INFO' );
|
36 |
-
}
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
*
|
41 |
-
* @param string $message Log message
|
42 |
-
* @return void
|
43 |
-
*/
|
44 |
-
public static function error( $message ) {
|
45 |
-
self::write( $message, 'ERROR' );
|
46 |
-
}
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
*
|
51 |
-
* @param string $message Log message
|
52 |
-
* @param string $type Log type
|
53 |
-
* @return void
|
54 |
-
*/
|
55 |
-
public static function write( $message, $type = 'INFO' ) {
|
56 |
-
// Set date to UTC
|
57 |
-
@date_default_timezone_set( 'UTC' );
|
58 |
|
59 |
-
//
|
60 |
-
$
|
61 |
|
62 |
-
//
|
63 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
-
|
66 |
-
$
|
67 |
|
68 |
-
//
|
69 |
-
$
|
70 |
|
71 |
-
//
|
72 |
-
$
|
73 |
|
74 |
-
//
|
75 |
-
$
|
76 |
|
77 |
-
//
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
82 |
}
|
83 |
}
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
*
|
88 |
-
* @param int $errno Error level
|
89 |
-
* @param string $errstr Error message
|
90 |
-
* @param string $errfile Error file
|
91 |
-
* @param int $errline Error line
|
92 |
-
* @return void
|
93 |
-
*/
|
94 |
-
public static function error_handler( $errno, $errstr, $errfile, $errline ) {
|
95 |
-
$message = array();
|
96 |
-
|
97 |
-
// Add an empty line
|
98 |
-
$message[] = '';
|
99 |
-
$message[] = 'Number: ' . $errno;
|
100 |
-
$message[] = 'Message: ' . $errstr;
|
101 |
-
$message[] = 'File: ' . $errfile;
|
102 |
-
$message[] = 'Line: ' . $errline;
|
103 |
-
$message[] = '--------------------------------------------';
|
104 |
-
|
105 |
-
$message = implode( PHP_EOL, $message );
|
106 |
-
|
107 |
-
self::write( $message, 'ERROR_HANDLER' );
|
108 |
-
}
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
$
|
118 |
-
|
119 |
-
//
|
120 |
-
$
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
$message[] = 'Line: ' . $exception->getLine();
|
125 |
-
$message[] = '--------------------------------------------';
|
126 |
-
|
127 |
-
$message = implode( PHP_EOL, $message );
|
128 |
-
|
129 |
-
self::write( $message, 'EXCEPTION_HANDLER' );
|
130 |
}
|
131 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
25 |
|
26 |
class Ai1wm_Log {
|
27 |
|
28 |
+
public static function export( $params ) {
|
29 |
+
$data = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
// Add date
|
32 |
+
$data[] = date( 'M d Y H:i:s' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
+
// Add params
|
35 |
+
$data[] = print_r( $params, true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
+
// Add empty line
|
38 |
+
$data[] = PHP_EOL;
|
39 |
|
40 |
+
// Write log data
|
41 |
+
if ( empty( $params['priority'] ) || is_file( ai1wm_export_path( $params ) ) ) {
|
42 |
+
if ( $handle = fopen( ai1wm_export_path( $params ), 'a' ) ) {
|
43 |
+
fwrite( $handle, implode( $data, PHP_EOL ) );
|
44 |
+
fclose( $handle );
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
|
49 |
+
public static function import( $params ) {
|
50 |
+
$data = array();
|
51 |
|
52 |
+
// Add date
|
53 |
+
$data[] = date( 'M d Y H:i:s' );
|
54 |
|
55 |
+
// Add params
|
56 |
+
$data[] = print_r( $params, true );
|
57 |
|
58 |
+
// Add empty line
|
59 |
+
$data[] = PHP_EOL;
|
60 |
|
61 |
+
// Write log data
|
62 |
+
if ( empty( $params['priority'] ) || is_file( ai1wm_import_path( $params ) ) ) {
|
63 |
+
if ( $handle = fopen( ai1wm_import_path( $params ), 'a' ) ) {
|
64 |
+
fwrite( $handle, implode( $data, PHP_EOL ) );
|
65 |
+
fclose( $handle );
|
66 |
+
}
|
67 |
}
|
68 |
}
|
69 |
|
70 |
+
public static function error( $params ) {
|
71 |
+
$data = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
+
// Add date
|
74 |
+
$data[] = date( 'M d Y H:i:s' );
|
75 |
+
|
76 |
+
// Add params
|
77 |
+
$data[] = print_r( $params, true );
|
78 |
+
|
79 |
+
// Add empty line
|
80 |
+
$data[] = PHP_EOL;
|
81 |
+
|
82 |
+
// Write log data
|
83 |
+
if ( $handle = fopen( ai1wm_error_path(), 'a' ) ) {
|
84 |
+
fwrite( $handle, implode( $data, PHP_EOL ) );
|
85 |
+
fclose( $handle );
|
86 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
+
}
|
lib/model/class-ai1wm-report.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -34,15 +34,16 @@ class Ai1wm_Report {
|
|
34 |
*
|
35 |
* @return array
|
36 |
*/
|
37 |
-
public function
|
38 |
$errors = array();
|
|
|
39 |
// Submit report to ServMask
|
40 |
if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
|
41 |
-
$errors[] = 'Your email is not valid.';
|
42 |
} else if ( empty( $message ) ) {
|
43 |
-
$errors[] = 'Please enter comments in the text area.';
|
44 |
-
} else if (
|
45 |
-
$errors[] = 'Please accept report term conditions.';
|
46 |
} else {
|
47 |
$response = wp_remote_post(
|
48 |
AI1WM_REPORT_URL,
|
@@ -57,7 +58,7 @@ class Ai1wm_Report {
|
|
57 |
)
|
58 |
);
|
59 |
if ( is_wp_error( $response ) ) {
|
60 |
-
$errors[] = 'Something went wrong: '
|
61 |
}
|
62 |
}
|
63 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
34 |
*
|
35 |
* @return array
|
36 |
*/
|
37 |
+
public function add( $email, $message, $terms ) {
|
38 |
$errors = array();
|
39 |
+
|
40 |
// Submit report to ServMask
|
41 |
if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
|
42 |
+
$errors[] = __( 'Your email is not valid.', AI1WM_PLUGIN_NAME );
|
43 |
} else if ( empty( $message ) ) {
|
44 |
+
$errors[] = __( 'Please enter comments in the text area.', AI1WM_PLUGIN_NAME );
|
45 |
+
} else if ( empty( $terms ) ) {
|
46 |
+
$errors[] = __( 'Please accept report term conditions.', AI1WM_PLUGIN_NAME );
|
47 |
} else {
|
48 |
$response = wp_remote_post(
|
49 |
AI1WM_REPORT_URL,
|
58 |
)
|
59 |
);
|
60 |
if ( is_wp_error( $response ) ) {
|
61 |
+
$errors[] = sprintf( __( 'Something went wrong: %s', AI1WM_PLUGIN_NAME ), $response->get_error_message() );
|
62 |
}
|
63 |
}
|
64 |
|
lib/model/class-ai1wm-status.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -25,120 +25,34 @@
|
|
25 |
|
26 |
class Ai1wm_Status {
|
27 |
|
28 |
-
public static function
|
29 |
-
|
30 |
-
if ( is_file( AI1WM_STATUS_FILE ) ) {
|
31 |
-
// open status file for reading
|
32 |
-
$handle = @fopen( AI1WM_STATUS_FILE, 'r' );
|
33 |
-
if ( false === $handle ) {
|
34 |
-
throw new Ai1wm_Not_Accesible_Exception(
|
35 |
-
sprintf(
|
36 |
-
__( 'Unable to open <strong>"%s"</strong> for reading.', AI1WM_PLUGIN_NAME ),
|
37 |
-
AI1WM_STATUS_FILE
|
38 |
-
)
|
39 |
-
);
|
40 |
-
}
|
41 |
-
|
42 |
-
// holds the content of the file
|
43 |
-
$content = '';
|
44 |
-
while ( false === feof( $handle ) ) {
|
45 |
-
$chunk = @fread( $handle, 512 );
|
46 |
-
if ( false === $chunk ) {
|
47 |
-
throw new Ai1wm_Not_Readable_Exception(
|
48 |
-
sprintf(
|
49 |
-
__( 'Unable to read from <strong>"%s"</strong>', AI1WM_PLUGIN_NAME ),
|
50 |
-
AI1WM_STATUS_FILE
|
51 |
-
)
|
52 |
-
);
|
53 |
-
}
|
54 |
-
|
55 |
-
// append the chunk we read from the file to our content
|
56 |
-
$content .= $chunk;
|
57 |
-
}
|
58 |
-
|
59 |
-
// do we have something to parse?
|
60 |
-
if ( empty( $content ) ) {
|
61 |
-
// file is empty, return empty array
|
62 |
-
return array();
|
63 |
-
}
|
64 |
-
|
65 |
-
// close status file handle
|
66 |
-
fclose( $handle );
|
67 |
-
|
68 |
-
// decode status
|
69 |
-
$data = @json_decode( $content, true );
|
70 |
-
|
71 |
-
if ( is_null( $data ) ) {
|
72 |
-
throw new Exception(
|
73 |
-
sprintf(
|
74 |
-
__( 'Unable to decode <strong>"%s"</strong> with json_decode', AI1WM_PLUGIN_NAME ),
|
75 |
-
$content
|
76 |
-
)
|
77 |
-
);
|
78 |
-
}
|
79 |
-
|
80 |
-
// are we asking for particular key?
|
81 |
-
if ( false === is_null( $key ) ) {
|
82 |
-
// is the key available in the data array?
|
83 |
-
if ( false === isset( $data[$key] ) ) {
|
84 |
-
// key is not available :/
|
85 |
-
return false;
|
86 |
-
}
|
87 |
-
|
88 |
-
// give the user the value they asked for
|
89 |
-
return $data[$key];
|
90 |
-
}
|
91 |
-
|
92 |
-
// return the full status array
|
93 |
-
return $data;
|
94 |
-
}
|
95 |
-
|
96 |
-
// no status file yet, return empty array
|
97 |
-
return array();
|
98 |
}
|
99 |
|
100 |
-
public static function
|
101 |
-
|
102 |
-
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
throw new Ai1wm_Not_Accesible_Exception(
|
108 |
-
sprintf(
|
109 |
-
__( 'Unable to open <strong>"%s"</strong> for writing.', AI1WM_PLUGIN_NAME ),
|
110 |
-
AI1WM_STATUS_FILE
|
111 |
-
)
|
112 |
-
);
|
113 |
-
}
|
114 |
|
115 |
-
|
116 |
-
|
|
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
__( 'Unable to encode <strong>"%s"</strong> with json_encode', AI1WM_PLUGIN_NAME ),
|
122 |
-
print_r( $status + $status_old, true )
|
123 |
-
)
|
124 |
-
);
|
125 |
-
}
|
126 |
|
127 |
-
|
128 |
-
|
|
|
129 |
|
130 |
-
|
131 |
-
if (
|
132 |
-
|
133 |
-
|
134 |
-
__( 'Unable to write <strong>"%s"</strong> in <strong>"%s"</strong>.', AI1WM_PLUGIN_NAME ),
|
135 |
-
$content,
|
136 |
-
AI1WM_STATUS_FILE
|
137 |
-
)
|
138 |
-
);
|
139 |
}
|
140 |
-
|
141 |
-
// close status file handle
|
142 |
-
fclose( $handle );
|
143 |
}
|
144 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
25 |
|
26 |
class Ai1wm_Status {
|
27 |
|
28 |
+
public static function error( $message, $title = null ) {
|
29 |
+
self::log( array( 'type' => 'error', 'message' => $message, 'title' => $title ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
+
public static function info( $message, $title = null ) {
|
33 |
+
self::log( array( 'type' => 'info', 'message' => $message, 'title' => $title ) );
|
34 |
+
}
|
35 |
|
36 |
+
public static function download( $message, $title = null ) {
|
37 |
+
self::log( array( 'type' => 'download', 'message' => $message, 'title' => $title ) );
|
38 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
+
public static function confirm( $message, $title = null ) {
|
41 |
+
self::log( array( 'type' => 'confirm', 'message' => $message, 'title' => $title ) );
|
42 |
+
}
|
43 |
|
44 |
+
public static function done( $message, $title = null ) {
|
45 |
+
self::log( array( 'type' => 'done', 'message' => $message, 'title' => $title ) );
|
46 |
+
}
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
public static function progress( $percent, $title = null ) {
|
49 |
+
self::log( array( 'type' => 'progress', 'percent' => $percent, 'title' => $title ) );
|
50 |
+
}
|
51 |
|
52 |
+
public static function log( $data = array() ) {
|
53 |
+
if ( $handle = fopen( ai1wm_status_path(), 'w' ) ) {
|
54 |
+
fwrite( $handle, json_encode( $data ) );
|
55 |
+
fclose( $handle );
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
|
|
|
|
|
|
57 |
}
|
58 |
}
|
lib/model/class-ai1wm-storage.php
DELETED
@@ -1,157 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
-
*
|
5 |
-
* This program is free software: you can redistribute it and/or modify
|
6 |
-
* it under the terms of the GNU General Public License as published by
|
7 |
-
* the Free Software Foundation, either version 3 of the License, or
|
8 |
-
* (at your option) any later version.
|
9 |
-
*
|
10 |
-
* This program is distributed in the hope that it will be useful,
|
11 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
-
* You should have received a copy of the GNU General Public License
|
16 |
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
-
*
|
18 |
-
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
-
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
-
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
-
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
-
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
-
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
-
*/
|
25 |
-
|
26 |
-
class Ai1wm_Storage {
|
27 |
-
|
28 |
-
protected $storage = null;
|
29 |
-
|
30 |
-
protected $archive = null;
|
31 |
-
|
32 |
-
public function __construct( array $args = array() ) {
|
33 |
-
// Set storage
|
34 |
-
if ( isset( $args['storage'] ) ) {
|
35 |
-
$this->storage = basename( $args['storage'] );
|
36 |
-
}
|
37 |
-
|
38 |
-
// Set archive
|
39 |
-
if ( isset( $args['archive'] ) ) {
|
40 |
-
$this->archive = basename( $args['archive'] );
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Get storage path
|
46 |
-
*
|
47 |
-
* @return string
|
48 |
-
*/
|
49 |
-
public function path() {
|
50 |
-
if ( ! isset( $this->storage ) ) {
|
51 |
-
throw new Ai1wm_Storage_Exception( 'Storage name is not configured.' );
|
52 |
-
}
|
53 |
-
|
54 |
-
// Make storage directory
|
55 |
-
$path = AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . $this->storage;
|
56 |
-
if ( ! is_dir( $path ) ) {
|
57 |
-
mkdir( $path );
|
58 |
-
}
|
59 |
-
|
60 |
-
return $path;
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Get archive path
|
65 |
-
*
|
66 |
-
* @return string
|
67 |
-
*/
|
68 |
-
public function archive() {
|
69 |
-
if ( ! isset( $this->archive ) ) {
|
70 |
-
throw new Ai1wm_Storage_Exception( 'Archive name is not configured.' );
|
71 |
-
}
|
72 |
-
|
73 |
-
// Use backup if needed for restore purposes
|
74 |
-
if ( file_exists( $this->backup() ) ) {
|
75 |
-
return $this->backup();
|
76 |
-
}
|
77 |
-
|
78 |
-
return $this->path() . DIRECTORY_SEPARATOR . $this->archive;
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Get backup path
|
83 |
-
*
|
84 |
-
* @return string
|
85 |
-
*/
|
86 |
-
public function backup() {
|
87 |
-
if ( ! isset( $this->archive ) ) {
|
88 |
-
throw new Ai1wm_Storage_Exception( 'Archive name is not configured.' );
|
89 |
-
}
|
90 |
-
|
91 |
-
return AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . $this->archive;
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Get package file path
|
96 |
-
*
|
97 |
-
* @return string
|
98 |
-
*/
|
99 |
-
public function package() {
|
100 |
-
return $this->path() . DIRECTORY_SEPARATOR . AI1WM_PACKAGE_NAME;
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Get file map path
|
105 |
-
*
|
106 |
-
* @return string
|
107 |
-
*/
|
108 |
-
public function filemap() {
|
109 |
-
return $this->path() . DIRECTORY_SEPARATOR . AI1WM_FILEMAP_NAME;
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Get database file path
|
114 |
-
*
|
115 |
-
* @return string
|
116 |
-
*/
|
117 |
-
public function database() {
|
118 |
-
return $this->path() . DIRECTORY_SEPARATOR . AI1WM_DATABASE_NAME;
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Get status file path
|
123 |
-
*
|
124 |
-
* @return string
|
125 |
-
*/
|
126 |
-
public function status() {
|
127 |
-
return $this->path() . DIRECTORY_SEPARATOR . AI1WM_STATUS_NAME;
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Clean storage path
|
132 |
-
*
|
133 |
-
* @return void
|
134 |
-
*/
|
135 |
-
public function clean() {
|
136 |
-
$iterator = new RecursiveIteratorIterator(
|
137 |
-
new RecursiveDirectoryIterator($this->path()),
|
138 |
-
RecursiveIteratorIterator::CHILD_FIRST
|
139 |
-
);
|
140 |
-
|
141 |
-
foreach ($iterator as $item) {
|
142 |
-
// Skip dots
|
143 |
-
if ($iterator->isDot()) {
|
144 |
-
continue;
|
145 |
-
}
|
146 |
-
|
147 |
-
if ($item->isFile()) {
|
148 |
-
unlink($item->getPathname());
|
149 |
-
} else {
|
150 |
-
rmdir($item->getPathname());
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
-
// Remove storage path
|
155 |
-
rmdir($this->path());
|
156 |
-
}
|
157 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/model/class-ai1wm-template.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
lib/model/class-ai1wm-updater.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
lib/model/export/class-ai1wm-export-archive.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Export_Archive {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Set progress
|
31 |
+
Ai1wm_Status::info( __( 'Creating an empty archive...', AI1WM_PLUGIN_NAME ) );
|
32 |
+
|
33 |
+
// Create empty archive file
|
34 |
+
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
|
35 |
+
$archive->close();
|
36 |
+
|
37 |
+
// Set progress
|
38 |
+
Ai1wm_Status::info( __( 'Done creating an empty archive.', AI1WM_PLUGIN_NAME ) );
|
39 |
+
|
40 |
+
return $params;
|
41 |
+
}
|
42 |
+
}
|
lib/{vendor/mysqldump-factory/mysqldump-factory/lib/MysqlDumpFactory.php → model/export/class-ai1wm-export-clean.php}
RENAMED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -24,27 +23,36 @@
|
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
46 |
}
|
47 |
|
48 |
-
|
|
|
|
|
|
|
49 |
}
|
50 |
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Export_Clean {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Remove export log file
|
31 |
+
unlink( ai1wm_export_path( $params ) );
|
32 |
+
|
33 |
+
// Get storage iterator
|
34 |
+
$iterator = new RecursiveIteratorIterator(
|
35 |
+
new RecursiveDirectoryIterator( ai1wm_storage_path( $params ) ),
|
36 |
+
RecursiveIteratorIterator::CHILD_FIRST
|
37 |
+
);
|
38 |
+
|
39 |
+
foreach ( $iterator as $item ) {
|
40 |
+
|
41 |
+
// Skip dots
|
42 |
+
if ( $iterator->isDot() ) {
|
43 |
+
continue;
|
44 |
}
|
45 |
|
46 |
+
if ( $item->isFile() ) {
|
47 |
+
unlink( $item->getPathname() );
|
48 |
+
} else {
|
49 |
+
rmdir( $item->getPathname() );
|
50 |
+
}
|
51 |
}
|
52 |
|
53 |
+
// Remove storage path
|
54 |
+
rmdir( ai1wm_storage_path( $params ) );
|
55 |
+
|
56 |
+
exit;
|
57 |
}
|
58 |
}
|
lib/model/{class-ai1wm-logger.php → export/class-ai1wm-export-config.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,47 +23,56 @@
|
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
-
class
|
27 |
|
28 |
-
|
29 |
-
* Log debug data
|
30 |
-
*
|
31 |
-
* @return boolean
|
32 |
-
*/
|
33 |
-
public static function debug( $key, array $data = array() ) {
|
34 |
global $wp_version;
|
35 |
|
36 |
-
//
|
37 |
-
|
38 |
-
$data['wp_version'] = $wp_version;
|
39 |
-
$data['php_version'] = phpversion();
|
40 |
-
$data['php_uname'] = php_uname();
|
41 |
-
$data['max_execution_time'] = ini_get( 'max_execution_time' );
|
42 |
-
$data['memory_limit'] = ini_get( 'memory_limit' );
|
43 |
-
$data['memory_get_peak_usage'] = memory_get_peak_usage();
|
44 |
-
$data['memory_get_usage'] = memory_get_usage();
|
45 |
-
$data['PDO_available'] = class_exists( 'PDO' ) ? 1 : 0;
|
46 |
-
$data['site_url'] = site_url();
|
47 |
-
$data['home_url'] = home_url();
|
48 |
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
-
|
62 |
-
* Log info data
|
63 |
-
*
|
64 |
-
* @return boolean
|
65 |
-
*/
|
66 |
-
public static function info( $key, array $data = array() ) {
|
67 |
-
return update_site_option( $key, $data );
|
68 |
}
|
69 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Export_Config {
|
27 |
|
28 |
+
public static function execute( $params ) {
|
|
|
|
|
|
|
|
|
|
|
29 |
global $wp_version;
|
30 |
|
31 |
+
// Set progress
|
32 |
+
Ai1wm_Status::info( __( 'Adding configuration to archive...', AI1WM_PLUGIN_NAME ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
+
// Clear WP options cache
|
35 |
+
wp_cache_flush();
|
36 |
|
37 |
+
// Get options
|
38 |
+
$options = wp_load_alloptions();
|
39 |
+
|
40 |
+
// Set config
|
41 |
+
$config = new Ai1wm_Config;
|
42 |
+
|
43 |
+
// Set Site URL
|
44 |
+
if ( isset( $options['siteurl'] ) ) {
|
45 |
+
$config->SiteURL = untrailingslashit( $options['siteurl'] );
|
46 |
+
} else {
|
47 |
+
$config->SiteURL = site_url();
|
48 |
+
}
|
49 |
+
|
50 |
+
// Set Home URL
|
51 |
+
if ( isset( $options['home'] ) ) {
|
52 |
+
$config->HomeURL = untrailingslashit( $options['home'] );
|
53 |
+
} else {
|
54 |
+
$config->HomeURL = home_url();
|
55 |
+
}
|
56 |
+
|
57 |
+
// Set Plugin Version
|
58 |
+
$config->Plugin = (object) array( 'Version' => AI1WM_VERSION );
|
59 |
+
|
60 |
+
// Set WordPress Version and Content
|
61 |
+
$config->WordPress = (object) array( 'Version' => $wp_version, 'Content' => WP_CONTENT_DIR );
|
62 |
+
|
63 |
+
// Save package.json file
|
64 |
+
$handle = fopen( ai1wm_package_path( $params ), 'w' );
|
65 |
+
fwrite( $handle, json_encode( $config ) );
|
66 |
+
fclose( $handle );
|
67 |
+
|
68 |
+
// Add package.json file
|
69 |
+
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
|
70 |
+
$archive->add_file( ai1wm_package_path( $params ), AI1WM_PACKAGE_NAME );
|
71 |
+
$archive->close();
|
72 |
+
|
73 |
+
// Set progress
|
74 |
+
Ai1wm_Status::info( __( 'Done adding configuration to archive.', AI1WM_PLUGIN_NAME ) );
|
75 |
|
76 |
+
return $params;
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
}
|
lib/model/export/class-ai1wm-export-content.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Export_Content {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Set content offset
|
31 |
+
if ( isset( $params['content_offset'] ) ) {
|
32 |
+
$content_offset = $params['content_offset'];
|
33 |
+
} else {
|
34 |
+
$content_offset = 0;
|
35 |
+
}
|
36 |
+
// Set filemap offset
|
37 |
+
if ( isset( $params['filemap_offset'] ) ) {
|
38 |
+
$filemap_offset = $params['filemap_offset'];
|
39 |
+
} else {
|
40 |
+
$filemap_offset = 0;
|
41 |
+
}
|
42 |
+
|
43 |
+
// Get total files
|
44 |
+
if ( isset( $params['total'] ) ) {
|
45 |
+
$total = (int) $params['total'];
|
46 |
+
} else {
|
47 |
+
$total = 1;
|
48 |
+
}
|
49 |
+
|
50 |
+
// Get processed files
|
51 |
+
if ( isset( $params['processed'] ) ) {
|
52 |
+
$processed = (int) $params['processed'];
|
53 |
+
} else {
|
54 |
+
$processed = 0;
|
55 |
+
}
|
56 |
+
|
57 |
+
// What percent of files have we processed?
|
58 |
+
$progress = (int) ( ( $processed / $total ) * 100 );
|
59 |
+
|
60 |
+
// Set progress
|
61 |
+
if ( empty( $content_offset ) ) {
|
62 |
+
Ai1wm_Status::info( sprintf( __( 'Archiving %d files...<br />%.2f%% complete', AI1WM_PLUGIN_NAME ), $total, $progress ) );
|
63 |
+
}
|
64 |
+
|
65 |
+
// Get map file
|
66 |
+
$filemap = fopen( ai1wm_filemap_path( $params ), 'r' );
|
67 |
+
|
68 |
+
// Start time
|
69 |
+
$start = microtime( true );
|
70 |
+
|
71 |
+
// Flag to hold if all files have been processed
|
72 |
+
$completed = true;
|
73 |
+
|
74 |
+
// Set filemap pointer at the current index
|
75 |
+
if ( fseek( $filemap, $filemap_offset ) !== -1 ) {
|
76 |
+
|
77 |
+
// Get archive
|
78 |
+
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
|
79 |
+
|
80 |
+
while ( $path = trim( fgets( $filemap ) ) ) {
|
81 |
+
try {
|
82 |
+
|
83 |
+
// Add file to archive
|
84 |
+
if ( ( $content_offset = $archive->add_file( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path, $path, $content_offset, 3 ) ) ) {
|
85 |
+
|
86 |
+
// Set progress
|
87 |
+
if ( ( $sub_progress = ( $content_offset / $archive->get_current_filesize() ) ) < 1 ) {
|
88 |
+
$progress += $sub_progress;
|
89 |
+
}
|
90 |
+
|
91 |
+
// Set progress
|
92 |
+
Ai1wm_Status::info( sprintf( __( 'Archiving %d files...<br />%.2f%% complete', AI1WM_PLUGIN_NAME ), $total, $progress ) );
|
93 |
+
|
94 |
+
// Set content offset
|
95 |
+
$params['content_offset'] = $content_offset;
|
96 |
+
|
97 |
+
// Set filemap offset
|
98 |
+
$params['filemap_offset'] = $filemap_offset;
|
99 |
+
|
100 |
+
// Set completed flag
|
101 |
+
$params['completed'] = false;
|
102 |
+
|
103 |
+
// Close the filemap file
|
104 |
+
fclose( $filemap );
|
105 |
+
|
106 |
+
return $params;
|
107 |
+
}
|
108 |
+
|
109 |
+
// Set content offset
|
110 |
+
$content_offset = 0;
|
111 |
+
|
112 |
+
// Set filemap offset
|
113 |
+
$filemap_offset = ftell( $filemap );
|
114 |
+
|
115 |
+
} catch ( Exception $e ) {
|
116 |
+
// Skip bad file permissions
|
117 |
+
}
|
118 |
+
|
119 |
+
// Increment processed files counter
|
120 |
+
$processed++;
|
121 |
+
|
122 |
+
// More than 3 seconds have passed, break and do another request
|
123 |
+
if ( ( microtime( true ) - $start ) > 3 ) {
|
124 |
+
$completed = false;
|
125 |
+
break;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
$archive->close();
|
130 |
+
}
|
131 |
+
|
132 |
+
// Set content offset
|
133 |
+
$params['content_offset'] = $content_offset;
|
134 |
+
|
135 |
+
// Set filemap offset
|
136 |
+
$params['filemap_offset'] = $filemap_offset;
|
137 |
+
|
138 |
+
// Set processed files
|
139 |
+
$params['processed'] = $processed;
|
140 |
+
|
141 |
+
// Set completed flag
|
142 |
+
$params['completed'] = $completed;
|
143 |
+
|
144 |
+
// Close the filemap file
|
145 |
+
fclose( $filemap );
|
146 |
+
|
147 |
+
return $params;
|
148 |
+
}
|
149 |
+
}
|
lib/model/export/class-ai1wm-export-database.php
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Export_Database {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
global $wpdb;
|
30 |
+
|
31 |
+
// Set exclude database
|
32 |
+
if ( isset( $params['options']['no-database'] ) ) {
|
33 |
+
return $params;
|
34 |
+
}
|
35 |
+
|
36 |
+
// Set progress
|
37 |
+
Ai1wm_Status::info( __( 'Exporting database...', AI1WM_PLUGIN_NAME ) );
|
38 |
+
|
39 |
+
// Get database client
|
40 |
+
if ( empty( $wpdb->use_mysqli ) ) {
|
41 |
+
$client = new Ai1wm_Database_Mysql( $wpdb );
|
42 |
+
} else {
|
43 |
+
$client = new Ai1wm_Database_Mysqli( $wpdb );
|
44 |
+
}
|
45 |
+
|
46 |
+
// Spam comments
|
47 |
+
if ( isset( $params['options']['no-spam-comments'] ) ) {
|
48 |
+
$client->set_table_query_clauses( ai1wm_table_prefix() . 'comments', " WHERE comment_approved != 'spam' " );
|
49 |
+
$client->set_table_query_clauses( ai1wm_table_prefix() . 'commentmeta', sprintf(
|
50 |
+
" WHERE comment_id IN ( SELECT comment_ID FROM `%s` WHERE comment_approved != 'spam' ) ",
|
51 |
+
ai1wm_table_prefix() . 'comments'
|
52 |
+
) );
|
53 |
+
}
|
54 |
+
|
55 |
+
// Post revisions
|
56 |
+
if ( isset( $params['options']['no-revisions'] ) ) {
|
57 |
+
$client->set_table_query_clauses( ai1wm_table_prefix() . 'posts', " WHERE post_type != 'revision' " );
|
58 |
+
}
|
59 |
+
|
60 |
+
$old_table_values = array();
|
61 |
+
$new_table_values = array();
|
62 |
+
|
63 |
+
// Find and replace
|
64 |
+
if ( isset( $params['options']['replace'] ) && ( $replace = $params['options']['replace'] ) ) {
|
65 |
+
for ( $i = 0; $i < count( $replace['old-value'] ); $i++ ) {
|
66 |
+
if ( ! empty( $replace['old-value'][$i] ) && ! empty( $replace['new-value'][$i] ) ) {
|
67 |
+
$old_table_values[] = $replace['old-value'][$i];
|
68 |
+
$new_table_values[] = $replace['new-value'][$i];
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
$old_table_prefixes = array();
|
74 |
+
$new_table_prefixes = array();
|
75 |
+
|
76 |
+
// Set table prefixes
|
77 |
+
if ( ai1wm_table_prefix() ) {
|
78 |
+
$old_table_prefixes[] = ai1wm_table_prefix();
|
79 |
+
$new_table_prefixes[] = ai1wm_servmask_prefix();
|
80 |
+
} else {
|
81 |
+
foreach ( $client->get_tables() as $table_name ) {
|
82 |
+
$old_table_prefixes[] = $table_name;
|
83 |
+
$new_table_prefixes[] = ai1wm_servmask_prefix() . $table_name;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
$include_table_prefixes = array();
|
88 |
+
|
89 |
+
// Include table prefixes
|
90 |
+
if ( ai1wm_table_prefix() ) {
|
91 |
+
$include_table_prefixes[] = ai1wm_table_prefix();
|
92 |
+
} else {
|
93 |
+
foreach ( $client->get_tables() as $table_name ) {
|
94 |
+
$include_table_prefixes[] = $table_name;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
// Set database options
|
99 |
+
$client->set_old_table_prefixes( $old_table_prefixes )
|
100 |
+
->set_new_table_prefixes( $new_table_prefixes )
|
101 |
+
->set_old_replace_values( $old_table_values )
|
102 |
+
->set_new_replace_values( $new_table_values )
|
103 |
+
->set_include_table_prefixes( $include_table_prefixes )
|
104 |
+
->set_table_prefix_columns( ai1wm_table_prefix() . 'options', array( 'option_name' ) )
|
105 |
+
->set_table_prefix_columns( ai1wm_table_prefix() . 'usermeta', array( 'meta_key' ) );
|
106 |
+
|
107 |
+
// Export database
|
108 |
+
$client->export( ai1wm_database_path( $params ) );
|
109 |
+
|
110 |
+
// Get archive file
|
111 |
+
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
|
112 |
+
|
113 |
+
// Add database to archive
|
114 |
+
$archive->add_file( ai1wm_database_path( $params ), AI1WM_DATABASE_NAME );
|
115 |
+
$archive->close();
|
116 |
+
|
117 |
+
// Set progress
|
118 |
+
Ai1wm_Status::info( __( 'Done exporting database.', AI1WM_PLUGIN_NAME ) );
|
119 |
+
|
120 |
+
return $params;
|
121 |
+
}
|
122 |
+
}
|
lib/model/{class-ai1wm-export-file.php → export/class-ai1wm-export-download.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,40 +23,37 @@
|
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
-
class
|
|
|
|
|
27 |
|
28 |
-
public function export() {
|
29 |
// Set progress
|
30 |
-
Ai1wm_Status::
|
31 |
-
'type' => 'info',
|
32 |
-
'message' => __( 'Renaming exported file...', AI1WM_PLUGIN_NAME )
|
33 |
-
) );
|
34 |
|
35 |
// Close achive file
|
36 |
-
$archive = new Ai1wm_Compressor( $
|
37 |
|
38 |
// Append EOF block
|
39 |
$archive->close( true );
|
40 |
|
41 |
// Rename archive file
|
42 |
-
if ( rename( $
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
// Set progress
|
44 |
-
Ai1wm_Status::
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
'<em>Size: %s</em>' .
|
51 |
-
'</a>',
|
52 |
-
AI1WM_PLUGIN_NAME
|
53 |
-
),
|
54 |
-
AI1WM_BACKUPS_URL,
|
55 |
-
basename( $this->storage()->backup() ),
|
56 |
-
parse_url( home_url(), PHP_URL_HOST ),
|
57 |
-
size_format( filesize( $this->storage()->backup() ) )
|
58 |
-
)
|
59 |
) );
|
60 |
}
|
|
|
|
|
61 |
}
|
62 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Export_Download {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
|
|
|
30 |
// Set progress
|
31 |
+
Ai1wm_Status::info( __( 'Renaming exported file...', AI1WM_PLUGIN_NAME ) );
|
|
|
|
|
|
|
32 |
|
33 |
// Close achive file
|
34 |
+
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
|
35 |
|
36 |
// Append EOF block
|
37 |
$archive->close( true );
|
38 |
|
39 |
// Rename archive file
|
40 |
+
if ( rename( ai1wm_archive_path( $params ), ai1wm_download_path( $params ) ) ) {
|
41 |
+
|
42 |
+
// Set archive details
|
43 |
+
$link = ai1wm_backups_url( $params );
|
44 |
+
$size = ai1wm_download_size( $params );
|
45 |
+
$name = ai1wm_site_name();
|
46 |
+
|
47 |
// Set progress
|
48 |
+
Ai1wm_Status::download( __(
|
49 |
+
"<a href=\"{$link}\" class=\"ai1wm-button-green ai1wm-emphasize\">" .
|
50 |
+
"<span>Download {$name}</span>" .
|
51 |
+
"<em>Size: {$size}</em>" .
|
52 |
+
"</a>",
|
53 |
+
AI1WM_PLUGIN_NAME
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
) );
|
55 |
}
|
56 |
+
|
57 |
+
return $params;
|
58 |
}
|
59 |
}
|
lib/model/{class-ai1wm-message.php → export/class-ai1wm-export-enumerate.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,73 +23,72 @@
|
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
-
class
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
'SiteURLDepricated' => __(
|
33 |
-
'Since version 1.8.0, Site URL is deprecated.' .
|
34 |
-
'Upon import, the plugin auto-detects Site URL and makes necessary changes to the database.',
|
35 |
-
AI1WM_PLUGIN_NAME
|
36 |
-
),
|
37 |
-
);
|
38 |
|
39 |
-
//
|
40 |
-
$
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
//
|
49 |
-
if ( $
|
50 |
-
|
51 |
}
|
52 |
-
}
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
public function get_messages() {
|
60 |
-
$msgs = array();
|
61 |
-
$keys = get_site_option( AI1WM_MESSAGES );
|
62 |
-
foreach ( $keys as $key => $active ) {
|
63 |
-
if ( isset( $this->messages[ $key ] ) && $active ) {
|
64 |
-
$msgs[ $key ] = $this->messages[ $key ];
|
65 |
-
}
|
66 |
}
|
67 |
|
68 |
-
|
69 |
-
|
|
|
|
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
// Deactivate message from the list
|
83 |
-
$keys[ $key ] = false;
|
84 |
|
85 |
-
//
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
-
}
|
90 |
-
|
91 |
}
|
92 |
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Export_Enumerate {
|
27 |
|
28 |
+
public static function execute( $params ) {
|
29 |
|
30 |
+
// Set progress
|
31 |
+
Ai1wm_Status::info( __( 'Retrieving a list of all WordPress files...', AI1WM_PLUGIN_NAME ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
// Total files
|
34 |
+
$total = 0;
|
35 |
+
|
36 |
+
// Create map file
|
37 |
+
$filemap = fopen( ai1wm_filemap_path( $params ) , 'a+' );
|
38 |
+
|
39 |
+
// Set exclude filters
|
40 |
+
$exclude_filters = ai1wm_content_filters();
|
41 |
|
42 |
+
// Exclude themes
|
43 |
+
if ( isset( $params['options']['no-themes'] ) ) {
|
44 |
+
$exclude_filters[] = 'themes';
|
45 |
}
|
|
|
46 |
|
47 |
+
// Exclude plugins
|
48 |
+
if ( isset( $params['options']['no-plugins'] ) ) {
|
49 |
+
$exclude_filters = array_merge( $exclude_filters, array( 'plugins', 'mu-plugins' ) );
|
50 |
+
} else {
|
51 |
+
$exclude_filters = array_merge( $exclude_filters, ai1wm_plugin_filters() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
+
// Exclude media
|
55 |
+
if ( isset( $params['options']['no-media'] ) ) {
|
56 |
+
$exclude_filters[] = 'uploads';
|
57 |
+
}
|
58 |
|
59 |
+
try {
|
60 |
+
// Iterate over content directory
|
61 |
+
$iterator = new RecursiveIteratorIterator(
|
62 |
+
new Ai1wm_Recursive_Exclude_Filter(
|
63 |
+
new Ai1wm_Recursive_Directory_Iterator(
|
64 |
+
WP_CONTENT_DIR
|
65 |
+
),
|
66 |
+
$exclude_filters
|
67 |
+
),
|
68 |
+
RecursiveIteratorIterator::SELF_FIRST
|
69 |
+
);
|
|
|
|
|
70 |
|
71 |
+
// Write path line
|
72 |
+
foreach ( $iterator as $item ) {
|
73 |
+
if ( $item->isFile() ) {
|
74 |
+
if ( fwrite( $filemap, $iterator->getSubPathName() . PHP_EOL ) ) {
|
75 |
+
$total++;
|
76 |
+
}
|
77 |
+
}
|
78 |
}
|
79 |
+
} catch ( Exception $e ) {
|
80 |
+
// Skip bad file permissions
|
81 |
}
|
82 |
|
83 |
+
// Close handle
|
84 |
+
fclose( $filemap );
|
85 |
+
|
86 |
+
// Set total files
|
87 |
+
$params['total'] = $total;
|
88 |
+
|
89 |
+
// Set progress
|
90 |
+
Ai1wm_Status::info( __( 'Done retrieving a list of all WordPress files.', AI1WM_PLUGIN_NAME ) );
|
91 |
+
|
92 |
+
return $params;
|
93 |
}
|
94 |
}
|
lib/model/export/class-ai1wm-export-resolve.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Export_Resolve {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Set progress
|
31 |
+
Ai1wm_Status::info( __( 'Resolving URL address...', AI1WM_PLUGIN_NAME ) );
|
32 |
+
|
33 |
+
// HTTP resolve
|
34 |
+
Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
|
35 |
+
|
36 |
+
// Set archive
|
37 |
+
if ( empty( $params['archive'] ) ) {
|
38 |
+
$params['archive'] = ai1wm_archive_file();
|
39 |
+
}
|
40 |
+
|
41 |
+
// Set storage
|
42 |
+
if ( empty( $params['storage'] ) ) {
|
43 |
+
$params['storage'] = ai1wm_storage_folder();
|
44 |
+
}
|
45 |
+
|
46 |
+
// Set progress
|
47 |
+
Ai1wm_Status::info( __( 'Done resolving URL address...', AI1WM_PLUGIN_NAME ) );
|
48 |
+
|
49 |
+
return $params;
|
50 |
+
}
|
51 |
+
}
|
lib/model/import/class-ai1wm-import-blogs.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Import_Blogs {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Set progress
|
31 |
+
Ai1wm_Status::info( __( 'Preparing blogs...', AI1WM_PLUGIN_NAME ) );
|
32 |
+
|
33 |
+
$blogs = array();
|
34 |
+
|
35 |
+
// Check multisite.json file
|
36 |
+
if ( true === is_file( ai1wm_multisite_path( $params ) ) ) {
|
37 |
+
|
38 |
+
// Read multisite.json file
|
39 |
+
$handle = fopen( ai1wm_multisite_path( $params ), 'r' );
|
40 |
+
if ( $handle === false ) {
|
41 |
+
throw new Ai1wm_Import_Exception( __( 'Unable to read multisite.json file', AI1WM_PLUGIN_NAME ) );
|
42 |
+
}
|
43 |
+
|
44 |
+
// Parse multisite.json file
|
45 |
+
$multisite = fread( $handle, filesize( ai1wm_multisite_path( $params ) ) );
|
46 |
+
$multisite = json_decode( $multisite );
|
47 |
+
|
48 |
+
// Close handle
|
49 |
+
fclose( $handle );
|
50 |
+
|
51 |
+
// Validate
|
52 |
+
if ( empty( $multisite->Network ) ) {
|
53 |
+
if ( isset( $multisite->Sites ) && ( $sites = $multisite->Sites ) ) {
|
54 |
+
if ( count( $sites ) === 1 && ( $site = current( $sites ) ) ) {
|
55 |
+
$blogs[] = array(
|
56 |
+
'Old' => array(
|
57 |
+
'Id' => (int) $site->BlogID,
|
58 |
+
'SiteURL' => $site->SiteURL,
|
59 |
+
'HomeURL' => $site->HomeURL,
|
60 |
+
),
|
61 |
+
'New' => array(
|
62 |
+
'Id' => 0,
|
63 |
+
'SiteURL' => site_url(),
|
64 |
+
'HomeURL' => home_url(),
|
65 |
+
),
|
66 |
+
);
|
67 |
+
} else {
|
68 |
+
throw new Ai1wm_Import_Exception(
|
69 |
+
__( 'The archive should contain <strong>Single WordPress</strong> site! Please revisit your export settings.', AI1WM_PLUGIN_NAME )
|
70 |
+
);
|
71 |
+
}
|
72 |
+
} else {
|
73 |
+
throw new Ai1wm_Import_Exception(
|
74 |
+
__( 'At least <strong>one WordPress</strong> site should be presented in the archive.', AI1WM_PLUGIN_NAME )
|
75 |
+
);
|
76 |
+
}
|
77 |
+
} else {
|
78 |
+
throw new Ai1wm_Import_Exception(
|
79 |
+
__( 'Unable to import <strong>WordPress Network</strong> into WordPress <strong>Single</strong> site.', AI1WM_PLUGIN_NAME )
|
80 |
+
);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
// Save blogs.json file
|
85 |
+
$handle = fopen( ai1wm_blogs_path( $params ), 'w' );
|
86 |
+
fwrite( $handle, json_encode( $blogs ) );
|
87 |
+
fclose( $handle );
|
88 |
+
|
89 |
+
// Set progress
|
90 |
+
Ai1wm_Status::info( __( 'Done preparing blogs...', AI1WM_PLUGIN_NAME ) );
|
91 |
+
|
92 |
+
return $params;
|
93 |
+
}
|
94 |
+
}
|
lib/model/import/class-ai1wm-import-clean.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Import_Clean {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Remove import log file
|
31 |
+
unlink( ai1wm_import_path( $params ) );
|
32 |
+
|
33 |
+
// Get storage iterator
|
34 |
+
$iterator = new RecursiveIteratorIterator(
|
35 |
+
new RecursiveDirectoryIterator( ai1wm_storage_path( $params ) ),
|
36 |
+
RecursiveIteratorIterator::CHILD_FIRST
|
37 |
+
);
|
38 |
+
|
39 |
+
foreach ( $iterator as $item ) {
|
40 |
+
|
41 |
+
// Skip dots
|
42 |
+
if ( $iterator->isDot() ) {
|
43 |
+
continue;
|
44 |
+
}
|
45 |
+
|
46 |
+
if ( $item->isFile() ) {
|
47 |
+
unlink( $item->getPathname() );
|
48 |
+
} else {
|
49 |
+
rmdir( $item->getPathname() );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
// Remove storage path
|
54 |
+
rmdir( ai1wm_storage_path( $params ) );
|
55 |
+
|
56 |
+
exit;
|
57 |
+
}
|
58 |
+
}
|
lib/model/import/class-ai1wm-import-confirm.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Import_Confirm {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Obtain the name of the archive
|
31 |
+
$name = ai1wm_archive_name( $params );
|
32 |
+
|
33 |
+
// Obtain the size of the archive
|
34 |
+
$size = ai1wm_archive_bytes( $params );
|
35 |
+
|
36 |
+
// Check file size of the archive
|
37 |
+
if ( false === $size ) {
|
38 |
+
throw new Ai1wm_Not_Accesible_Exception(
|
39 |
+
__( "Unable to get the file size of <strong>{$name}</strong>", AI1WM_PLUGIN_NAME )
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
$allowed_size = apply_filters( 'ai1wm_max_file_size', AI1WM_MAX_FILE_SIZE );
|
44 |
+
|
45 |
+
// Let's check the size of the file to make sure it is less than the maximum allowed
|
46 |
+
if ( ( $allowed_size > 0 ) && ( $size > $allowed_size ) ) {
|
47 |
+
throw new Ai1wm_Import_Exception(
|
48 |
+
__(
|
49 |
+
"The file that you are trying to import is over the maximum upload file size limit of {$allowed_size}.<br />" .
|
50 |
+
"You can remove this restriction by purchasing our " .
|
51 |
+
"<a href=\"https://servmask.com/products/unlimited-extension\" target=\"_blank\">Unlimited Extension</a>.",
|
52 |
+
AI1WM_PLUGIN_NAME
|
53 |
+
)
|
54 |
+
);
|
55 |
+
}
|
56 |
+
|
57 |
+
// Set progress
|
58 |
+
Ai1wm_Status::confirm( __(
|
59 |
+
'The import process will overwrite your database, media, plugins, and themes. ' .
|
60 |
+
'Please ensure that you have a backup of your data before proceeding to the next step.',
|
61 |
+
AI1WM_PLUGIN_NAME
|
62 |
+
) );
|
63 |
+
|
64 |
+
exit;
|
65 |
+
}
|
66 |
+
}
|
lib/model/import/class-ai1wm-import-content.php
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Import_Content {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Read blogs.json file
|
31 |
+
$handle = fopen( ai1wm_blogs_path( $params ), 'r' );
|
32 |
+
if ( $handle === false ) {
|
33 |
+
throw new Ai1wm_Import_Exception( 'Unable to read blogs.json file' );
|
34 |
+
}
|
35 |
+
|
36 |
+
// Parse blogs.json file
|
37 |
+
$blogs = fread( $handle, filesize( ai1wm_blogs_path( $params ) ) );
|
38 |
+
$blogs = json_decode( $blogs );
|
39 |
+
|
40 |
+
// Close handle
|
41 |
+
fclose( $handle );
|
42 |
+
|
43 |
+
// Set content offset
|
44 |
+
if ( isset( $params['content_offset'] ) ) {
|
45 |
+
$content_offset = $params['content_offset'];
|
46 |
+
} else {
|
47 |
+
$content_offset = 0;
|
48 |
+
}
|
49 |
+
|
50 |
+
// Set archive offset
|
51 |
+
if ( isset( $params['archive_offset']) ) {
|
52 |
+
$archive_offset = $params['archive_offset'];
|
53 |
+
} else {
|
54 |
+
$archive_offset = 0;
|
55 |
+
}
|
56 |
+
|
57 |
+
// Get total files
|
58 |
+
if ( isset( $params['total'] ) ) {
|
59 |
+
$total = (int) $params['total'];
|
60 |
+
} else {
|
61 |
+
$total = 1;
|
62 |
+
}
|
63 |
+
|
64 |
+
// Get processed files
|
65 |
+
if ( isset( $params['processed'] ) ) {
|
66 |
+
$processed = (int) $params['processed'];
|
67 |
+
} else {
|
68 |
+
$processed = 0;
|
69 |
+
}
|
70 |
+
|
71 |
+
// What percent of files have we processed?
|
72 |
+
$progress = (int) ( ( $processed / $total ) * 100 );
|
73 |
+
|
74 |
+
// Set progress
|
75 |
+
if ( empty( $content_offset ) ) {
|
76 |
+
Ai1wm_Status::info( sprintf( __( 'Restoring %d files...<br />%.2f%% complete', AI1WM_PLUGIN_NAME ), $total, $progress ) );
|
77 |
+
}
|
78 |
+
|
79 |
+
// Start time
|
80 |
+
$start = microtime( true );
|
81 |
+
|
82 |
+
// Flag to hold if all files have been processed
|
83 |
+
$completed = true;
|
84 |
+
|
85 |
+
// Open the archive file for reading
|
86 |
+
$archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
|
87 |
+
|
88 |
+
// Set the file pointer to the one that we have saved
|
89 |
+
$archive->set_file_pointer( null, $archive_offset );
|
90 |
+
|
91 |
+
$old_paths = array();
|
92 |
+
$new_paths = array();
|
93 |
+
|
94 |
+
// Set extract paths
|
95 |
+
foreach ( $blogs as $blog ) {
|
96 |
+
$old_paths[] = ai1wm_sites_path( $blog->Old->Id );
|
97 |
+
$new_paths[] = ai1wm_sites_path( $blog->New->Id );
|
98 |
+
}
|
99 |
+
|
100 |
+
while ( $archive->has_not_reached_eof() ) {
|
101 |
+
try {
|
102 |
+
|
103 |
+
// Extract a file from archive to WP_CONTENT_DIR
|
104 |
+
if ( ( $content_offset = $archive->extract_one_file_to( WP_CONTENT_DIR, array( AI1WM_PACKAGE_NAME, AI1WM_MULTISITE_NAME, AI1WM_DATABASE_NAME ), $old_paths, $new_paths, $content_offset, 3 ) ) ) {
|
105 |
+
|
106 |
+
// Set progress
|
107 |
+
if ( ( $sub_progress = ( $content_offset / $archive->get_current_filesize() ) ) < 1 ) {
|
108 |
+
$progress += $sub_progress;
|
109 |
+
}
|
110 |
+
|
111 |
+
// Set progress
|
112 |
+
Ai1wm_Status::info( sprintf( __( 'Restoring %d files...<br />%.2f%% complete', AI1WM_PLUGIN_NAME ), $total, $progress ) );
|
113 |
+
|
114 |
+
// Set content offset
|
115 |
+
$params['content_offset'] = $content_offset;
|
116 |
+
|
117 |
+
// Set archive offset
|
118 |
+
$params['archive_offset'] = $archive_offset;
|
119 |
+
|
120 |
+
// Set completed flag
|
121 |
+
$params['completed'] = false;
|
122 |
+
|
123 |
+
// Close the archive file
|
124 |
+
$archive->close();
|
125 |
+
|
126 |
+
return $params;
|
127 |
+
}
|
128 |
+
|
129 |
+
// Set content offset
|
130 |
+
$content_offset = 0;
|
131 |
+
|
132 |
+
// Set archive offset
|
133 |
+
$archive_offset = $archive->get_file_pointer();
|
134 |
+
|
135 |
+
} catch ( Exception $e ) {
|
136 |
+
// Skip bad file permissions
|
137 |
+
}
|
138 |
+
|
139 |
+
// Increment processed files counter
|
140 |
+
$processed++;
|
141 |
+
|
142 |
+
// More than 3 seconds have passed, break and do another request
|
143 |
+
if ( ( microtime( true ) - $start ) > 3 ) {
|
144 |
+
$completed = false;
|
145 |
+
break;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
// Set content offset
|
150 |
+
$params['content_offset'] = $content_offset;
|
151 |
+
|
152 |
+
// Set archive offset
|
153 |
+
$params['archive_offset'] = $archive_offset;
|
154 |
+
|
155 |
+
// Set processed files
|
156 |
+
$params['processed'] = $processed;
|
157 |
+
|
158 |
+
// Set completed flag
|
159 |
+
$params['completed'] = $completed;
|
160 |
+
|
161 |
+
// Close the archive file
|
162 |
+
$archive->close();
|
163 |
+
|
164 |
+
return $params;
|
165 |
+
}
|
166 |
+
}
|
lib/model/import/class-ai1wm-import-database.php
ADDED
@@ -0,0 +1,396 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Import_Database {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
global $wpdb;
|
30 |
+
|
31 |
+
// Skip database import
|
32 |
+
if ( ! is_file( ai1wm_database_path( $params ) ) ) {
|
33 |
+
return $params;
|
34 |
+
}
|
35 |
+
|
36 |
+
// Read blogs.json file
|
37 |
+
$handle = fopen( ai1wm_blogs_path( $params ), 'r' );
|
38 |
+
if ( $handle === false ) {
|
39 |
+
throw new Ai1wm_Import_Exception( 'Unable to read blogs.json file' );
|
40 |
+
}
|
41 |
+
|
42 |
+
// Parse blogs.json file
|
43 |
+
$blogs = fread( $handle, filesize( ai1wm_blogs_path( $params ) ) );
|
44 |
+
$blogs = json_decode( $blogs );
|
45 |
+
|
46 |
+
// Close handle
|
47 |
+
fclose( $handle );
|
48 |
+
|
49 |
+
// Read package.json file
|
50 |
+
$handle = fopen( ai1wm_package_path( $params ), 'r' );
|
51 |
+
if ( $handle === false ) {
|
52 |
+
throw new Ai1wm_Import_Exception( 'Unable to read package.json file' );
|
53 |
+
}
|
54 |
+
|
55 |
+
// Parse package.json file
|
56 |
+
$config = fread( $handle, filesize( ai1wm_package_path( $params ) ) );
|
57 |
+
$config = json_decode( $config );
|
58 |
+
|
59 |
+
// Close handle
|
60 |
+
fclose( $handle );
|
61 |
+
|
62 |
+
// Set progress
|
63 |
+
Ai1wm_Status::info( __( 'Restoring database...', AI1WM_PLUGIN_NAME ) );
|
64 |
+
|
65 |
+
$old_values = array();
|
66 |
+
$new_values = array();
|
67 |
+
|
68 |
+
// Get Blog URLs
|
69 |
+
foreach ( $blogs as $blog ) {
|
70 |
+
|
71 |
+
// Get Upload Path
|
72 |
+
if ( ! in_array( ai1wm_uploads_path( $blog->Old->Id ), $old_values ) ) {
|
73 |
+
$old_values[] = ai1wm_uploads_path( $blog->Old->Id );
|
74 |
+
$new_values[] = ai1wm_uploads_path( $blog->New->Id );
|
75 |
+
}
|
76 |
+
|
77 |
+
// Get escaped Upload Path
|
78 |
+
if ( ! in_array( addslashes( addcslashes( ai1wm_uploads_path( $blog->Old->Id ), '\/' ) ), $old_values ) ) {
|
79 |
+
$old_values[] = addslashes( addcslashes( ai1wm_uploads_path( $blog->Old->Id ), '\/' ) );
|
80 |
+
$new_values[] = addslashes( addcslashes( ai1wm_uploads_path( $blog->New->Id ), '\/' ) );
|
81 |
+
}
|
82 |
+
|
83 |
+
// Get Site URL
|
84 |
+
if ( isset( $blog->Old->SiteURL ) && ( $blog->Old->SiteURL !== $blog->New->SiteURL ) ) {
|
85 |
+
|
86 |
+
// Get domain
|
87 |
+
$old_domain = parse_url( $blog->Old->SiteURL, PHP_URL_HOST );
|
88 |
+
$new_domain = parse_url( $blog->New->SiteURL, PHP_URL_HOST );
|
89 |
+
|
90 |
+
// Replace Site URL protocol
|
91 |
+
foreach ( array( 'http', 'https' ) as $protocol ) {
|
92 |
+
|
93 |
+
// Add plain Site URL
|
94 |
+
if ( ! in_array( set_url_scheme( $blog->Old->SiteURL, $protocol ), $old_values ) ) {
|
95 |
+
$old_values[] = set_url_scheme( $blog->Old->SiteURL, $protocol );
|
96 |
+
$new_values[] = set_url_scheme( $blog->New->SiteURL );
|
97 |
+
}
|
98 |
+
|
99 |
+
// Add encoded Site URL
|
100 |
+
if ( ! in_array( urlencode( set_url_scheme( $blog->Old->SiteURL, $protocol ) ), $old_values ) ) {
|
101 |
+
$old_values[] = urlencode( set_url_scheme( $blog->Old->SiteURL, $protocol ) );
|
102 |
+
$new_values[] = urlencode( set_url_scheme( $blog->New->SiteURL ) );
|
103 |
+
}
|
104 |
+
|
105 |
+
// Add escaped Site URL
|
106 |
+
if ( ! in_array( addslashes( addcslashes( set_url_scheme( $blog->Old->SiteURL, $protocol ), '/' ) ), $old_values ) ) {
|
107 |
+
$old_values[] = addslashes( addcslashes( set_url_scheme( $blog->Old->SiteURL, $protocol ), '/' ) );
|
108 |
+
$new_values[] = addslashes( addcslashes( set_url_scheme( $blog->New->SiteURL ), '/' ) );
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
// Add email
|
113 |
+
if ( ! in_array( sprintf( "@%s", $old_domain ), $old_values ) ) {
|
114 |
+
$old_values[] = sprintf( "@%s", $old_domain );
|
115 |
+
$new_values[] = sprintf( "@%s", $new_domain );
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
// Get Home URL
|
120 |
+
if ( isset( $blog->Old->HomeURL ) && ( $blog->Old->HomeURL !== $blog->New->HomeURL ) ) {
|
121 |
+
|
122 |
+
// Get domain
|
123 |
+
$old_domain = parse_url( $blog->Old->HomeURL, PHP_URL_HOST );
|
124 |
+
$new_domain = parse_url( $blog->New->HomeURL, PHP_URL_HOST );
|
125 |
+
|
126 |
+
// Replace Home URL protocol
|
127 |
+
foreach ( array( 'http', 'https' ) as $protocol ) {
|
128 |
+
|
129 |
+
// Add plain Home URL
|
130 |
+
if ( ! in_array( set_url_scheme( $blog->Old->HomeURL, $protocol ), $old_values ) ) {
|
131 |
+
$old_values[] = set_url_scheme( $blog->Old->HomeURL, $protocol );
|
132 |
+
$new_values[] = set_url_scheme( $blog->New->HomeURL );
|
133 |
+
}
|
134 |
+
|
135 |
+
// Add encoded Home URL
|
136 |
+
if ( ! in_array( urlencode( set_url_scheme( $blog->Old->HomeURL, $protocol ) ), $old_values ) ) {
|
137 |
+
$old_values[] = urlencode( set_url_scheme( $blog->Old->HomeURL, $protocol ) );
|
138 |
+
$new_values[] = urlencode( set_url_scheme( $blog->New->HomeURL ) );
|
139 |
+
}
|
140 |
+
|
141 |
+
// Add escaped Home URL
|
142 |
+
if ( ! in_array( addslashes( addcslashes( set_url_scheme( $blog->Old->HomeURL, $protocol ), '/' ) ), $old_values ) ) {
|
143 |
+
$old_values[] = addslashes( addcslashes( set_url_scheme( $blog->Old->HomeURL, $protocol ), '/' ) );
|
144 |
+
$new_values[] = addslashes( addcslashes( set_url_scheme( $blog->New->HomeURL ), '/' ) );
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
// Add email
|
149 |
+
if ( ! in_array( sprintf( "@%s", $old_domain ), $old_values ) ) {
|
150 |
+
$old_values[] = sprintf( "@%s", $old_domain );
|
151 |
+
$new_values[] = sprintf( "@%s", $new_domain );
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
// Get Site URL
|
157 |
+
if ( isset( $config->SiteURL ) && ( $config->SiteURL !== site_url() ) ) {
|
158 |
+
|
159 |
+
// Get www URL
|
160 |
+
if ( stripos( $config->SiteURL, '//www.' ) !== false ) {
|
161 |
+
$www = str_ireplace( '//www.', '//', $config->SiteURL );
|
162 |
+
} else {
|
163 |
+
$www = str_ireplace( '//', '//www.', $config->SiteURL );
|
164 |
+
}
|
165 |
+
|
166 |
+
// Replace Site URL
|
167 |
+
foreach ( array( $config->SiteURL, $www ) as $url ) {
|
168 |
+
|
169 |
+
// Get domain
|
170 |
+
$old_domain = parse_url( $url, PHP_URL_HOST );
|
171 |
+
$new_domain = parse_url( site_url(), PHP_URL_HOST );
|
172 |
+
|
173 |
+
// Get path
|
174 |
+
$old_path = parse_url( $url, PHP_URL_PATH );
|
175 |
+
$new_path = parse_url( site_url(), PHP_URL_PATH );
|
176 |
+
|
177 |
+
// Add domain and path
|
178 |
+
if ( ! in_array( sprintf( "%s','%s", $old_domain, trailingslashit( $old_path ) ), $old_values ) ) {
|
179 |
+
$old_values[] = sprintf( "%s','%s", $old_domain, trailingslashit( $old_path ) );
|
180 |
+
$new_values[] = sprintf( "%s','%s", $new_domain, trailingslashit( $new_path ) );
|
181 |
+
}
|
182 |
+
|
183 |
+
// Replace Site URL protocol
|
184 |
+
foreach ( array( 'http', 'https' ) as $protocol ) {
|
185 |
+
|
186 |
+
// Add plain Site URL
|
187 |
+
if ( ! in_array( set_url_scheme( $url, $protocol ), $old_values ) ) {
|
188 |
+
$old_values[] = set_url_scheme( $url, $protocol );
|
189 |
+
$new_values[] = set_url_scheme( site_url() );
|
190 |
+
}
|
191 |
+
|
192 |
+
// Add encoded Site URL
|
193 |
+
if ( ! in_array( urlencode( set_url_scheme( $url, $protocol ) ), $old_values ) ) {
|
194 |
+
$old_values[] = urlencode( set_url_scheme( $url, $protocol ) );
|
195 |
+
$new_values[] = urlencode( set_url_scheme( site_url() ) );
|
196 |
+
}
|
197 |
+
|
198 |
+
// Add escaped Site URL
|
199 |
+
if ( ! in_array( addslashes( addcslashes( set_url_scheme( $url, $protocol ), '/' ) ), $old_values ) ) {
|
200 |
+
$old_values[] = addslashes( addcslashes( set_url_scheme( $url, $protocol ), '/' ) );
|
201 |
+
$new_values[] = addslashes( addcslashes( set_url_scheme( site_url() ), '/' ) );
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
// Add email
|
206 |
+
if ( ! in_array( sprintf( "@%s", $old_domain ), $old_values ) ) {
|
207 |
+
$old_values[] = sprintf( "@%s", $old_domain );
|
208 |
+
$new_values[] = sprintf( "@%s", $new_domain );
|
209 |
+
}
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
// Get Home URL
|
214 |
+
if ( isset( $config->HomeURL ) && ( $config->HomeURL !== home_url() ) ) {
|
215 |
+
|
216 |
+
// Get www URL
|
217 |
+
if ( stripos( $config->HomeURL, '//www.' ) !== false ) {
|
218 |
+
$www = str_ireplace( '//www.', '//', $config->HomeURL );
|
219 |
+
} else {
|
220 |
+
$www = str_ireplace( '//', '//www.', $config->HomeURL );
|
221 |
+
}
|
222 |
+
|
223 |
+
// Replace Home URL
|
224 |
+
foreach ( array( $config->HomeURL, $www ) as $url ) {
|
225 |
+
|
226 |
+
// Get domain
|
227 |
+
$old_domain = parse_url( $url, PHP_URL_HOST );
|
228 |
+
$new_domain = parse_url( home_url(), PHP_URL_HOST );
|
229 |
+
|
230 |
+
// Get path
|
231 |
+
$old_path = parse_url( $url, PHP_URL_PATH );
|
232 |
+
$new_path = parse_url( home_url(), PHP_URL_PATH );
|
233 |
+
|
234 |
+
// Add domain and path
|
235 |
+
if ( ! in_array( sprintf( "%s','%s", $old_domain, trailingslashit( $old_path ) ), $old_values ) ) {
|
236 |
+
$old_values[] = sprintf( "%s','%s", $old_domain, trailingslashit( $old_path ) );
|
237 |
+
$new_values[] = sprintf( "%s','%s", $new_domain, trailingslashit( $new_path ) );
|
238 |
+
}
|
239 |
+
|
240 |
+
// Replace Home URL protocol
|
241 |
+
foreach ( array( 'http', 'https' ) as $protocol ) {
|
242 |
+
|
243 |
+
// Add plain Home URL
|
244 |
+
if ( ! in_array( set_url_scheme( $url, $protocol ), $old_values ) ) {
|
245 |
+
$old_values[] = set_url_scheme( $url, $protocol );
|
246 |
+
$new_values[] = set_url_scheme( home_url() );
|
247 |
+
}
|
248 |
+
|
249 |
+
// Add encoded Home URL
|
250 |
+
if ( ! in_array( urlencode( set_url_scheme( $url, $protocol ) ), $old_values ) ) {
|
251 |
+
$old_values[] = urlencode( set_url_scheme( $url, $protocol ) );
|
252 |
+
$new_values[] = urlencode( set_url_scheme( home_url() ) );
|
253 |
+
}
|
254 |
+
|
255 |
+
// Add escaped Home URL
|
256 |
+
if ( ! in_array( addslashes( addcslashes( set_url_scheme( $url, $protocol ), '/' ) ), $old_values ) ) {
|
257 |
+
$old_values[] = addslashes( addcslashes( set_url_scheme( $url, $protocol ), '/' ) );
|
258 |
+
$new_values[] = addslashes( addcslashes( set_url_scheme( home_url() ), '/' ) );
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
// Add email
|
263 |
+
if ( ! in_array( sprintf( "@%s", $old_domain ), $old_values ) ) {
|
264 |
+
$old_values[] = sprintf( "@%s", $old_domain );
|
265 |
+
$new_values[] = sprintf( "@%s", $new_domain );
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
// Get WordPress Content
|
271 |
+
if ( isset( $config->WordPress->Content ) && ( $config->WordPress->Content !== WP_CONTENT_DIR ) ) {
|
272 |
+
|
273 |
+
// Add plain WordPress Content
|
274 |
+
if ( ! in_array( $config->WordPress->Content, $old_values ) ) {
|
275 |
+
$old_values[] = $config->WordPress->Content;
|
276 |
+
$new_values[] = WP_CONTENT_DIR;
|
277 |
+
}
|
278 |
+
|
279 |
+
// Add encoded WordPress Content
|
280 |
+
if ( ! in_array( urlencode( $config->WordPress->Content ), $old_values ) ) {
|
281 |
+
$old_values[] = urlencode( $config->WordPress->Content );
|
282 |
+
$new_values[] = urlencode( WP_CONTENT_DIR );
|
283 |
+
}
|
284 |
+
|
285 |
+
// Add escaped WordPress Content
|
286 |
+
if ( ! in_array( addslashes( addcslashes( $config->WordPress->Content, '\/' ) ), $old_values ) ) {
|
287 |
+
$old_values[] = addslashes( addcslashes( $config->WordPress->Content, '\/' ) );
|
288 |
+
$new_values[] = addslashes( addcslashes( WP_CONTENT_DIR, '\/' ) );
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
// Get URL IP
|
293 |
+
$url_ip = get_site_option( AI1WM_URL_IP, false, false );
|
294 |
+
|
295 |
+
// Get URL transport
|
296 |
+
$url_transport = get_site_option( AI1WM_URL_TRANSPORT, false, false );
|
297 |
+
|
298 |
+
// Get secret key
|
299 |
+
$secret_key = get_site_option( AI1WM_SECRET_KEY, false, false );
|
300 |
+
|
301 |
+
// Get HTTP user
|
302 |
+
$auth_user = get_site_option( AI1WM_AUTH_USER, false, false );
|
303 |
+
|
304 |
+
// Get HTTP password
|
305 |
+
$auth_password = get_site_option( AI1WM_AUTH_PASSWORD, false, false );
|
306 |
+
|
307 |
+
// Get active plugins
|
308 |
+
$active_plugins = get_site_option( AI1WM_ACTIVE_PLUGINS, array(), false );
|
309 |
+
|
310 |
+
$old_prefixes = array();
|
311 |
+
$new_prefixes = array();
|
312 |
+
|
313 |
+
// Set main table prefixes
|
314 |
+
$old_prefixes[] = ai1wm_servmask_prefix( 'mainsite' );
|
315 |
+
$new_prefixes[] = ai1wm_table_prefix();
|
316 |
+
|
317 |
+
// Set site table prefixes
|
318 |
+
foreach ( $blogs as $blog ) {
|
319 |
+
if ( ai1wm_main_site( $blog->Old->Id ) === false ) {
|
320 |
+
$old_prefixes[] = ai1wm_servmask_prefix( $blog->Old->Id );
|
321 |
+
$new_prefixes[] = ai1wm_table_prefix( $blog->New->Id );
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
// Set base table prefixes
|
326 |
+
foreach ( $blogs as $blog ) {
|
327 |
+
if ( ai1wm_main_site( $blog->Old->Id ) === true ) {
|
328 |
+
$old_prefixes[] = ai1wm_servmask_prefix( 'basesite' );
|
329 |
+
$new_prefixes[] = ai1wm_table_prefix( $blog->New->Id );
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
+
// Set site table prefixes
|
334 |
+
foreach ( $blogs as $blog ) {
|
335 |
+
if ( ai1wm_main_site( $blog->Old->Id ) === true ) {
|
336 |
+
$old_prefixes[] = ai1wm_servmask_prefix( $blog->Old->Id );
|
337 |
+
$new_prefixes[] = ai1wm_table_prefix( $blog->New->Id );
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
// Set table prefixes
|
342 |
+
$old_prefixes[] = ai1wm_servmask_prefix();
|
343 |
+
$new_prefixes[] = ai1wm_table_prefix();
|
344 |
+
|
345 |
+
// Get database client
|
346 |
+
if ( empty( $wpdb->use_mysqli ) ) {
|
347 |
+
$client = new Ai1wm_Database_Mysql( $wpdb );
|
348 |
+
} else {
|
349 |
+
$client = new Ai1wm_Database_Mysqli( $wpdb );
|
350 |
+
}
|
351 |
+
|
352 |
+
// Set database options
|
353 |
+
$client->set_old_table_prefixes( $old_prefixes )
|
354 |
+
->set_new_table_prefixes( $new_prefixes )
|
355 |
+
->set_old_replace_values( $old_values )
|
356 |
+
->set_new_replace_values( $new_values );
|
357 |
+
|
358 |
+
// Flush database
|
359 |
+
if ( ( $version = $config->Plugin->Version ) ) {
|
360 |
+
if ( $version !== 'develop' && version_compare( $version, '4.10', '<' ) ) {
|
361 |
+
$client->set_include_table_prefixes( array( ai1wm_table_prefix() ) );
|
362 |
+
$client->flush();
|
363 |
+
}
|
364 |
+
}
|
365 |
+
|
366 |
+
// Import database
|
367 |
+
$client->import( ai1wm_database_path( $params ) );
|
368 |
+
|
369 |
+
// Clear WP options cache
|
370 |
+
wp_cache_flush();
|
371 |
+
|
372 |
+
// Activate plugins
|
373 |
+
foreach ( $active_plugins as $plugin ) {
|
374 |
+
if ( in_array( $plugin, ai1wm_active_plugins() ) ) {
|
375 |
+
activate_plugin( $plugin );
|
376 |
+
}
|
377 |
+
}
|
378 |
+
|
379 |
+
// Set the new URL IP
|
380 |
+
update_site_option( AI1WM_URL_IP, $url_ip );
|
381 |
+
|
382 |
+
// Set the new URL transport
|
383 |
+
update_site_option( AI1WM_URL_TRANSPORT, $url_transport );
|
384 |
+
|
385 |
+
// Set the new secret key value
|
386 |
+
update_site_option( AI1WM_SECRET_KEY, $secret_key );
|
387 |
+
|
388 |
+
// Set the new HTTP user
|
389 |
+
update_site_option( AI1WM_AUTH_USER, $auth_user );
|
390 |
+
|
391 |
+
// Set the new HTTP password
|
392 |
+
update_site_option( AI1WM_AUTH_PASSWORD, $auth_password );
|
393 |
+
|
394 |
+
return $params;
|
395 |
+
}
|
396 |
+
}
|
lib/model/import/class-ai1wm-import-done.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Import_Done {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Get permalink URL
|
31 |
+
$permalink = admin_url( 'options-permalink.php#submit' );
|
32 |
+
|
33 |
+
// Set progress
|
34 |
+
Ai1wm_Status::done(
|
35 |
+
__(
|
36 |
+
"You need to perform two more steps:<br />" .
|
37 |
+
"<strong>1. You must save your permalinks structure twice. <a class=\"ai1wm-no-underline\" href=\"{$permalink}\" target=\"_blank\">Permalinks Settings</a></strong> <small>(opens a new window)</small><br />" .
|
38 |
+
"<strong>2. <a class=\"ai1wm-no-underline\" href=\"https://wordpress.org/support/view/plugin-reviews/all-in-one-wp-migration?rate=5#postform\" target=\"_blank\">Review the plugin</a>.</strong> <small>(opens a new window)</small>",
|
39 |
+
AI1WM_PLUGIN_NAME
|
40 |
+
),
|
41 |
+
__(
|
42 |
+
"Your data has been imported successfuly!",
|
43 |
+
AI1WM_PLUGIN_NAME
|
44 |
+
)
|
45 |
+
);
|
46 |
+
|
47 |
+
return $params;
|
48 |
+
}
|
49 |
+
}
|
lib/model/import/class-ai1wm-import-enumerate.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Import_Enumerate {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Set progress
|
31 |
+
Ai1wm_Status::info( __( 'Retrieving a list of all WordPress files...', AI1WM_PLUGIN_NAME ) );
|
32 |
+
|
33 |
+
// Open the archive file for reading
|
34 |
+
$archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
|
35 |
+
|
36 |
+
// Get number of files
|
37 |
+
$total = $archive->get_number_of_files();
|
38 |
+
|
39 |
+
// Close the archive file
|
40 |
+
$archive->close();
|
41 |
+
|
42 |
+
// Set total
|
43 |
+
$params['total'] = $total;
|
44 |
+
|
45 |
+
// Set progress
|
46 |
+
Ai1wm_Status::info( __( 'Done retrieving a list of all WordPress files.', AI1WM_PLUGIN_NAME ) );
|
47 |
+
|
48 |
+
return $params;
|
49 |
+
}
|
50 |
+
}
|
lib/model/import/class-ai1wm-import-resolve.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Import_Resolve {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Set progress
|
31 |
+
Ai1wm_Status::info( __( 'Resolving URL address...', AI1WM_PLUGIN_NAME ) );
|
32 |
+
|
33 |
+
// HTTP resolve
|
34 |
+
Ai1wm_Http::resolve( admin_url( 'admin-ajax.php?action=ai1wm_resolve' ) );
|
35 |
+
|
36 |
+
// Set progress
|
37 |
+
Ai1wm_Status::info( __( 'Done resolving URL address...', AI1WM_PLUGIN_NAME ) );
|
38 |
+
|
39 |
+
return $params;
|
40 |
+
}
|
41 |
+
}
|
lib/model/{class-ai1wm-import-file.php → import/class-ai1wm-import-upload.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,39 +23,36 @@
|
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
-
class
|
|
|
|
|
27 |
|
28 |
-
public function import() {
|
29 |
// Get upload file
|
30 |
if ( ! isset( $_FILES['upload-file'] ) ) {
|
31 |
-
|
32 |
}
|
33 |
|
34 |
// Set chunk
|
35 |
-
if ( isset( $
|
36 |
-
$chunk = (int) $
|
37 |
} else {
|
38 |
$chunk = 0;
|
39 |
}
|
40 |
|
41 |
// Set chunks
|
42 |
-
if ( isset( $
|
43 |
-
$chunks = (int) $
|
44 |
} else {
|
45 |
$chunks = 1;
|
46 |
}
|
47 |
|
48 |
-
// Set archive
|
49 |
-
if ( isset( $this->args['name'] ) ) {
|
50 |
-
$this->args['archive'] = $this->args['name'];
|
51 |
-
}
|
52 |
-
|
53 |
// Has any upload error?
|
54 |
if ( empty( $_FILES['upload-file']['error'] ) ) {
|
55 |
|
56 |
// Open partial file
|
57 |
-
$out = fopen( $
|
58 |
if ( $out ) {
|
|
|
59 |
// Read binary input stream and append it to temp file
|
60 |
$in = fopen( $_FILES['upload-file']['tmp_name'], 'rb' );
|
61 |
if ( $in ) {
|
@@ -75,5 +72,7 @@ class Ai1wm_Import_File extends Ai1wm_Import_Abstract {
|
|
75 |
} else {
|
76 |
status_header( 500 );
|
77 |
}
|
|
|
|
|
78 |
}
|
79 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Import_Upload {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
|
|
|
30 |
// Get upload file
|
31 |
if ( ! isset( $_FILES['upload-file'] ) ) {
|
32 |
+
return $params;
|
33 |
}
|
34 |
|
35 |
// Set chunk
|
36 |
+
if ( isset( $params['chunk'] ) ) {
|
37 |
+
$chunk = (int) $params['chunk'];
|
38 |
} else {
|
39 |
$chunk = 0;
|
40 |
}
|
41 |
|
42 |
// Set chunks
|
43 |
+
if ( isset( $params['chunks'] ) ) {
|
44 |
+
$chunks = (int) $params['chunks'];
|
45 |
} else {
|
46 |
$chunks = 1;
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
49 |
// Has any upload error?
|
50 |
if ( empty( $_FILES['upload-file']['error'] ) ) {
|
51 |
|
52 |
// Open partial file
|
53 |
+
$out = fopen( ai1wm_archive_path( $params ), $chunk === 0 ? 'wb' : 'ab' );
|
54 |
if ( $out ) {
|
55 |
+
|
56 |
// Read binary input stream and append it to temp file
|
57 |
$in = fopen( $_FILES['upload-file']['tmp_name'], 'rb' );
|
58 |
if ( $in ) {
|
72 |
} else {
|
73 |
status_header( 500 );
|
74 |
}
|
75 |
+
|
76 |
+
exit;
|
77 |
}
|
78 |
}
|
lib/model/import/class-ai1wm-import-validate.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Ai1wm_Import_Validate {
|
27 |
+
|
28 |
+
public static function execute( $params ) {
|
29 |
+
|
30 |
+
// Set progress
|
31 |
+
Ai1wm_Status::info( __( 'Unpacking archive...', AI1WM_PLUGIN_NAME ) );
|
32 |
+
|
33 |
+
// Open the archive file for reading
|
34 |
+
$archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
|
35 |
+
|
36 |
+
// Unpack package.json and database.sql files
|
37 |
+
$archive->extract_by_files_array(
|
38 |
+
ai1wm_storage_path( $params ),
|
39 |
+
array(
|
40 |
+
AI1WM_PACKAGE_NAME,
|
41 |
+
AI1WM_MULTISITE_NAME,
|
42 |
+
AI1WM_DATABASE_NAME,
|
43 |
+
)
|
44 |
+
);
|
45 |
+
|
46 |
+
// Close the archive file
|
47 |
+
$archive->close();
|
48 |
+
|
49 |
+
// Check package.json file
|
50 |
+
if ( false === is_file( ai1wm_package_path( $params ) ) ) {
|
51 |
+
throw new Ai1wm_Import_Exception(
|
52 |
+
__( 'Invalid archive file. It should contain <strong>package.json</strong> file.', AI1WM_PLUGIN_NAME )
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
+
return $params;
|
57 |
+
}
|
58 |
+
}
|
lib/model/service/class-ai1wm-service-database.php
DELETED
@@ -1,307 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
-
*
|
5 |
-
* This program is free software: you can redistribute it and/or modify
|
6 |
-
* it under the terms of the GNU General Public License as published by
|
7 |
-
* the Free Software Foundation, either version 3 of the License, or
|
8 |
-
* (at your option) any later version.
|
9 |
-
*
|
10 |
-
* This program is distributed in the hope that it will be useful,
|
11 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
-
* You should have received a copy of the GNU General Public License
|
16 |
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
-
*
|
18 |
-
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
-
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
-
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
-
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
-
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
-
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
-
*/
|
25 |
-
|
26 |
-
class Ai1wm_Service_Database implements Ai1wm_Service_Interface {
|
27 |
-
|
28 |
-
protected $args = array();
|
29 |
-
|
30 |
-
protected $storage = null;
|
31 |
-
|
32 |
-
public function __construct( array $args = array() ) {
|
33 |
-
$this->args = $args;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Import database
|
38 |
-
*
|
39 |
-
* @return void
|
40 |
-
*/
|
41 |
-
public function import() {
|
42 |
-
global $wpdb;
|
43 |
-
|
44 |
-
// Get configuration
|
45 |
-
$service = new Ai1wm_Service_Package( $this->args );
|
46 |
-
$config = $service->import();
|
47 |
-
|
48 |
-
$old_values = array();
|
49 |
-
$new_values = array();
|
50 |
-
|
51 |
-
// Get Site URL
|
52 |
-
if ( isset( $config['SiteURL'] ) && ( $config['SiteURL'] !== site_url() ) ) {
|
53 |
-
|
54 |
-
// Get domain
|
55 |
-
$old_domain = parse_url( $config['SiteURL'], PHP_URL_HOST );
|
56 |
-
$new_domain = parse_url( site_url(), PHP_URL_HOST );
|
57 |
-
|
58 |
-
// Add plain Site URL
|
59 |
-
$old_values[] = set_url_scheme( $config['SiteURL'], 'http' );
|
60 |
-
$new_values[] = set_url_scheme( site_url() );
|
61 |
-
|
62 |
-
// Add plain Site URL SSL
|
63 |
-
$old_values[] = set_url_scheme( $config['SiteURL'], 'https' );
|
64 |
-
$new_values[] = set_url_scheme( site_url() );
|
65 |
-
|
66 |
-
// Add encoded Site URL
|
67 |
-
$old_values[] = urlencode( set_url_scheme( $config['SiteURL'], 'http' ) );
|
68 |
-
$new_values[] = urlencode( set_url_scheme( site_url() ) );
|
69 |
-
|
70 |
-
// Add encoded Site URL SSL
|
71 |
-
$old_values[] = urlencode( set_url_scheme( $config['SiteURL'], 'https' ) );
|
72 |
-
$new_values[] = urlencode( set_url_scheme( site_url() ) );
|
73 |
-
|
74 |
-
// Add escaped Site URL
|
75 |
-
$old_values[] = addslashes( addcslashes( set_url_scheme( $config['SiteURL'], 'http' ), '/' ) );
|
76 |
-
$new_values[] = addslashes( addcslashes( set_url_scheme( site_url() ), '/' ) );
|
77 |
-
|
78 |
-
// Add escaped Site URL SSL
|
79 |
-
$old_values[] = addslashes( addcslashes( set_url_scheme( $config['SiteURL'], 'https' ), '/' ) );
|
80 |
-
$new_values[] = addslashes( addcslashes( set_url_scheme( site_url() ), '/' ) );
|
81 |
-
|
82 |
-
// Add email
|
83 |
-
$old_values[] = sprintf( "@%s", $old_domain );
|
84 |
-
$new_values[] = sprintf( "@%s", $new_domain );
|
85 |
-
}
|
86 |
-
|
87 |
-
// Get Home URL
|
88 |
-
if ( isset( $config['HomeURL'] ) && ( $config['HomeURL'] !== home_url() ) ) {
|
89 |
-
|
90 |
-
// Add plain Home URL
|
91 |
-
$old_values[] = set_url_scheme( $config['HomeURL'], 'http' );
|
92 |
-
$new_values[] = set_url_scheme( home_url() );
|
93 |
-
|
94 |
-
// Add plain Home URL SSL
|
95 |
-
$old_values[] = set_url_scheme( $config['HomeURL'], 'https' );
|
96 |
-
$new_values[] = set_url_scheme( home_url() );
|
97 |
-
|
98 |
-
// Add encoded Home URL
|
99 |
-
$old_values[] = urlencode( set_url_scheme( $config['HomeURL'], 'http' ) );
|
100 |
-
$new_values[] = urlencode( set_url_scheme( home_url() ) );
|
101 |
-
|
102 |
-
// Add encoded Home URL SSL
|
103 |
-
$old_values[] = urlencode( set_url_scheme( $config['HomeURL'], 'https' ) );
|
104 |
-
$new_values[] = urlencode( set_url_scheme( home_url() ) );
|
105 |
-
|
106 |
-
// Add escaped Home URL
|
107 |
-
$old_values[] = addslashes( addcslashes( set_url_scheme( $config['HomeURL'], 'http' ), '/' ) );
|
108 |
-
$new_values[] = addslashes( addcslashes( set_url_scheme( home_url() ), '/' ) );
|
109 |
-
|
110 |
-
// Add escaped Home URL SSL
|
111 |
-
$old_values[] = addslashes( addcslashes( set_url_scheme( $config['HomeURL'], 'https' ), '/' ) );
|
112 |
-
$new_values[] = addslashes( addcslashes( set_url_scheme( home_url() ), '/' ) );
|
113 |
-
}
|
114 |
-
|
115 |
-
// Get WordPress Content
|
116 |
-
if ( isset( $config['WordPress']['Content'] ) && ( $config['WordPress']['Content'] !== WP_CONTENT_DIR ) ) {
|
117 |
-
|
118 |
-
// Add plain WordPress Content
|
119 |
-
$old_values[] = $config['WordPress']['Content'];
|
120 |
-
$new_values[] = WP_CONTENT_DIR;
|
121 |
-
|
122 |
-
// Get escaped WordPress Content
|
123 |
-
$old_values[] = addslashes( addcslashes( $config['WordPress']['Content'], '\/' ) );
|
124 |
-
$new_values[] = addslashes( addcslashes( WP_CONTENT_DIR, '\/' ) );
|
125 |
-
}
|
126 |
-
|
127 |
-
// Get user details
|
128 |
-
if ( isset( $config['Import']['User']['Id'] ) && ( $id = $config['Import']['User']['Id'] ) ) {
|
129 |
-
$meta = get_userdata( $id );
|
130 |
-
$user = array(
|
131 |
-
'user_login' => $meta->user_login,
|
132 |
-
'user_pass' => $meta->user_pass,
|
133 |
-
'user_nicename' => $meta->user_nicename,
|
134 |
-
'user_url' => $meta->user_url,
|
135 |
-
'user_email' => $meta->user_email,
|
136 |
-
'display_name' => $meta->display_name,
|
137 |
-
'nickname' => $meta->nickname,
|
138 |
-
'first_name' => $meta->first_name,
|
139 |
-
'last_name' => $meta->last_name,
|
140 |
-
'description' => $meta->description,
|
141 |
-
'rich_editing' => $meta->rich_editing,
|
142 |
-
'user_registered' => $meta->user_registered,
|
143 |
-
'jabber' => $meta->jabber,
|
144 |
-
'aim' => $meta->aim,
|
145 |
-
'yim' => $meta->yim,
|
146 |
-
'show_admin_bar_front' => $meta->show_admin_bar_front,
|
147 |
-
);
|
148 |
-
} else {
|
149 |
-
$user = array();
|
150 |
-
}
|
151 |
-
|
152 |
-
// Get URL IP
|
153 |
-
$url_ip = get_site_option( AI1WM_URL_IP, false, false );
|
154 |
-
|
155 |
-
// Get URL transport
|
156 |
-
$url_transport = get_site_option( AI1WM_URL_TRANSPORT, false, false );
|
157 |
-
|
158 |
-
// Get secret key
|
159 |
-
$secret_key = get_site_option( AI1WM_SECRET_KEY, false, false );
|
160 |
-
|
161 |
-
// Get HTTP user
|
162 |
-
$auth_user = get_site_option( AI1WM_AUTH_USER, false, false );
|
163 |
-
|
164 |
-
// Get HTTP password
|
165 |
-
$auth_password = get_site_option( AI1WM_AUTH_PASSWORD, false, false );
|
166 |
-
|
167 |
-
// Get active plugins
|
168 |
-
$active_plugins = get_site_option( AI1WM_ACTIVE_PLUGINS, array(), false );
|
169 |
-
|
170 |
-
// Get database client
|
171 |
-
$client = MysqlDumpFactory::makeMysqlDump( DB_HOST, DB_USER, DB_PASSWORD, DB_NAME );
|
172 |
-
|
173 |
-
// Set database options
|
174 |
-
$client->setOldTablePrefixes( array( AI1WM_TABLE_PREFIX ) )
|
175 |
-
->setNewTablePrefixes( array( $wpdb->prefix ) )
|
176 |
-
->setOldReplaceValues( $old_values )
|
177 |
-
->setNewReplaceValues( $new_values );
|
178 |
-
|
179 |
-
// Flush database
|
180 |
-
if ( ( $version = $config['Plugin']['Version'] ) ) {
|
181 |
-
if ( $version !== 'develop' && version_compare( $version, '4.9', '<' ) ) {
|
182 |
-
$client->setIncludeTablePrefixes( array( $wpdb->prefix ) );
|
183 |
-
$client->flush();
|
184 |
-
}
|
185 |
-
}
|
186 |
-
|
187 |
-
// Import database
|
188 |
-
$client->import( $this->storage()->database() );
|
189 |
-
|
190 |
-
// Clear WP options cache
|
191 |
-
wp_cache_flush();
|
192 |
-
|
193 |
-
// Activate plugins
|
194 |
-
foreach ( $active_plugins as $plugin ) {
|
195 |
-
if ( in_array( $plugin, ai1wm_active_plugins() ) ) {
|
196 |
-
activate_plugin( $plugin );
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
// Set new user identity
|
201 |
-
if ( isset( $config['Export']['User']['Id'] ) && ( $id = $config['Export']['User']['Id'] ) ) {
|
202 |
-
|
203 |
-
// Update user login and password
|
204 |
-
if ( isset( $user['user_login'] ) && isset( $user['user_pass'] ) ) {
|
205 |
-
$wpdb->update(
|
206 |
-
$wpdb->users,
|
207 |
-
array( 'user_login' => $user['user_login'], 'user_pass' => $user['user_pass'] ),
|
208 |
-
array( 'ID' => $id ),
|
209 |
-
array( '%s', '%s' ),
|
210 |
-
array( '%d' )
|
211 |
-
);
|
212 |
-
|
213 |
-
// Unset user login
|
214 |
-
unset( $user['user_login'] );
|
215 |
-
|
216 |
-
// Unset user password
|
217 |
-
unset( $user['user_pass'] );
|
218 |
-
}
|
219 |
-
|
220 |
-
// Update user details
|
221 |
-
$result = wp_update_user( array( 'ID' => $id ) + $user );
|
222 |
-
|
223 |
-
// Log the error
|
224 |
-
if ( is_wp_error( $result ) ) {
|
225 |
-
Ai1wm_Log::error( 'Exception while importing user identity: ' . $result->get_error_message() );
|
226 |
-
}
|
227 |
-
}
|
228 |
-
|
229 |
-
// Set the new URL IP
|
230 |
-
update_site_option( AI1WM_URL_IP, $url_ip );
|
231 |
-
|
232 |
-
// Set the new URL transport
|
233 |
-
update_site_option( AI1WM_URL_TRANSPORT, $url_transport );
|
234 |
-
|
235 |
-
// Set the new secret key value
|
236 |
-
update_site_option( AI1WM_SECRET_KEY, $secret_key );
|
237 |
-
|
238 |
-
// Set the new HTTP user
|
239 |
-
update_site_option( AI1WM_AUTH_USER, $auth_user );
|
240 |
-
|
241 |
-
// Set the new HTTP password
|
242 |
-
update_site_option( AI1WM_AUTH_PASSWORD, $auth_password );
|
243 |
-
}
|
244 |
-
|
245 |
-
/**
|
246 |
-
* Export database
|
247 |
-
*
|
248 |
-
* @return void
|
249 |
-
*/
|
250 |
-
public function export() {
|
251 |
-
global $wpdb;
|
252 |
-
|
253 |
-
// Get database client
|
254 |
-
$client = MysqlDumpFactory::makeMysqlDump( DB_HOST, DB_USER, DB_PASSWORD, DB_NAME );
|
255 |
-
|
256 |
-
// Spam comments
|
257 |
-
if ( isset( $this->args['options']['no-spam-comments'] ) ) {
|
258 |
-
$client->setTableQueryClauses( $wpdb->comments, " WHERE comment_approved != 'spam' " );
|
259 |
-
$client->setTableQueryClauses( $wpdb->commentmeta, sprintf(
|
260 |
-
" WHERE comment_id IN ( SELECT comment_ID FROM `%s` WHERE comment_approved != 'spam' ) ",
|
261 |
-
$wpdb->comments
|
262 |
-
) );
|
263 |
-
}
|
264 |
-
|
265 |
-
// Post revisions
|
266 |
-
if ( isset( $this->args['options']['no-revisions'] ) ) {
|
267 |
-
$client->setTableQueryClauses( $wpdb->posts, " WHERE post_type != 'revision' " );
|
268 |
-
}
|
269 |
-
|
270 |
-
// Find and replace
|
271 |
-
$old_values = array();
|
272 |
-
$new_values = array();
|
273 |
-
if ( isset( $this->args['options']['replace'] ) && ( $replace = $this->args['options']['replace'] ) ) {
|
274 |
-
for ( $i = 0; $i < count( $replace['old-value'] ); $i++ ) {
|
275 |
-
if ( ! empty( $replace['old-value'][$i] ) && ! empty( $replace['new-value'][$i] ) ) {
|
276 |
-
$old_values[] = $replace['old-value'][$i];
|
277 |
-
$new_values[] = $replace['new-value'][$i];
|
278 |
-
}
|
279 |
-
}
|
280 |
-
}
|
281 |
-
|
282 |
-
// Set database options
|
283 |
-
$client->setOldTablePrefixes( array( $wpdb->prefix ) )
|
284 |
-
->setNewTablePrefixes( array( AI1WM_TABLE_PREFIX ) )
|
285 |
-
->setOldReplaceValues( $old_values )
|
286 |
-
->setNewReplaceValues( $new_values )
|
287 |
-
->setIncludeTablePrefixes( array( $wpdb->prefix ) )
|
288 |
-
->setTablePrefixColumns( $wpdb->options, array( 'option_name' ) )
|
289 |
-
->setTablePrefixColumns( $wpdb->usermeta, array( 'meta_key' ) );
|
290 |
-
|
291 |
-
// Export database
|
292 |
-
$client->export( $this->storage()->database() );
|
293 |
-
}
|
294 |
-
|
295 |
-
/*
|
296 |
-
* Get storage object
|
297 |
-
*
|
298 |
-
* @return Ai1wm_Storage
|
299 |
-
*/
|
300 |
-
protected function storage() {
|
301 |
-
if ( $this->storage === null ) {
|
302 |
-
$this->storage = new Ai1wm_Storage( $this->args );
|
303 |
-
}
|
304 |
-
|
305 |
-
return $this->storage;
|
306 |
-
}
|
307 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/model/service/class-ai1wm-service-package.php
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
-
*
|
5 |
-
* This program is free software: you can redistribute it and/or modify
|
6 |
-
* it under the terms of the GNU General Public License as published by
|
7 |
-
* the Free Software Foundation, either version 3 of the License, or
|
8 |
-
* (at your option) any later version.
|
9 |
-
*
|
10 |
-
* This program is distributed in the hope that it will be useful,
|
11 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
-
* You should have received a copy of the GNU General Public License
|
16 |
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
-
*
|
18 |
-
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
-
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
-
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
-
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
-
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
-
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
-
*/
|
25 |
-
|
26 |
-
class Ai1wm_Service_Package implements Ai1wm_Service_Interface {
|
27 |
-
|
28 |
-
protected $args = array();
|
29 |
-
|
30 |
-
protected $storage = null;
|
31 |
-
|
32 |
-
public function __construct( array $args = array() ) {
|
33 |
-
$this->args = $args;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Import package configuration
|
38 |
-
*
|
39 |
-
* @return array
|
40 |
-
*/
|
41 |
-
public function import() {
|
42 |
-
global $wp_version;
|
43 |
-
|
44 |
-
$config = array();
|
45 |
-
|
46 |
-
// Get package file
|
47 |
-
$package = file_get_contents( $this->storage()->package() );
|
48 |
-
if ( false === $package ) {
|
49 |
-
throw new Ai1wm_Import_Exception( 'Unable to read package.json file' );
|
50 |
-
}
|
51 |
-
|
52 |
-
// Get config data
|
53 |
-
if ( ( $config = json_decode( $package, true ) ) ) {
|
54 |
-
|
55 |
-
// Add plugin version
|
56 |
-
if ( ! isset( $config['Plugin']['Version'] ) ) {
|
57 |
-
$config['Plugin']['Version'] = AI1WM_VERSION;
|
58 |
-
}
|
59 |
-
|
60 |
-
// Add WordPress version
|
61 |
-
if ( ! isset( $config['WordPress']['Version'] ) ) {
|
62 |
-
$config['WordPress']['Version'] = $wp_version;
|
63 |
-
}
|
64 |
-
|
65 |
-
// Add WordPress content
|
66 |
-
if ( ! isset( $config['WordPress']['Content'] ) ) {
|
67 |
-
$config['WordPress']['Content'] = WP_CONTENT_DIR;
|
68 |
-
}
|
69 |
-
|
70 |
-
// Add user identity
|
71 |
-
if ( ! isset( $config['Import']['User'] ) && ! empty( $config['Export']['User'] ) ) {
|
72 |
-
$config['Import']['User'] = array( 'Id' => get_current_user_id() );
|
73 |
-
|
74 |
-
// Save package file
|
75 |
-
$package = file_put_contents( $this->storage()->package(), json_encode( $config ) );
|
76 |
-
if ( false === $package ) {
|
77 |
-
throw new Ai1wm_Import_Exception( 'Unable to write package.json file' );
|
78 |
-
}
|
79 |
-
}
|
80 |
-
} else {
|
81 |
-
throw new Ai1wm_Import_Exception( 'Unable to parse package.json file' );
|
82 |
-
}
|
83 |
-
|
84 |
-
return $config;
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Export package configuration
|
89 |
-
*
|
90 |
-
* @return string
|
91 |
-
*/
|
92 |
-
public function export() {
|
93 |
-
global $wp_version;
|
94 |
-
|
95 |
-
// Get options
|
96 |
-
$options = wp_load_alloptions();
|
97 |
-
|
98 |
-
// Get Site URL
|
99 |
-
$site_url = site_url();
|
100 |
-
if ( isset( $options['siteurl'] ) ) {
|
101 |
-
$site_url = untrailingslashit( $options['siteurl'] );
|
102 |
-
}
|
103 |
-
|
104 |
-
// Get Home URL
|
105 |
-
$home_url = home_url();
|
106 |
-
if ( isset( $options['home'] ) ) {
|
107 |
-
$home_url = untrailingslashit( $options['home'] );
|
108 |
-
}
|
109 |
-
|
110 |
-
// Default configuration
|
111 |
-
$config = array(
|
112 |
-
'SiteURL' => $site_url,
|
113 |
-
'HomeURL' => $home_url,
|
114 |
-
'Plugin' => array( 'Version' => AI1WM_VERSION ),
|
115 |
-
'WordPress' => array( 'Version' => $wp_version, 'Content' => WP_CONTENT_DIR ),
|
116 |
-
);
|
117 |
-
|
118 |
-
// Get user identity
|
119 |
-
if ( apply_filters( 'ai1wm_keep_user_identity_on_export', false ) ) {
|
120 |
-
$config['Export']['User'] = array( 'Id' => get_current_user_id() );
|
121 |
-
}
|
122 |
-
|
123 |
-
// Save package file
|
124 |
-
$package = file_put_contents( $this->storage()->package(), json_encode( $config ) );
|
125 |
-
if ( false === $package ) {
|
126 |
-
throw new Ai1wm_Import_Exception( 'Unable to write package.json file' );
|
127 |
-
}
|
128 |
-
}
|
129 |
-
|
130 |
-
/*
|
131 |
-
* Get storage object
|
132 |
-
*
|
133 |
-
* @return Ai1wm_Storage
|
134 |
-
*/
|
135 |
-
protected function storage() {
|
136 |
-
if ( $this->storage === null ) {
|
137 |
-
$this->storage = new Ai1wm_Storage( $this->args );
|
138 |
-
}
|
139 |
-
|
140 |
-
return $this->storage;
|
141 |
-
}
|
142 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/vendor/mysqldump-factory/mysqldump-factory/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
The MIT License (MIT)
|
2 |
-
|
3 |
-
Copyright (c) 2013 Yani Iliev, Bobby Angelov
|
4 |
-
|
5 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6 |
-
this software and associated documentation files (the "Software"), to deal in
|
7 |
-
the Software without restriction, including without limitation the rights to
|
8 |
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9 |
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
10 |
-
subject to the following conditions:
|
11 |
-
|
12 |
-
The above copyright notice and this permission notice shall be included in all
|
13 |
-
copies or substantial portions of the Software.
|
14 |
-
|
15 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17 |
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18 |
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19 |
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20 |
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/vendor/mysqldump-factory/mysqldump-factory/lib/MysqlDumpInterface.php
DELETED
@@ -1,196 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
-
*
|
6 |
-
* This program is free software: you can redistribute it and/or modify
|
7 |
-
* it under the terms of the GNU General Public License as published by
|
8 |
-
* the Free Software Foundation, either version 3 of the License, or
|
9 |
-
* (at your option) any later version.
|
10 |
-
*
|
11 |
-
* This program is distributed in the hope that it will be useful,
|
12 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
-
* GNU General Public License for more details.
|
15 |
-
*
|
16 |
-
* You should have received a copy of the GNU General Public License
|
17 |
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 |
-
*
|
19 |
-
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
20 |
-
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
21 |
-
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
22 |
-
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
23 |
-
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
-
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
-
*/
|
26 |
-
|
27 |
-
interface MysqlDumpInterface
|
28 |
-
{
|
29 |
-
|
30 |
-
const QUERIES_PER_TRANSACTION = 1000;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Define MySQL credentials for the current connection
|
34 |
-
*
|
35 |
-
* @param string $hostname MySQL Hostname
|
36 |
-
* @param string $username MySQL Username
|
37 |
-
* @param string $password MySQL Password
|
38 |
-
* @param string $database MySQL Database
|
39 |
-
* @return void
|
40 |
-
*/
|
41 |
-
public function __construct($hostname = 'localhost', $username = '', $password = '', $database = '');
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Set old table prefix
|
45 |
-
*
|
46 |
-
* @param array $prefixes List of table prefixes
|
47 |
-
* @return MysqlDumpInterface
|
48 |
-
*/
|
49 |
-
public function setOldTablePrefixes($prefixes);
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Get old table prefixes
|
53 |
-
*
|
54 |
-
* @return array
|
55 |
-
*/
|
56 |
-
public function getOldTablePrefixes();
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Set new table prefixes
|
60 |
-
*
|
61 |
-
* @param array $prefixes List of table prefixes
|
62 |
-
* @return MysqlDumpInterface
|
63 |
-
*/
|
64 |
-
public function setNewTablePrefixes($prefixes);
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Get new table prefixes
|
68 |
-
*
|
69 |
-
* @return array
|
70 |
-
*/
|
71 |
-
public function getNewTablePrefixes();
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Set old replace values
|
75 |
-
*
|
76 |
-
* @param array $values List of values
|
77 |
-
* @return MysqlDumpInterface
|
78 |
-
*/
|
79 |
-
public function setOldReplaceValues($values);
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Get old replace values
|
83 |
-
*
|
84 |
-
* @return array
|
85 |
-
*/
|
86 |
-
public function getOldReplaceValues();
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Set new replace values
|
90 |
-
*
|
91 |
-
* @param array $values List of values
|
92 |
-
* @return MysqlDumpInterface
|
93 |
-
*/
|
94 |
-
public function setNewReplaceValues($values);
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Get new replace values
|
98 |
-
*
|
99 |
-
* @return array
|
100 |
-
*/
|
101 |
-
public function getNewReplaceValues();
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Set table query clauses
|
105 |
-
*
|
106 |
-
* @param string $table Table name
|
107 |
-
* @param array $clauses Table clauses
|
108 |
-
* @return MysqlDumpInterface
|
109 |
-
*/
|
110 |
-
public function setTableQueryClauses($table, $clauses);
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Get table query clauses
|
114 |
-
*
|
115 |
-
* @param string $table Table name
|
116 |
-
* @return array
|
117 |
-
*/
|
118 |
-
public function getTableQueryClauses($table);
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Set table prefix columns
|
122 |
-
*
|
123 |
-
* @param string $table Table name
|
124 |
-
* @param array $columns Table columns
|
125 |
-
* @return MysqlDumpInterface
|
126 |
-
*/
|
127 |
-
public function setTablePrefixColumns($table, $columns);
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Get table prefix columns
|
131 |
-
*
|
132 |
-
* @param string $table Table name
|
133 |
-
* @return array
|
134 |
-
*/
|
135 |
-
public function getTablePrefixColumns($table);
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Set exclude table prefixes
|
139 |
-
*
|
140 |
-
* @param array $prefixes List of table prefixes
|
141 |
-
* @return MysqlDumpInterface
|
142 |
-
*/
|
143 |
-
public function setExcludeTablePrefixes($prefixes);
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Get exclude table prefixes
|
147 |
-
*
|
148 |
-
* @return array
|
149 |
-
*/
|
150 |
-
public function getExcludeTablePrefixes();
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Get tables
|
154 |
-
*
|
155 |
-
* @return array
|
156 |
-
*/
|
157 |
-
public function getTables();
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Get MySQL connection (lazy loading)
|
161 |
-
*
|
162 |
-
* @return resource
|
163 |
-
*/
|
164 |
-
public function getConnection();
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Run MySQL query
|
168 |
-
*
|
169 |
-
* @param string $query SQL query
|
170 |
-
* @return resource
|
171 |
-
*/
|
172 |
-
public function query($query);
|
173 |
-
|
174 |
-
/**
|
175 |
-
* Export database into a file
|
176 |
-
*
|
177 |
-
* @param string $fileName Name of file
|
178 |
-
* @return bool
|
179 |
-
*/
|
180 |
-
public function export($fileName);
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Import database from file
|
184 |
-
*
|
185 |
-
* @param string $fileName Name of file
|
186 |
-
* @return bool
|
187 |
-
*/
|
188 |
-
public function import($fileName);
|
189 |
-
|
190 |
-
/**
|
191 |
-
* Flush database
|
192 |
-
*
|
193 |
-
* @return void
|
194 |
-
*/
|
195 |
-
public function flush();
|
196 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/vendor/mysqldump-factory/mysqldump-factory/lib/MysqlDumpPDO.php
DELETED
@@ -1,974 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
-
*
|
6 |
-
* This program is free software: you can redistribute it and/or modify
|
7 |
-
* it under the terms of the GNU General Public License as published by
|
8 |
-
* the Free Software Foundation, either version 3 of the License, or
|
9 |
-
* (at your option) any later version.
|
10 |
-
*
|
11 |
-
* This program is distributed in the hope that it will be useful,
|
12 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
-
* GNU General Public License for more details.
|
15 |
-
*
|
16 |
-
* You should have received a copy of the GNU General Public License
|
17 |
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 |
-
*
|
19 |
-
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
20 |
-
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
21 |
-
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
22 |
-
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
23 |
-
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
-
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
-
*/
|
26 |
-
|
27 |
-
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'MysqlDumpInterface.php';
|
28 |
-
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'MysqlDumpUtility.php';
|
29 |
-
|
30 |
-
class MysqlDumpPDO implements MysqlDumpInterface
|
31 |
-
{
|
32 |
-
protected $hostname = null;
|
33 |
-
|
34 |
-
protected $port = null;
|
35 |
-
|
36 |
-
protected $socket = null;
|
37 |
-
|
38 |
-
protected $username = null;
|
39 |
-
|
40 |
-
protected $password = null;
|
41 |
-
|
42 |
-
protected $database = null;
|
43 |
-
|
44 |
-
protected $connection = null;
|
45 |
-
|
46 |
-
protected $oldTablePrefixes = null;
|
47 |
-
|
48 |
-
protected $newTablePrefixes = null;
|
49 |
-
|
50 |
-
protected $oldReplaceValues = array();
|
51 |
-
|
52 |
-
protected $newReplaceValues = array();
|
53 |
-
|
54 |
-
protected $tableQueryClauses = array();
|
55 |
-
|
56 |
-
protected $tablePrefixColumns = array();
|
57 |
-
|
58 |
-
protected $includeTablePrefixes = array();
|
59 |
-
|
60 |
-
protected $excludeTablePrefixes = array();
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Define MySQL credentials for the current connection
|
64 |
-
*
|
65 |
-
* @param string $hostname MySQL Hostname
|
66 |
-
* @param string $username MySQL Username
|
67 |
-
* @param string $password MySQL Password
|
68 |
-
* @param string $database MySQL Database
|
69 |
-
* @return void
|
70 |
-
*/
|
71 |
-
public function __construct($hostname = 'localhost', $username = '', $password = '', $database = '')
|
72 |
-
{
|
73 |
-
$dsn = $this->parseDSN($hostname);
|
74 |
-
|
75 |
-
// Set MySQL credentials
|
76 |
-
$this->hostname = $dsn['host'];
|
77 |
-
$this->port = $dsn['port'];
|
78 |
-
$this->socket = $dsn['socket'];
|
79 |
-
$this->username = $username;
|
80 |
-
$this->password = $password;
|
81 |
-
$this->database = $database;
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Set old table prefixes
|
86 |
-
*
|
87 |
-
* @param array $prefixes List of table prefixes
|
88 |
-
* @return MysqlDumpPDO
|
89 |
-
*/
|
90 |
-
public function setOldTablePrefixes($prefixes)
|
91 |
-
{
|
92 |
-
$this->oldTablePrefixes = $prefixes;
|
93 |
-
|
94 |
-
return $this;
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Get old table prefixes
|
99 |
-
*
|
100 |
-
* @return array
|
101 |
-
*/
|
102 |
-
public function getOldTablePrefixes()
|
103 |
-
{
|
104 |
-
return $this->oldTablePrefixes;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Set new table prefixes
|
109 |
-
*
|
110 |
-
* @param array $prefix List of table prefixes
|
111 |
-
* @return MysqlDumpPDO
|
112 |
-
*/
|
113 |
-
public function setNewTablePrefixes($prefixes)
|
114 |
-
{
|
115 |
-
$this->newTablePrefixes = $prefixes;
|
116 |
-
|
117 |
-
return $this;
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Get new table prefixes
|
122 |
-
*
|
123 |
-
* @return array
|
124 |
-
*/
|
125 |
-
public function getNewTablePrefixes()
|
126 |
-
{
|
127 |
-
return $this->newTablePrefixes;
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Set old replace values
|
132 |
-
*
|
133 |
-
* @param array $values List of values
|
134 |
-
* @return MysqlDumpPDO
|
135 |
-
*/
|
136 |
-
public function setOldReplaceValues($values)
|
137 |
-
{
|
138 |
-
$this->oldReplaceValues = $values;
|
139 |
-
|
140 |
-
return $this;
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* Get old replace values
|
145 |
-
*
|
146 |
-
* @return array
|
147 |
-
*/
|
148 |
-
public function getOldReplaceValues()
|
149 |
-
{
|
150 |
-
return $this->oldReplaceValues;
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Set new replace values
|
155 |
-
*
|
156 |
-
* @param array $values List of values
|
157 |
-
* @return MysqlDumpPDO
|
158 |
-
*/
|
159 |
-
public function setNewReplaceValues($values)
|
160 |
-
{
|
161 |
-
$this->newReplaceValues = $values;
|
162 |
-
|
163 |
-
return $this;
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Get new replace values
|
168 |
-
*
|
169 |
-
* @return array
|
170 |
-
*/
|
171 |
-
public function getNewReplaceValues()
|
172 |
-
{
|
173 |
-
return $this->newReplaceValues;
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Set table query clauses
|
178 |
-
*
|
179 |
-
* @param string $table Table name
|
180 |
-
* @param array $clauses Table clauses
|
181 |
-
* @return MysqlDumpPDO
|
182 |
-
*/
|
183 |
-
public function setTableQueryClauses($table, $clauses)
|
184 |
-
{
|
185 |
-
$this->tableQueryClauses[strtolower($table)] = $clauses;
|
186 |
-
|
187 |
-
return $this;
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* Get table query clauses
|
192 |
-
*
|
193 |
-
* @param string $table Table name
|
194 |
-
* @return array
|
195 |
-
*/
|
196 |
-
public function getTableQueryClauses($table)
|
197 |
-
{
|
198 |
-
if (isset($this->tableQueryClauses[strtolower($table)])) {
|
199 |
-
return $this->tableQueryClauses[strtolower($table)];
|
200 |
-
}
|
201 |
-
|
202 |
-
return array();
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Set table prefix columns
|
207 |
-
*
|
208 |
-
* @param string $table Table name
|
209 |
-
* @param array $columns Table columns
|
210 |
-
* @return MysqlDumpPDO
|
211 |
-
*/
|
212 |
-
public function setTablePrefixColumns($table, $columns)
|
213 |
-
{
|
214 |
-
foreach ($columns as $column) {
|
215 |
-
$this->tablePrefixColumns[strtolower($table)][strtolower($column)] = true;
|
216 |
-
}
|
217 |
-
|
218 |
-
return $this;
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* Get table prefix columns
|
223 |
-
*
|
224 |
-
* @param string $table Table name
|
225 |
-
* @return array
|
226 |
-
*/
|
227 |
-
public function getTablePrefixColumns($table)
|
228 |
-
{
|
229 |
-
if (isset($this->tablePrefixColumns[strtolower($table)])) {
|
230 |
-
return $this->tablePrefixColumns[strtolower($table)];
|
231 |
-
}
|
232 |
-
|
233 |
-
return array();
|
234 |
-
}
|
235 |
-
|
236 |
-
/**
|
237 |
-
* Set include table prefixes
|
238 |
-
*
|
239 |
-
* @param array $prefixes List of table prefixes
|
240 |
-
* @return MysqlDumpPDO
|
241 |
-
*/
|
242 |
-
public function setIncludeTablePrefixes($prefixes)
|
243 |
-
{
|
244 |
-
$this->includeTablePrefixes = $prefixes;
|
245 |
-
|
246 |
-
return $this;
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Get include table prefixes
|
251 |
-
*
|
252 |
-
* @return array
|
253 |
-
*/
|
254 |
-
public function getIncludeTablePrefixes()
|
255 |
-
{
|
256 |
-
return $this->includeTablePrefixes;
|
257 |
-
}
|
258 |
-
|
259 |
-
/**
|
260 |
-
* Set exclude table prefixes
|
261 |
-
*
|
262 |
-
* @param array $prefixes List of table prefixes
|
263 |
-
* @return MysqlDumpPDO
|
264 |
-
*/
|
265 |
-
public function setExcludeTablePrefixes($prefixes)
|
266 |
-
{
|
267 |
-
$this->excludeTablePrefixes = $prefixes;
|
268 |
-
|
269 |
-
return $this;
|
270 |
-
}
|
271 |
-
|
272 |
-
/**
|
273 |
-
* Get exclude table prefixes
|
274 |
-
*
|
275 |
-
* @return array
|
276 |
-
*/
|
277 |
-
public function getExcludeTablePrefixes()
|
278 |
-
{
|
279 |
-
return $this->excludeTablePrefixes;
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Get tables
|
284 |
-
*
|
285 |
-
* @return array
|
286 |
-
*/
|
287 |
-
public function getTables()
|
288 |
-
{
|
289 |
-
$tables = array();
|
290 |
-
|
291 |
-
try {
|
292 |
-
$result = $this->getConnection()->query(
|
293 |
-
"SELECT TABLE_NAME AS TableName FROM `INFORMATION_SCHEMA`.`TABLES` WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = '{$this->database}'"
|
294 |
-
);
|
295 |
-
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
296 |
-
if (isset($row['TableName']) && ($tableName = $row['TableName'])) {
|
297 |
-
|
298 |
-
// Include table prefixes
|
299 |
-
if ($this->getIncludeTablePrefixes()) {
|
300 |
-
$include = false;
|
301 |
-
|
302 |
-
// Check table prefixes
|
303 |
-
foreach ($this->getIncludeTablePrefixes() as $prefix) {
|
304 |
-
if (stripos($tableName, $prefix) === 0) {
|
305 |
-
$include = true;
|
306 |
-
break;
|
307 |
-
}
|
308 |
-
}
|
309 |
-
|
310 |
-
// Skip current table
|
311 |
-
if ($include === false) {
|
312 |
-
continue;
|
313 |
-
}
|
314 |
-
}
|
315 |
-
|
316 |
-
// Exclude table prefixes
|
317 |
-
if ($this->getExcludeTablePrefixes()) {
|
318 |
-
$exclude = false;
|
319 |
-
|
320 |
-
// Check table prefixes
|
321 |
-
foreach ($this->getExcludeTablePrefixes() as $prefix) {
|
322 |
-
if (stripos($tableName, $prefix) === 0) {
|
323 |
-
$exclude = true;
|
324 |
-
break;
|
325 |
-
}
|
326 |
-
}
|
327 |
-
|
328 |
-
// Skip current table
|
329 |
-
if ($exclude === true) {
|
330 |
-
continue;
|
331 |
-
}
|
332 |
-
}
|
333 |
-
|
334 |
-
// Add table name
|
335 |
-
$tables[] = $tableName;
|
336 |
-
}
|
337 |
-
}
|
338 |
-
} catch (Exception $e) {
|
339 |
-
$result = $this->getConnection()->query("SHOW TABLES FROM `{$this->database}`");
|
340 |
-
while ($row = $result->fetch(PDO::FETCH_NUM)) {
|
341 |
-
if (isset($row[0]) && ($tableName = $row[0])) {
|
342 |
-
|
343 |
-
// Include table prefixes
|
344 |
-
if ($this->getIncludeTablePrefixes()) {
|
345 |
-
$include = false;
|
346 |
-
|
347 |
-
// Check table prefixes
|
348 |
-
foreach ($this->getIncludeTablePrefixes() as $prefix) {
|
349 |
-
if (stripos($tableName, $prefix) === 0) {
|
350 |
-
$include = true;
|
351 |
-
break;
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
// Skip current table
|
356 |
-
if ($include === false) {
|
357 |
-
continue;
|
358 |
-
}
|
359 |
-
}
|
360 |
-
|
361 |
-
// Exclude table prefixes
|
362 |
-
if ($this->getExcludeTablePrefixes()) {
|
363 |
-
$exclude = false;
|
364 |
-
|
365 |
-
// Check table prefixes
|
366 |
-
foreach ($this->getExcludeTablePrefixes() as $prefix) {
|
367 |
-
if (stripos($tableName, $prefix) === 0) {
|
368 |
-
$exclude = true;
|
369 |
-
break;
|
370 |
-
}
|
371 |
-
}
|
372 |
-
|
373 |
-
// Skip current table
|
374 |
-
if ($exclude === true) {
|
375 |
-
continue;
|
376 |
-
}
|
377 |
-
}
|
378 |
-
|
379 |
-
// Add table name
|
380 |
-
$tables[] = $tableName;
|
381 |
-
}
|
382 |
-
}
|
383 |
-
}
|
384 |
-
|
385 |
-
return $tables;
|
386 |
-
}
|
387 |
-
|
388 |
-
/**
|
389 |
-
* Get MySQL connection (lazy loading)
|
390 |
-
*
|
391 |
-
* @return PDO
|
392 |
-
*/
|
393 |
-
public function getConnection()
|
394 |
-
{
|
395 |
-
if ($this->connection === null) {
|
396 |
-
try {
|
397 |
-
// Make connection (Socket)
|
398 |
-
$this->connection = $this->makeConnection();
|
399 |
-
} catch (Exception $e) {
|
400 |
-
try {
|
401 |
-
// Make connection (TCP)
|
402 |
-
$this->connection = $this->makeConnection(false);
|
403 |
-
} catch (Exception $e) {
|
404 |
-
throw new Exception('Unable to connect to MySQL database server: ' . $e->getMessage());
|
405 |
-
}
|
406 |
-
}
|
407 |
-
}
|
408 |
-
|
409 |
-
return $this->connection;
|
410 |
-
}
|
411 |
-
|
412 |
-
/**
|
413 |
-
* Run MySQL query
|
414 |
-
*
|
415 |
-
* @param string $query SQL query
|
416 |
-
* @return resource
|
417 |
-
*/
|
418 |
-
public function query($query)
|
419 |
-
{
|
420 |
-
return $this->getConnection()->query($query);
|
421 |
-
}
|
422 |
-
|
423 |
-
/**
|
424 |
-
* Export database into a file
|
425 |
-
*
|
426 |
-
* @param string $fileName Name of file
|
427 |
-
* @return bool
|
428 |
-
*/
|
429 |
-
public function export($fileName)
|
430 |
-
{
|
431 |
-
// Set file handler
|
432 |
-
$fileHandler = fopen($fileName, 'wb');
|
433 |
-
if ($fileHandler === false) {
|
434 |
-
throw new Exception('Unable to open database file');
|
435 |
-
}
|
436 |
-
|
437 |
-
// Write headers
|
438 |
-
if (fwrite($fileHandler, $this->getHeader()) === false) {
|
439 |
-
throw new Exception('Unable to write database header information');
|
440 |
-
}
|
441 |
-
|
442 |
-
// Export tables
|
443 |
-
foreach ($this->getTables() as $tableName) {
|
444 |
-
|
445 |
-
// Replace table name prefixes
|
446 |
-
$newTableName = $this->replaceTablePrefixes($tableName, true);
|
447 |
-
|
448 |
-
// Get table structure
|
449 |
-
$structure = $this->getConnection()->query("SHOW CREATE TABLE `$tableName`");
|
450 |
-
$table = $structure->fetch(PDO::FETCH_ASSOC);
|
451 |
-
|
452 |
-
// Close structure cursor
|
453 |
-
$structure->closeCursor();
|
454 |
-
|
455 |
-
// Get create table
|
456 |
-
if (isset($table['Create Table'])) {
|
457 |
-
|
458 |
-
// Write table drop statement
|
459 |
-
$dropTable = "DROP TABLE IF EXISTS `$newTableName`;\n";
|
460 |
-
|
461 |
-
// Write table statement
|
462 |
-
if (fwrite($fileHandler, $dropTable) === false) {
|
463 |
-
throw new Exception('Unable to write database table statement');
|
464 |
-
}
|
465 |
-
|
466 |
-
// Replace create table prefixes
|
467 |
-
$createTable = $this->replaceTablePrefixes($table['Create Table'], true);
|
468 |
-
|
469 |
-
// Strip table constraints
|
470 |
-
$createTable = $this->stripTableConstraints($createTable);
|
471 |
-
|
472 |
-
// Write table structure
|
473 |
-
if (fwrite($fileHandler, $createTable) === false) {
|
474 |
-
throw new Exception('Unable to write database table structure');
|
475 |
-
}
|
476 |
-
|
477 |
-
// Write end of statement
|
478 |
-
if (fwrite($fileHandler, ";\n\n") === false) {
|
479 |
-
throw new Exception('Unable to write database end of statement');
|
480 |
-
}
|
481 |
-
|
482 |
-
// Set query
|
483 |
-
$query = "SELECT * FROM `$tableName` ";
|
484 |
-
|
485 |
-
// Apply additional table query clauses
|
486 |
-
if (($queryClauses = $this->getTableQueryClauses($tableName))) {
|
487 |
-
$query .= $queryClauses;
|
488 |
-
}
|
489 |
-
|
490 |
-
// Apply additional table prefix columns
|
491 |
-
$columns = $this->getTablePrefixColumns($tableName);
|
492 |
-
|
493 |
-
// Get results
|
494 |
-
$result = $this->getConnection()->query($query);
|
495 |
-
|
496 |
-
$processedRows = 0;
|
497 |
-
|
498 |
-
// Generate insert statements
|
499 |
-
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
500 |
-
if ($processedRows === 0) {
|
501 |
-
// Write start transaction
|
502 |
-
if (fwrite($fileHandler, "START TRANSACTION;\n") === false) {
|
503 |
-
throw new Exception('Unable to write database start transaction');
|
504 |
-
}
|
505 |
-
}
|
506 |
-
|
507 |
-
$items = array();
|
508 |
-
foreach ($row as $key => $value) {
|
509 |
-
// Replace table prefix columns
|
510 |
-
if (isset($columns[strtolower($key)])) {
|
511 |
-
$value = $this->replaceTablePrefixes($value, true, 0);
|
512 |
-
}
|
513 |
-
|
514 |
-
// Replace table values
|
515 |
-
$items[] = is_null($value) ? 'NULL' : $this->getConnection()->quote($this->replaceTableValues($value));
|
516 |
-
}
|
517 |
-
|
518 |
-
// Set table values
|
519 |
-
$tableValues = implode(',', $items);
|
520 |
-
|
521 |
-
// Set insert statement
|
522 |
-
$tableInsert = "INSERT INTO `$newTableName` VALUES ($tableValues);\n";
|
523 |
-
|
524 |
-
// Write insert statement
|
525 |
-
if (fwrite($fileHandler, $tableInsert) === false) {
|
526 |
-
throw new Exception('Unable to write database insert statement');
|
527 |
-
}
|
528 |
-
|
529 |
-
$processedRows++;
|
530 |
-
|
531 |
-
// Write end of transaction
|
532 |
-
if ($processedRows === MysqlDumpInterface::QUERIES_PER_TRANSACTION) {
|
533 |
-
if (fwrite($fileHandler, "COMMIT;\n") === false) {
|
534 |
-
throw new Exception('Unable to write database end of transaction');
|
535 |
-
}
|
536 |
-
|
537 |
-
$processedRows = 0;
|
538 |
-
}
|
539 |
-
}
|
540 |
-
|
541 |
-
// Write end of transaction
|
542 |
-
if ($processedRows !== 0) {
|
543 |
-
if (fwrite($fileHandler, "COMMIT;\n") === false) {
|
544 |
-
throw new Exception('Unable to write database end of transaction');
|
545 |
-
}
|
546 |
-
}
|
547 |
-
|
548 |
-
// Write end of statements
|
549 |
-
if (fwrite($fileHandler, "\n") === false) {
|
550 |
-
throw new Exception('Unable to write database end of statement');
|
551 |
-
}
|
552 |
-
|
553 |
-
// Close result cursor
|
554 |
-
$result->closeCursor();
|
555 |
-
}
|
556 |
-
}
|
557 |
-
|
558 |
-
// Close file handler
|
559 |
-
fclose($fileHandler);
|
560 |
-
|
561 |
-
return true;
|
562 |
-
}
|
563 |
-
|
564 |
-
/**
|
565 |
-
* Import database from a file
|
566 |
-
*
|
567 |
-
* @param string $fileName Name of file
|
568 |
-
* @return bool
|
569 |
-
*/
|
570 |
-
public function import($fileName)
|
571 |
-
{
|
572 |
-
// Set collation name
|
573 |
-
$collation = $this->getCollation('utf8mb4_general_ci');
|
574 |
-
|
575 |
-
// Set max allowed packet
|
576 |
-
$maxAllowedPacket = $this->getMaxAllowedPacket();
|
577 |
-
|
578 |
-
// Set file handler
|
579 |
-
$fileHandler = fopen($fileName, 'r');
|
580 |
-
if ($fileHandler === false) {
|
581 |
-
throw new Exception('Unable to open database file');
|
582 |
-
}
|
583 |
-
|
584 |
-
$passed = 0;
|
585 |
-
$failed = 0;
|
586 |
-
$query = null;
|
587 |
-
|
588 |
-
// Read database file line by line
|
589 |
-
while (($line = fgets($fileHandler)) !== false) {
|
590 |
-
$query .= $line;
|
591 |
-
|
592 |
-
// End of query
|
593 |
-
if (preg_match('/;\s*$/', $query)) {
|
594 |
-
|
595 |
-
// Check max allowed packet
|
596 |
-
if (strlen($query) <= $maxAllowedPacket) {
|
597 |
-
|
598 |
-
// Replace table prefixes
|
599 |
-
$query = $this->replaceTablePrefixes($query);
|
600 |
-
|
601 |
-
// Replace table values
|
602 |
-
$query = $this->replaceTableValues($query, true);
|
603 |
-
|
604 |
-
// Replace table collation
|
605 |
-
if (empty($collation)) {
|
606 |
-
$query = $this->replaceTableCollation($query);
|
607 |
-
}
|
608 |
-
|
609 |
-
try {
|
610 |
-
// Run SQL query
|
611 |
-
$result = $this->getConnection()->query($query);
|
612 |
-
if ($result === false) {
|
613 |
-
throw new PDOException(var_export($this->getConnection()->errorinfo(), true));
|
614 |
-
} else {
|
615 |
-
$passed++;
|
616 |
-
}
|
617 |
-
|
618 |
-
} catch (PDOException $e) {
|
619 |
-
$failed++;
|
620 |
-
}
|
621 |
-
|
622 |
-
} else {
|
623 |
-
$failed++;
|
624 |
-
}
|
625 |
-
|
626 |
-
$query = null;
|
627 |
-
}
|
628 |
-
}
|
629 |
-
|
630 |
-
// Close file handler
|
631 |
-
fclose($fileHandler);
|
632 |
-
|
633 |
-
// Check failed queries
|
634 |
-
if ((($failed / $passed) * 100) > 2) {
|
635 |
-
return false;
|
636 |
-
}
|
637 |
-
|
638 |
-
return true;
|
639 |
-
}
|
640 |
-
|
641 |
-
/**
|
642 |
-
* Flush database
|
643 |
-
*
|
644 |
-
* @return void
|
645 |
-
*/
|
646 |
-
public function flush()
|
647 |
-
{
|
648 |
-
$dropTables = array();
|
649 |
-
foreach ($this->getTables() as $tableName) {
|
650 |
-
$dropTables[] = "DROP TABLE IF EXISTS `$tableName`";
|
651 |
-
}
|
652 |
-
|
653 |
-
// Drop tables
|
654 |
-
foreach ($dropTables as $dropQuery) {
|
655 |
-
$this->getConnection()->query($dropQuery);
|
656 |
-
}
|
657 |
-
}
|
658 |
-
|
659 |
-
/**
|
660 |
-
* Get MySQL version
|
661 |
-
*
|
662 |
-
* @return string
|
663 |
-
*/
|
664 |
-
protected function getVersion() {
|
665 |
-
try {
|
666 |
-
$result = $this->getConnection()->query("SELECT @@version AS VersionName");
|
667 |
-
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
668 |
-
if (isset($row['VersionName'])) {
|
669 |
-
return $row['VersionName'];
|
670 |
-
}
|
671 |
-
}
|
672 |
-
} catch (Exception $e) {
|
673 |
-
$result = $this->getConnection()->query("SHOW VARIABLES LIKE 'version'");
|
674 |
-
while ($row = $result->fetch(PDO::FETCH_NUM)) {
|
675 |
-
if (isset($row[1])) {
|
676 |
-
return $row[1];
|
677 |
-
}
|
678 |
-
}
|
679 |
-
}
|
680 |
-
}
|
681 |
-
|
682 |
-
/**
|
683 |
-
* Get MySQL max allowed packaet
|
684 |
-
*
|
685 |
-
* @return integer
|
686 |
-
*/
|
687 |
-
protected function getMaxAllowedPacket() {
|
688 |
-
try {
|
689 |
-
$result = $this->getConnection()->query("SELECT @@max_allowed_packet AS MaxAllowedPacket");
|
690 |
-
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
691 |
-
if (isset($row['MaxAllowedPacket'])) {
|
692 |
-
return $row['MaxAllowedPacket'];
|
693 |
-
}
|
694 |
-
}
|
695 |
-
} catch (Exception $e) {
|
696 |
-
$result = $this->getConnection()->query("SHOW VARIABLES LIKE 'max_allowed_packet'");
|
697 |
-
while ($row = $result->fetch(PDO::FETCH_NUM)) {
|
698 |
-
if (isset($row[1])) {
|
699 |
-
return $row[1];
|
700 |
-
}
|
701 |
-
}
|
702 |
-
}
|
703 |
-
}
|
704 |
-
|
705 |
-
/**
|
706 |
-
* Get MySQL collation name
|
707 |
-
*
|
708 |
-
* @param string $collationName Collation name
|
709 |
-
* @return string
|
710 |
-
*/
|
711 |
-
protected function getCollation($collationName) {
|
712 |
-
try {
|
713 |
-
$result = $this->getConnection()->query(
|
714 |
-
"SELECT COLLATION_NAME AS CollationName FROM `INFORMATION_SCHEMA`.`COLLATIONS` WHERE COLLATION_NAME = '$collationName'"
|
715 |
-
);
|
716 |
-
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
717 |
-
if (isset($row['CollationName'])) {
|
718 |
-
return $row['CollationName'];
|
719 |
-
}
|
720 |
-
}
|
721 |
-
} catch (Exception $e) {
|
722 |
-
$result = $this->getConnection()->query("SHOW COLLATION LIKE '$collationName'");
|
723 |
-
while ($row = $result->fetch(PDO::FETCH_NUM)) {
|
724 |
-
if (isset($row[0])) {
|
725 |
-
return $row[0];
|
726 |
-
}
|
727 |
-
}
|
728 |
-
}
|
729 |
-
}
|
730 |
-
|
731 |
-
/**
|
732 |
-
* Replace table prefixes
|
733 |
-
*
|
734 |
-
* @param string $input Table value
|
735 |
-
* @param boolean $first Replace first occurrence at any position
|
736 |
-
* @param boolean $position Replace first occurrence at a specified position
|
737 |
-
* @return string
|
738 |
-
*/
|
739 |
-
protected function replaceTablePrefixes($input, $first = false, $position = false)
|
740 |
-
{
|
741 |
-
// Get table prefixes
|
742 |
-
$search = $this->getOldTablePrefixes();
|
743 |
-
$replace = $this->getNewTablePrefixes();
|
744 |
-
|
745 |
-
// Replace table prefixes
|
746 |
-
if ($first) {
|
747 |
-
|
748 |
-
// Replace first occurance at a specified position
|
749 |
-
if ($position !== false) {
|
750 |
-
for ($i = 0; $i < count($search); $i++) {
|
751 |
-
$current = stripos($input, $search[$i]);
|
752 |
-
if ($current === $position) {
|
753 |
-
$input = substr_replace($input, $replace[$i], $current, strlen($search[$i]));
|
754 |
-
}
|
755 |
-
}
|
756 |
-
|
757 |
-
return $input;
|
758 |
-
}
|
759 |
-
|
760 |
-
// Replace first occurance at any position
|
761 |
-
for ($i = 0; $i < count($search); $i++) {
|
762 |
-
$current = stripos($input, $search[$i]);
|
763 |
-
if ($current !== $position) {
|
764 |
-
$input = substr_replace($input, $replace[$i], $current, strlen($search[$i]));
|
765 |
-
}
|
766 |
-
}
|
767 |
-
|
768 |
-
return $input;
|
769 |
-
}
|
770 |
-
|
771 |
-
// Replace all occurrences
|
772 |
-
return str_ireplace($search, $replace, $input);
|
773 |
-
}
|
774 |
-
|
775 |
-
/**
|
776 |
-
* Replace table values
|
777 |
-
*
|
778 |
-
* @param string $input Table value
|
779 |
-
* @param boolean $parse Parse value
|
780 |
-
* @return string
|
781 |
-
*/
|
782 |
-
protected function replaceTableValues($input, $parse = false)
|
783 |
-
{
|
784 |
-
// Get replace values
|
785 |
-
$old = $this->getOldReplaceValues();
|
786 |
-
$new = $this->getNewReplaceValues();
|
787 |
-
|
788 |
-
$oldValues = array();
|
789 |
-
$newValues = array();
|
790 |
-
|
791 |
-
// Prepare replace values
|
792 |
-
for ($i = 0; $i < count($old); $i++) {
|
793 |
-
if (stripos($input, $old[$i]) !== false) {
|
794 |
-
$oldValues[] = $old[$i];
|
795 |
-
$newValues[] = $new[$i];
|
796 |
-
}
|
797 |
-
}
|
798 |
-
|
799 |
-
// Do replace values
|
800 |
-
if ($oldValues) {
|
801 |
-
if ($parse) {
|
802 |
-
// Parse and replace serialized values
|
803 |
-
$input = $this->parseSerializedValues($input);
|
804 |
-
|
805 |
-
// Replace values
|
806 |
-
return MysqlDumpUtility::replaceValues($oldValues, $newValues, $input);
|
807 |
-
}
|
808 |
-
|
809 |
-
return MysqlDumpUtility::replaceSerializedValues($oldValues, $newValues, $input);
|
810 |
-
}
|
811 |
-
|
812 |
-
return $input;
|
813 |
-
}
|
814 |
-
|
815 |
-
/**
|
816 |
-
* Parse serialized values
|
817 |
-
*
|
818 |
-
* @param string $input Table value
|
819 |
-
* @return string
|
820 |
-
*/
|
821 |
-
protected function parseSerializedValues($input)
|
822 |
-
{
|
823 |
-
// Serialization format
|
824 |
-
$array = '(a:\d+:{.*?})';
|
825 |
-
$string = '(s:\d+:".*?")';
|
826 |
-
$object = '(O:\d+:".+":\d+:{.*})';
|
827 |
-
|
828 |
-
// Replace serialized values
|
829 |
-
return preg_replace_callback("/'($array|$string|$object)'/", array($this, 'replaceSerializedValues'), $input);
|
830 |
-
}
|
831 |
-
|
832 |
-
/**
|
833 |
-
* Replace serialized values (callback)
|
834 |
-
*
|
835 |
-
* @param array $matches List of matches
|
836 |
-
* @return string
|
837 |
-
*/
|
838 |
-
protected function replaceSerializedValues($matches)
|
839 |
-
{
|
840 |
-
// Unescape MySQL special characters
|
841 |
-
$input = MysqlDumpUtility::unescapeMysql($matches[1]);
|
842 |
-
|
843 |
-
// Replace serialized values
|
844 |
-
$input = MysqlDumpUtility::replaceSerializedValues($this->getOldReplaceValues(), $this->getNewReplaceValues(), $input);
|
845 |
-
|
846 |
-
// Prepare query values
|
847 |
-
return $this->getConnection()->quote($input);
|
848 |
-
}
|
849 |
-
|
850 |
-
/**
|
851 |
-
* Replace table collation
|
852 |
-
*
|
853 |
-
* @param string $input SQL statement
|
854 |
-
* @return string
|
855 |
-
*/
|
856 |
-
protected function replaceTableCollation($input)
|
857 |
-
{
|
858 |
-
return str_ireplace('utf8mb4', 'utf8', $input);
|
859 |
-
}
|
860 |
-
|
861 |
-
/**
|
862 |
-
* Strip table constraints
|
863 |
-
*
|
864 |
-
* @param string $input SQL statement
|
865 |
-
* @return string
|
866 |
-
*/
|
867 |
-
protected function stripTableConstraints($input)
|
868 |
-
{
|
869 |
-
$pattern = array(
|
870 |
-
'/\s+CONSTRAINT(.+)REFERENCES(.+),/i',
|
871 |
-
'/,\s+CONSTRAINT(.+)REFERENCES(.+)/i',
|
872 |
-
);
|
873 |
-
$replace = '';
|
874 |
-
|
875 |
-
return preg_replace($pattern, $replace, $input);
|
876 |
-
}
|
877 |
-
|
878 |
-
/**
|
879 |
-
* Make MySQL connection
|
880 |
-
*
|
881 |
-
* @param bool $useSocket Use socket or TCP connection
|
882 |
-
* @return PDO
|
883 |
-
*/
|
884 |
-
protected function makeConnection($useSocket = true)
|
885 |
-
{
|
886 |
-
// Use Socket or TCP
|
887 |
-
$hostname = ($useSocket ? $this->hostname : gethostbyname($this->hostname));
|
888 |
-
|
889 |
-
// Use default or custom port
|
890 |
-
if ($this->port === 3306 || empty($this->port)) {
|
891 |
-
$dsn = sprintf('mysql:host=%s;dbname=%s', $hostname, $this->database);
|
892 |
-
} else if (!empty($this->socket)) {
|
893 |
-
$dsn = sprintf('mysql:host=%s;unix_socket=%s;dbname=%s', $hostname, $this->socket, $this->database);
|
894 |
-
} else {
|
895 |
-
$dsn = sprintf('mysql:host=%s;port=%s;dbname=%s', $hostname, $this->port, $this->database);
|
896 |
-
}
|
897 |
-
|
898 |
-
// Make connection
|
899 |
-
$connection = new PDO(
|
900 |
-
$dsn,
|
901 |
-
$this->username,
|
902 |
-
$this->password,
|
903 |
-
array(
|
904 |
-
PDO::ATTR_PERSISTENT => true,
|
905 |
-
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
906 |
-
)
|
907 |
-
);
|
908 |
-
|
909 |
-
// Set additional connection attributes
|
910 |
-
$connection->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL);
|
911 |
-
$connection->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
|
912 |
-
|
913 |
-
// Set default encoding
|
914 |
-
$connection->exec("SET NAMES 'utf8'");
|
915 |
-
|
916 |
-
// Set foreign key
|
917 |
-
$connection->exec("SET FOREIGN_KEY_CHECKS = 0");
|
918 |
-
|
919 |
-
return $connection;
|
920 |
-
}
|
921 |
-
|
922 |
-
/**
|
923 |
-
* Returns header for dump file
|
924 |
-
*
|
925 |
-
* @return string
|
926 |
-
*/
|
927 |
-
protected function getHeader()
|
928 |
-
{
|
929 |
-
// Some info about software, source and time
|
930 |
-
$header = "-- All In One WP Migration SQL Dump\n" .
|
931 |
-
"-- http://servmask.com/\n" .
|
932 |
-
"--\n" .
|
933 |
-
"-- Host: {$this->hostname}\n" .
|
934 |
-
"-- Generation Time: " . date('r') . "\n" .
|
935 |
-
"-- PDO Extension\n\n" .
|
936 |
-
"--\n" .
|
937 |
-
"-- Database: `{$this->database}`\n" .
|
938 |
-
"--\n\n";
|
939 |
-
|
940 |
-
return $header;
|
941 |
-
}
|
942 |
-
|
943 |
-
/**
|
944 |
-
* Parse data source name
|
945 |
-
*
|
946 |
-
* @param string $input Data source name
|
947 |
-
* @return array List of host, port and socket
|
948 |
-
*/
|
949 |
-
protected function parseDSN($input) {
|
950 |
-
$data = explode(':', $input);
|
951 |
-
|
952 |
-
// Set hostname
|
953 |
-
$host = 'localhost';
|
954 |
-
if (!empty($data[0])) {
|
955 |
-
$host = $data[0];
|
956 |
-
}
|
957 |
-
|
958 |
-
// Set port and socket
|
959 |
-
$port = $socket = null;
|
960 |
-
if (!empty($data[1])) {
|
961 |
-
if (is_numeric($data[1])) {
|
962 |
-
$port = $data[1];
|
963 |
-
} else {
|
964 |
-
$socket = $data[1];
|
965 |
-
}
|
966 |
-
}
|
967 |
-
|
968 |
-
return array(
|
969 |
-
'host' => $host,
|
970 |
-
'port' => $port,
|
971 |
-
'socket' => $socket,
|
972 |
-
);
|
973 |
-
}
|
974 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/vendor/mysqldump-factory/mysqldump-factory/lib/MysqlDumpSQL.php
DELETED
@@ -1,924 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
-
*
|
6 |
-
* This program is free software: you can redistribute it and/or modify
|
7 |
-
* it under the terms of the GNU General Public License as published by
|
8 |
-
* the Free Software Foundation, either version 3 of the License, or
|
9 |
-
* (at your option) any later version.
|
10 |
-
*
|
11 |
-
* This program is distributed in the hope that it will be useful,
|
12 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
-
* GNU General Public License for more details.
|
15 |
-
*
|
16 |
-
* You should have received a copy of the GNU General Public License
|
17 |
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 |
-
*
|
19 |
-
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
20 |
-
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
21 |
-
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
22 |
-
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
23 |
-
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
-
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
-
*/
|
26 |
-
|
27 |
-
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'MysqlDumpInterface.php';
|
28 |
-
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'MysqlDumpUtility.php';
|
29 |
-
|
30 |
-
class MysqlDumpSQL implements MysqlDumpInterface
|
31 |
-
{
|
32 |
-
protected $hostname = null;
|
33 |
-
|
34 |
-
protected $username = null;
|
35 |
-
|
36 |
-
protected $password = null;
|
37 |
-
|
38 |
-
protected $database = null;
|
39 |
-
|
40 |
-
protected $connection = null;
|
41 |
-
|
42 |
-
protected $oldTablePrefixes = null;
|
43 |
-
|
44 |
-
protected $newTablePrefixes = null;
|
45 |
-
|
46 |
-
protected $oldReplaceValues = array();
|
47 |
-
|
48 |
-
protected $newReplaceValues = array();
|
49 |
-
|
50 |
-
protected $tableQueryClauses = array();
|
51 |
-
|
52 |
-
protected $tablePrefixColumns = array();
|
53 |
-
|
54 |
-
protected $includeTablePrefixes = array();
|
55 |
-
|
56 |
-
protected $excludeTablePrefixes = array();
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Define MySQL credentials for the current connection
|
60 |
-
*
|
61 |
-
* @param string $hostname MySQL Hostname
|
62 |
-
* @param string $username MySQL Username
|
63 |
-
* @param string $password MySQL Password
|
64 |
-
* @param string $database MySQL Database
|
65 |
-
* @return void
|
66 |
-
*/
|
67 |
-
public function __construct($hostname = 'localhost', $username = '', $password = '', $database = '')
|
68 |
-
{
|
69 |
-
// Set MySQL credentials
|
70 |
-
$this->hostname = $hostname;
|
71 |
-
$this->username = $username;
|
72 |
-
$this->password = $password;
|
73 |
-
$this->database = $database;
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Set old table prefixes
|
78 |
-
*
|
79 |
-
* @param array $prefixes List of table prefixes
|
80 |
-
* @return MysqlDumpSQL
|
81 |
-
*/
|
82 |
-
public function setOldTablePrefixes($prefixes)
|
83 |
-
{
|
84 |
-
$this->oldTablePrefixes = $prefixes;
|
85 |
-
|
86 |
-
return $this;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Get old table prefixes
|
91 |
-
*
|
92 |
-
* @return array
|
93 |
-
*/
|
94 |
-
public function getOldTablePrefixes()
|
95 |
-
{
|
96 |
-
return $this->oldTablePrefixes;
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Set new table prefixes
|
101 |
-
*
|
102 |
-
* @param array $prefixes List of table prefixes
|
103 |
-
* @return MysqlDumpSQL
|
104 |
-
*/
|
105 |
-
public function setNewTablePrefixes($prefixes)
|
106 |
-
{
|
107 |
-
$this->newTablePrefixes = $prefixes;
|
108 |
-
|
109 |
-
return $this;
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Get new table prefixes
|
114 |
-
*
|
115 |
-
* @return array
|
116 |
-
*/
|
117 |
-
public function getNewTablePrefixes()
|
118 |
-
{
|
119 |
-
return $this->newTablePrefixes;
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Set old replace values
|
124 |
-
*
|
125 |
-
* @param array $values List of values
|
126 |
-
* @return MysqlDumpSQL
|
127 |
-
*/
|
128 |
-
public function setOldReplaceValues($values)
|
129 |
-
{
|
130 |
-
$this->oldReplaceValues = $values;
|
131 |
-
|
132 |
-
return $this;
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Get old replace values
|
137 |
-
*
|
138 |
-
* @return array
|
139 |
-
*/
|
140 |
-
public function getOldReplaceValues()
|
141 |
-
{
|
142 |
-
return $this->oldReplaceValues;
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Set new replace values
|
147 |
-
*
|
148 |
-
* @param array $values List of values
|
149 |
-
* @return MysqlDumpSQL
|
150 |
-
*/
|
151 |
-
public function setNewReplaceValues($values)
|
152 |
-
{
|
153 |
-
$this->newReplaceValues = $values;
|
154 |
-
|
155 |
-
return $this;
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Get new replace values
|
160 |
-
*
|
161 |
-
* @return array
|
162 |
-
*/
|
163 |
-
public function getNewReplaceValues()
|
164 |
-
{
|
165 |
-
return $this->newReplaceValues;
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
* Set table query clauses
|
170 |
-
*
|
171 |
-
* @param string $table Table name
|
172 |
-
* @param array $clauses Table clauses
|
173 |
-
* @return MysqlDumpSQL
|
174 |
-
*/
|
175 |
-
public function setTableQueryClauses($table, $clauses)
|
176 |
-
{
|
177 |
-
$this->tableQueryClauses[strtolower($table)] = $clauses;
|
178 |
-
|
179 |
-
return $this;
|
180 |
-
}
|
181 |
-
/**
|
182 |
-
* Get table query clauses
|
183 |
-
*
|
184 |
-
* @param string $table Table name
|
185 |
-
* @return array
|
186 |
-
*/
|
187 |
-
public function getTableQueryClauses($table)
|
188 |
-
{
|
189 |
-
if (isset($this->tableQueryClauses[strtolower($table)])) {
|
190 |
-
return $this->tableQueryClauses[strtolower($table)];
|
191 |
-
}
|
192 |
-
|
193 |
-
return array();
|
194 |
-
}
|
195 |
-
|
196 |
-
/**
|
197 |
-
* Set table prefix columns
|
198 |
-
*
|
199 |
-
* @param string $table Table name
|
200 |
-
* @param array $columns Table columns
|
201 |
-
* @return MysqlDumpSQL
|
202 |
-
*/
|
203 |
-
public function setTablePrefixColumns($table, $columns)
|
204 |
-
{
|
205 |
-
foreach ($columns as $column) {
|
206 |
-
$this->tablePrefixColumns[strtolower($table)][strtolower($column)] = true;
|
207 |
-
}
|
208 |
-
|
209 |
-
return $this;
|
210 |
-
}
|
211 |
-
|
212 |
-
/**
|
213 |
-
* Get table prefix columns
|
214 |
-
*
|
215 |
-
* @param string $table Table name
|
216 |
-
* @return array
|
217 |
-
*/
|
218 |
-
public function getTablePrefixColumns($table)
|
219 |
-
{
|
220 |
-
if (isset($this->tablePrefixColumns[strtolower($table)])) {
|
221 |
-
return $this->tablePrefixColumns[strtolower($table)];
|
222 |
-
}
|
223 |
-
|
224 |
-
return array();
|
225 |
-
}
|
226 |
-
|
227 |
-
/**
|
228 |
-
* Set include table prefixes
|
229 |
-
*
|
230 |
-
* @param array $prefixes List of table prefixes
|
231 |
-
* @return MysqlDumpSQL
|
232 |
-
*/
|
233 |
-
public function setIncludeTablePrefixes($prefixes)
|
234 |
-
{
|
235 |
-
$this->includeTablePrefixes = $prefixes;
|
236 |
-
|
237 |
-
return $this;
|
238 |
-
}
|
239 |
-
|
240 |
-
/**
|
241 |
-
* Get include table prefixes
|
242 |
-
*
|
243 |
-
* @return array
|
244 |
-
*/
|
245 |
-
public function getIncludeTablePrefixes()
|
246 |
-
{
|
247 |
-
return $this->includeTablePrefixes;
|
248 |
-
}
|
249 |
-
|
250 |
-
/**
|
251 |
-
* Set exclude table prefixes
|
252 |
-
*
|
253 |
-
* @param array $prefixes List of table prefixes
|
254 |
-
* @return MysqlDumpSQL
|
255 |
-
*/
|
256 |
-
public function setExcludeTablePrefixes($prefixes)
|
257 |
-
{
|
258 |
-
$this->excludeTablePrefixes = $prefixes;
|
259 |
-
|
260 |
-
return $this;
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Get exclude table prefixes
|
265 |
-
*
|
266 |
-
* @return array
|
267 |
-
*/
|
268 |
-
public function getExcludeTablePrefixes()
|
269 |
-
{
|
270 |
-
return $this->excludeTablePrefixes;
|
271 |
-
}
|
272 |
-
|
273 |
-
/**
|
274 |
-
* Get tables
|
275 |
-
*
|
276 |
-
* @return array
|
277 |
-
*/
|
278 |
-
public function getTables()
|
279 |
-
{
|
280 |
-
$tables = array();
|
281 |
-
|
282 |
-
// Get list of tables
|
283 |
-
$result = mysql_unbuffered_query(
|
284 |
-
"SELECT TABLE_NAME AS TableName FROM `INFORMATION_SCHEMA`.`TABLES` WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = '{$this->database}'",
|
285 |
-
$this->getConnection()
|
286 |
-
);
|
287 |
-
|
288 |
-
if ($result) {
|
289 |
-
while ($row = mysql_fetch_assoc($result)) {
|
290 |
-
if (isset($row['TableName']) && ($tableName = $row['TableName'])) {
|
291 |
-
|
292 |
-
// Include table prefixes
|
293 |
-
if ($this->getIncludeTablePrefixes()) {
|
294 |
-
$include = false;
|
295 |
-
|
296 |
-
// Check table prefixes
|
297 |
-
foreach ($this->getIncludeTablePrefixes() as $prefix) {
|
298 |
-
if (stripos($tableName, $prefix) === 0) {
|
299 |
-
$include = true;
|
300 |
-
break;
|
301 |
-
}
|
302 |
-
}
|
303 |
-
|
304 |
-
// Skip current table
|
305 |
-
if ($include === false) {
|
306 |
-
continue;
|
307 |
-
}
|
308 |
-
}
|
309 |
-
|
310 |
-
// Exclude table prefixes
|
311 |
-
if ($this->getExcludeTablePrefixes()) {
|
312 |
-
$exclude = false;
|
313 |
-
|
314 |
-
// Check table prefixes
|
315 |
-
foreach ($this->getExcludeTablePrefixes() as $prefix) {
|
316 |
-
if (stripos($tableName, $prefix) === 0) {
|
317 |
-
$exclude = true;
|
318 |
-
break;
|
319 |
-
}
|
320 |
-
}
|
321 |
-
|
322 |
-
// Skip current table
|
323 |
-
if ($exclude === true) {
|
324 |
-
continue;
|
325 |
-
}
|
326 |
-
}
|
327 |
-
|
328 |
-
// Add table name
|
329 |
-
$tables[] = $tableName;
|
330 |
-
}
|
331 |
-
}
|
332 |
-
} else {
|
333 |
-
$result = mysql_unbuffered_query("SHOW TABLES FROM `{$this->database}`", $this->getConnection());
|
334 |
-
while ($row = mysql_fetch_row($result)) {
|
335 |
-
if (isset($row[0]) && ($tableName = $row[0])) {
|
336 |
-
|
337 |
-
// Include table prefixes
|
338 |
-
if ($this->getIncludeTablePrefixes()) {
|
339 |
-
$include = false;
|
340 |
-
|
341 |
-
// Check table prefixes
|
342 |
-
foreach ($this->getIncludeTablePrefixes() as $prefix) {
|
343 |
-
if (stripos($tableName, $prefix) === 0) {
|
344 |
-
$include = true;
|
345 |
-
break;
|
346 |
-
}
|
347 |
-
}
|
348 |
-
|
349 |
-
// Skip current table
|
350 |
-
if ($include === false) {
|
351 |
-
continue;
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
// Exclude table prefixes
|
356 |
-
if ($this->getExcludeTablePrefixes()) {
|
357 |
-
$exclude = false;
|
358 |
-
|
359 |
-
// Check table prefixes
|
360 |
-
foreach ($this->getExcludeTablePrefixes() as $prefix) {
|
361 |
-
if (stripos($tableName, $prefix) === 0) {
|
362 |
-
$exclude = true;
|
363 |
-
break;
|
364 |
-
}
|
365 |
-
}
|
366 |
-
|
367 |
-
// Skip current table
|
368 |
-
if ($exclude === true) {
|
369 |
-
continue;
|
370 |
-
}
|
371 |
-
}
|
372 |
-
|
373 |
-
// Add table name
|
374 |
-
$tables[] = $tableName;
|
375 |
-
}
|
376 |
-
}
|
377 |
-
}
|
378 |
-
|
379 |
-
return $tables;
|
380 |
-
}
|
381 |
-
|
382 |
-
/**
|
383 |
-
* Get MySQL connection (lazy loading)
|
384 |
-
*
|
385 |
-
* @return resource
|
386 |
-
*/
|
387 |
-
public function getConnection()
|
388 |
-
{
|
389 |
-
if ($this->connection === null) {
|
390 |
-
// Make connection (Socket)
|
391 |
-
$this->connection = $this->makeConnection();
|
392 |
-
|
393 |
-
if ($this->connection === false) {
|
394 |
-
// Make connection (TCP)
|
395 |
-
$this->connection = $this->makeConnection(false);
|
396 |
-
|
397 |
-
// Unable to connect to MySQL database server
|
398 |
-
if ($this->connection === false) {
|
399 |
-
throw new Exception('Unable to connect to MySQL database server: ' . mysql_error($this->connection));
|
400 |
-
}
|
401 |
-
}
|
402 |
-
}
|
403 |
-
|
404 |
-
return $this->connection;
|
405 |
-
}
|
406 |
-
|
407 |
-
/**
|
408 |
-
* Run MySQL query
|
409 |
-
*
|
410 |
-
* @param string $query SQL query
|
411 |
-
* @return resource
|
412 |
-
*/
|
413 |
-
public function query($query)
|
414 |
-
{
|
415 |
-
return mysql_unbuffered_query($query, $this->getConnection());
|
416 |
-
}
|
417 |
-
|
418 |
-
/**
|
419 |
-
* Export database into a file
|
420 |
-
*
|
421 |
-
* @param string $fileName Name of file
|
422 |
-
* @return bool
|
423 |
-
*/
|
424 |
-
public function export($fileName)
|
425 |
-
{
|
426 |
-
// Set file handler
|
427 |
-
$fileHandler = fopen($fileName, 'wb');
|
428 |
-
if ($fileHandler === false) {
|
429 |
-
throw new Exception('Unable to open database file');
|
430 |
-
}
|
431 |
-
|
432 |
-
// Write headers
|
433 |
-
if (fwrite($fileHandler, $this->getHeader()) === false) {
|
434 |
-
throw new Exception('Unable to write database header information');
|
435 |
-
}
|
436 |
-
|
437 |
-
// Export tables
|
438 |
-
foreach ($this->getTables() as $tableName) {
|
439 |
-
|
440 |
-
// Replace table name prefixes
|
441 |
-
$newTableName = $this->replaceTablePrefixes($tableName, true);
|
442 |
-
|
443 |
-
// Get table structure
|
444 |
-
$structure = mysql_unbuffered_query("SHOW CREATE TABLE `$tableName`", $this->getConnection());
|
445 |
-
$table = mysql_fetch_assoc($structure);
|
446 |
-
|
447 |
-
// Close structure cursor
|
448 |
-
mysql_free_result($structure);
|
449 |
-
|
450 |
-
// Get create table
|
451 |
-
if (isset($table['Create Table'])) {
|
452 |
-
|
453 |
-
// Write table drop statement
|
454 |
-
$dropTable = "DROP TABLE IF EXISTS `$newTableName`;\n";
|
455 |
-
|
456 |
-
// Write table statement
|
457 |
-
if (fwrite($fileHandler, $dropTable) === false) {
|
458 |
-
throw new Exception('Unable to write database table statement');
|
459 |
-
}
|
460 |
-
|
461 |
-
// Replace create table prefixes
|
462 |
-
$createTable = $this->replaceTablePrefixes($table['Create Table'], true);
|
463 |
-
|
464 |
-
// Strip table constraints
|
465 |
-
$createTable = $this->stripTableConstraints($createTable);
|
466 |
-
|
467 |
-
// Write table structure
|
468 |
-
if (fwrite($fileHandler, $createTable) === false) {
|
469 |
-
throw new Exception('Unable to write database table structure');
|
470 |
-
}
|
471 |
-
|
472 |
-
// Write end of statement
|
473 |
-
if (fwrite($fileHandler, ";\n\n") === false) {
|
474 |
-
throw new Exception('Unable to write database end of statement');
|
475 |
-
}
|
476 |
-
|
477 |
-
// Set query
|
478 |
-
$query = "SELECT * FROM `$tableName` ";
|
479 |
-
|
480 |
-
// Apply additional table query clauses
|
481 |
-
if (($queryClauses = $this->getTableQueryClauses($tableName))) {
|
482 |
-
$query .= $queryClauses;
|
483 |
-
}
|
484 |
-
|
485 |
-
// Apply additional table prefix columns
|
486 |
-
$columns = $this->getTablePrefixColumns($tableName);
|
487 |
-
|
488 |
-
// Get results
|
489 |
-
$result = mysql_unbuffered_query($query, $this->getConnection());
|
490 |
-
|
491 |
-
$processedRows = 0;
|
492 |
-
|
493 |
-
// Generate insert statements
|
494 |
-
while ($row = mysql_fetch_assoc($result)) {
|
495 |
-
if ($processedRows === 0) {
|
496 |
-
// Write start transaction
|
497 |
-
if (fwrite($fileHandler, "START TRANSACTION;\n") === false) {
|
498 |
-
throw new Exception('Unable to write database start transaction');
|
499 |
-
}
|
500 |
-
}
|
501 |
-
|
502 |
-
$items = array();
|
503 |
-
foreach ($row as $key => $value) {
|
504 |
-
// Replace table prefix columns
|
505 |
-
if (isset($columns[strtolower($key)])) {
|
506 |
-
$value = $this->replaceTablePrefixes($value, true, 0);
|
507 |
-
}
|
508 |
-
|
509 |
-
// Replace table values
|
510 |
-
$items[] = is_null($value) ? 'NULL' : "'" . mysql_real_escape_string($this->replaceTableValues($value), $this->getConnection()) . "'";
|
511 |
-
}
|
512 |
-
|
513 |
-
// Set table values
|
514 |
-
$tableValues = implode(',', $items);
|
515 |
-
|
516 |
-
// Set insert statement
|
517 |
-
$tableInsert = "INSERT INTO `$newTableName` VALUES ($tableValues);\n";
|
518 |
-
|
519 |
-
// Write insert statement
|
520 |
-
if (fwrite($fileHandler, $tableInsert) === false) {
|
521 |
-
throw new Exception('Unable to write database insert statement');
|
522 |
-
}
|
523 |
-
|
524 |
-
$processedRows++;
|
525 |
-
|
526 |
-
// Write end of transaction
|
527 |
-
if ($processedRows === MysqlDumpInterface::QUERIES_PER_TRANSACTION) {
|
528 |
-
if (fwrite($fileHandler, "COMMIT;\n") === false) {
|
529 |
-
throw new Exception('Unable to write database end of transaction');
|
530 |
-
}
|
531 |
-
|
532 |
-
$processedRows = 0;
|
533 |
-
}
|
534 |
-
}
|
535 |
-
|
536 |
-
// Write end of transaction
|
537 |
-
if ($processedRows !== 0) {
|
538 |
-
if (fwrite($fileHandler, "COMMIT;\n") === false) {
|
539 |
-
throw new Exception('Unable to write database end of transaction');
|
540 |
-
}
|
541 |
-
}
|
542 |
-
|
543 |
-
// Write end of statements
|
544 |
-
if (fwrite($fileHandler, "\n") === false) {
|
545 |
-
throw new Exception('Unable to write database end of statement');
|
546 |
-
}
|
547 |
-
|
548 |
-
// Close result cursor
|
549 |
-
mysql_free_result($result);
|
550 |
-
}
|
551 |
-
}
|
552 |
-
|
553 |
-
// Close file handler
|
554 |
-
fclose($fileHandler);
|
555 |
-
|
556 |
-
return true;
|
557 |
-
}
|
558 |
-
|
559 |
-
/**
|
560 |
-
* Import database from a file
|
561 |
-
*
|
562 |
-
* @param string $fileName Name of file
|
563 |
-
* @return bool
|
564 |
-
*/
|
565 |
-
public function import($fileName)
|
566 |
-
{
|
567 |
-
// Set collation name
|
568 |
-
$collation = $this->getCollation('utf8mb4_general_ci');
|
569 |
-
|
570 |
-
// Set max allowed packet
|
571 |
-
$maxAllowedPacket = $this->getMaxAllowedPacket();
|
572 |
-
|
573 |
-
// Set file handler
|
574 |
-
$fileHandler = fopen($fileName, 'r');
|
575 |
-
if ($fileHandler === false) {
|
576 |
-
throw new Exception('Unable to open database file');
|
577 |
-
}
|
578 |
-
|
579 |
-
$passed = 0;
|
580 |
-
$failed = 0;
|
581 |
-
$query = null;
|
582 |
-
|
583 |
-
// Read database file line by line
|
584 |
-
while (($line = fgets($fileHandler)) !== false) {
|
585 |
-
$query .= $line;
|
586 |
-
|
587 |
-
// End of query
|
588 |
-
if (preg_match('/;\s*$/', $query)) {
|
589 |
-
|
590 |
-
// Check max allowed packet
|
591 |
-
if (strlen($query) <= $maxAllowedPacket) {
|
592 |
-
|
593 |
-
// Replace table prefixes
|
594 |
-
$query = $this->replaceTablePrefixes($query);
|
595 |
-
|
596 |
-
// Replace table values
|
597 |
-
$query = $this->replaceTableValues($query, true);
|
598 |
-
|
599 |
-
// Replace table collation
|
600 |
-
if (empty($collation)) {
|
601 |
-
$query = $this->replaceTableCollation($query);
|
602 |
-
}
|
603 |
-
|
604 |
-
try {
|
605 |
-
// Run SQL query
|
606 |
-
$result = mysql_unbuffered_query($query, $this->getConnection());
|
607 |
-
if ($result === false) {
|
608 |
-
throw new Exception(var_export(array(mysql_errno($this->getConnection()), mysql_error($this->getConnection()))));
|
609 |
-
} else {
|
610 |
-
$passed++;
|
611 |
-
}
|
612 |
-
|
613 |
-
} catch (Exception $e) {
|
614 |
-
$failed++;
|
615 |
-
}
|
616 |
-
|
617 |
-
} else {
|
618 |
-
$failed++;
|
619 |
-
}
|
620 |
-
|
621 |
-
$query = null;
|
622 |
-
}
|
623 |
-
}
|
624 |
-
|
625 |
-
// Close file handler
|
626 |
-
fclose($fileHandler);
|
627 |
-
|
628 |
-
// Check failed queries
|
629 |
-
if ((($failed / $passed) * 100) > 2) {
|
630 |
-
return false;
|
631 |
-
}
|
632 |
-
|
633 |
-
return true;
|
634 |
-
}
|
635 |
-
|
636 |
-
/**
|
637 |
-
* Flush database
|
638 |
-
*
|
639 |
-
* @return void
|
640 |
-
*/
|
641 |
-
public function flush()
|
642 |
-
{
|
643 |
-
$dropTables = array();
|
644 |
-
foreach ($this->getTables() as $tableName) {
|
645 |
-
$dropTables[] = "DROP TABLE IF EXISTS `$tableName`";
|
646 |
-
}
|
647 |
-
|
648 |
-
// Drop tables
|
649 |
-
foreach ($dropTables as $dropQuery) {
|
650 |
-
mysql_unbuffered_query($dropQuery, $this->getConnection());
|
651 |
-
}
|
652 |
-
}
|
653 |
-
|
654 |
-
/**
|
655 |
-
* Get MySQL version
|
656 |
-
*
|
657 |
-
* @return string
|
658 |
-
*/
|
659 |
-
protected function getVersion() {
|
660 |
-
if (($result = mysql_unbuffered_query("SELECT @@version AS VersionName", $this->getConnection()))) {
|
661 |
-
while ($row = mysql_fetch_assoc($result)) {
|
662 |
-
if (isset($row['VersionName'])) {
|
663 |
-
return $row['VersionName'];
|
664 |
-
}
|
665 |
-
}
|
666 |
-
} else {
|
667 |
-
$result = mysql_unbuffered_query("SHOW VARIABLES LIKE 'version'", $this->getConnection());
|
668 |
-
while ($row = mysql_fetch_row($result)) {
|
669 |
-
if (isset($row[1])) {
|
670 |
-
return $row[1];
|
671 |
-
}
|
672 |
-
}
|
673 |
-
}
|
674 |
-
}
|
675 |
-
|
676 |
-
/**
|
677 |
-
* Get MySQL max allowed packaet
|
678 |
-
*
|
679 |
-
* @return integer
|
680 |
-
*/
|
681 |
-
protected function getMaxAllowedPacket() {
|
682 |
-
if (($result = mysql_unbuffered_query("SELECT @@max_allowed_packet AS MaxAllowedPacket", $this->getConnection()))) {
|
683 |
-
while ($row = mysql_fetch_assoc($result)) {
|
684 |
-
if (isset($row['MaxAllowedPacket'])) {
|
685 |
-
return $row['MaxAllowedPacket'];
|
686 |
-
}
|
687 |
-
}
|
688 |
-
} else {
|
689 |
-
$result = mysql_unbuffered_query("SHOW VARIABLES LIKE 'max_allowed_packet'", $this->getConnection());
|
690 |
-
while ($row = mysql_fetch_row($result)) {
|
691 |
-
if (isset($row[1])) {
|
692 |
-
return $row[1];
|
693 |
-
}
|
694 |
-
}
|
695 |
-
}
|
696 |
-
}
|
697 |
-
|
698 |
-
/**
|
699 |
-
* Get MySQL collation name
|
700 |
-
*
|
701 |
-
* @param string $collationName Collation name
|
702 |
-
* @return string
|
703 |
-
*/
|
704 |
-
protected function getCollation($collationName) {
|
705 |
-
// Get collation name
|
706 |
-
$result = mysql_unbuffered_query(
|
707 |
-
"SELECT COLLATION_NAME AS CollationName FROM `INFORMATION_SCHEMA`.`COLLATIONS` WHERE COLLATION_NAME = '$collationName'",
|
708 |
-
$this->getConnection()
|
709 |
-
);
|
710 |
-
|
711 |
-
if ($result) {
|
712 |
-
while ($row = mysql_fetch_assoc($result)) {
|
713 |
-
if (isset($row['CollationName'])) {
|
714 |
-
return $row['CollationName'];
|
715 |
-
}
|
716 |
-
}
|
717 |
-
} else {
|
718 |
-
$result = mysql_unbuffered_query("SHOW COLLATION LIKE '$collationName'", $this->getConnection());
|
719 |
-
while ($row = mysql_fetch_row($result)) {
|
720 |
-
if (isset($row[0])) {
|
721 |
-
return $row[0];
|
722 |
-
}
|
723 |
-
}
|
724 |
-
}
|
725 |
-
}
|
726 |
-
|
727 |
-
/**
|
728 |
-
* Replace table prefixes
|
729 |
-
*
|
730 |
-
* @param string $input Table value
|
731 |
-
* @param boolean $first Replace first occurrence at any position
|
732 |
-
* @param boolean $position Replace first occurrence at a specified position
|
733 |
-
* @return string
|
734 |
-
*/
|
735 |
-
protected function replaceTablePrefixes($input, $first = false, $position = false)
|
736 |
-
{
|
737 |
-
// Get table prefixes
|
738 |
-
$search = $this->getOldTablePrefixes();
|
739 |
-
$replace = $this->getNewTablePrefixes();
|
740 |
-
|
741 |
-
// Replace table prefixes
|
742 |
-
if ($first) {
|
743 |
-
|
744 |
-
// Replace first occurance at a specified position
|
745 |
-
if ($position !== false) {
|
746 |
-
for ($i = 0; $i < count($search); $i++) {
|
747 |
-
$current = stripos($input, $search[$i]);
|
748 |
-
if ($current === $position) {
|
749 |
-
$input = substr_replace($input, $replace[$i], $current, strlen($search[$i]));
|
750 |
-
}
|
751 |
-
}
|
752 |
-
|
753 |
-
return $input;
|
754 |
-
}
|
755 |
-
|
756 |
-
// Replace first occurance at any position
|
757 |
-
for ($i = 0; $i < count($search); $i++) {
|
758 |
-
$current = stripos($input, $search[$i]);
|
759 |
-
if ($current !== $position) {
|
760 |
-
$input = substr_replace($input, $replace[$i], $current, strlen($search[$i]));
|
761 |
-
}
|
762 |
-
}
|
763 |
-
|
764 |
-
return $input;
|
765 |
-
}
|
766 |
-
|
767 |
-
// Replace all occurrences
|
768 |
-
return str_ireplace($search, $replace, $input);
|
769 |
-
}
|
770 |
-
|
771 |
-
/**
|
772 |
-
* Replace table values
|
773 |
-
*
|
774 |
-
* @param string $input Table value
|
775 |
-
* @param boolean $parse Parse value
|
776 |
-
* @return string
|
777 |
-
*/
|
778 |
-
protected function replaceTableValues($input, $parse = false)
|
779 |
-
{
|
780 |
-
// Get replace values
|
781 |
-
$old = $this->getOldReplaceValues();
|
782 |
-
$new = $this->getNewReplaceValues();
|
783 |
-
|
784 |
-
$oldValues = array();
|
785 |
-
$newValues = array();
|
786 |
-
|
787 |
-
// Prepare replace values
|
788 |
-
for ($i = 0; $i < count($old); $i++) {
|
789 |
-
if (stripos($input, $old[$i]) !== false) {
|
790 |
-
$oldValues[] = $old[$i];
|
791 |
-
$newValues[] = $new[$i];
|
792 |
-
}
|
793 |
-
}
|
794 |
-
|
795 |
-
// Do replace values
|
796 |
-
if ($oldValues) {
|
797 |
-
if ($parse) {
|
798 |
-
// Parse and replace serialized values
|
799 |
-
$input = $this->parseSerializedValues($input);
|
800 |
-
|
801 |
-
// Replace values
|
802 |
-
return MysqlDumpUtility::replaceValues($oldValues, $newValues, $input);
|
803 |
-
}
|
804 |
-
|
805 |
-
return MysqlDumpUtility::replaceSerializedValues($oldValues, $newValues, $input);
|
806 |
-
}
|
807 |
-
|
808 |
-
return $input;
|
809 |
-
}
|
810 |
-
|
811 |
-
/**
|
812 |
-
* Parse serialized values
|
813 |
-
*
|
814 |
-
* @param string $input Table value
|
815 |
-
* @return string
|
816 |
-
*/
|
817 |
-
protected function parseSerializedValues($input)
|
818 |
-
{
|
819 |
-
// Serialization format
|
820 |
-
$array = '(a:\d+:{.*?})';
|
821 |
-
$string = '(s:\d+:".*?")';
|
822 |
-
$object = '(O:\d+:".+":\d+:{.*})';
|
823 |
-
|
824 |
-
// Replace serialized values
|
825 |
-
return preg_replace_callback("/'($array|$string|$object)'/", array($this, 'replaceSerializedValues'), $input);
|
826 |
-
}
|
827 |
-
|
828 |
-
/**
|
829 |
-
* Replace serialized values (callback)
|
830 |
-
*
|
831 |
-
* @param array $matches List of matches
|
832 |
-
* @return string
|
833 |
-
*/
|
834 |
-
protected function replaceSerializedValues($matches)
|
835 |
-
{
|
836 |
-
// Unescape MySQL special characters
|
837 |
-
$input = MysqlDumpUtility::unescapeMysql($matches[1]);
|
838 |
-
|
839 |
-
// Replace serialized values
|
840 |
-
$input = MysqlDumpUtility::replaceSerializedValues($this->getOldReplaceValues(), $this->getNewReplaceValues(), $input);
|
841 |
-
|
842 |
-
// Prepare query values
|
843 |
-
return "'" . mysql_real_escape_string($input, $this->getConnection()) . "'";
|
844 |
-
}
|
845 |
-
|
846 |
-
/**
|
847 |
-
* Replace table collation
|
848 |
-
*
|
849 |
-
* @param string $input SQL statement
|
850 |
-
* @return string
|
851 |
-
*/
|
852 |
-
protected function replaceTableCollation($input)
|
853 |
-
{
|
854 |
-
return str_ireplace('utf8mb4', 'utf8', $input);
|
855 |
-
}
|
856 |
-
|
857 |
-
/**
|
858 |
-
* Strip table constraints
|
859 |
-
*
|
860 |
-
* @param string $input SQL statement
|
861 |
-
* @return string
|
862 |
-
*/
|
863 |
-
protected function stripTableConstraints($input)
|
864 |
-
{
|
865 |
-
$pattern = array(
|
866 |
-
'/\s+CONSTRAINT(.+)REFERENCES(.+),/i',
|
867 |
-
'/,\s+CONSTRAINT(.+)REFERENCES(.+)/i',
|
868 |
-
);
|
869 |
-
$replace = '';
|
870 |
-
|
871 |
-
return preg_replace($pattern, $replace, $input);
|
872 |
-
}
|
873 |
-
|
874 |
-
/**
|
875 |
-
* Make MySQL connection
|
876 |
-
*
|
877 |
-
* @param bool $useSocket Use socket or TCP connection
|
878 |
-
* @return resource
|
879 |
-
*/
|
880 |
-
protected function makeConnection($useSocket = true)
|
881 |
-
{
|
882 |
-
// Use Socket or TCP
|
883 |
-
$hostname = ($useSocket ? $this->hostname : gethostbyname($this->hostname));
|
884 |
-
|
885 |
-
// Make connection
|
886 |
-
$connection = @mysql_pconnect($hostname, $this->username, $this->password);
|
887 |
-
|
888 |
-
// Select database and set default encoding
|
889 |
-
if ($connection) {
|
890 |
-
if (mysql_select_db($this->database, $connection)) {
|
891 |
-
// Set default encoding
|
892 |
-
mysql_unbuffered_query("SET NAMES 'utf8'", $connection);
|
893 |
-
|
894 |
-
// Set foreign key
|
895 |
-
mysql_unbuffered_query("SET FOREIGN_KEY_CHECKS = 0", $connection);
|
896 |
-
} else {
|
897 |
-
throw new Exception('Could not select MySQL database: ' . mysql_error($connection));
|
898 |
-
}
|
899 |
-
}
|
900 |
-
|
901 |
-
return $connection;
|
902 |
-
}
|
903 |
-
|
904 |
-
/**
|
905 |
-
* Returns header for dump file
|
906 |
-
*
|
907 |
-
* @return string
|
908 |
-
*/
|
909 |
-
protected function getHeader()
|
910 |
-
{
|
911 |
-
// Some info about software, source and time
|
912 |
-
$header = "-- All In One WP Migration SQL Dump\n" .
|
913 |
-
"-- http://servmask.com/\n" .
|
914 |
-
"--\n" .
|
915 |
-
"-- Host: {$this->hostname}\n" .
|
916 |
-
"-- Generation Time: " . date('r') . "\n" .
|
917 |
-
"-- MySQL Extension\n\n" .
|
918 |
-
"--\n" .
|
919 |
-
"-- Database: `{$this->database}`\n" .
|
920 |
-
"--\n\n";
|
921 |
-
|
922 |
-
return $header;
|
923 |
-
}
|
924 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/vendor/servmask/archiver/class-ai1wm-archiver.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,7 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
|
|
26 |
abstract class Ai1wm_Archiver {
|
27 |
|
28 |
/**
|
@@ -227,5 +227,4 @@ abstract class Ai1wm_Archiver {
|
|
227 |
throw new Ai1wm_Not_Accesible_Exception( sprintf( __( 'Unable to close %s', AI1WM_PLUGIN_NAME ), $this->filename ) );
|
228 |
}
|
229 |
}
|
230 |
-
|
231 |
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
+
|
26 |
abstract class Ai1wm_Archiver {
|
27 |
|
28 |
/**
|
227 |
throw new Ai1wm_Not_Accesible_Exception( sprintf( __( 'Unable to close %s', AI1WM_PLUGIN_NAME ), $this->filename ) );
|
228 |
}
|
229 |
}
|
|
|
230 |
}
|
lib/vendor/servmask/archiver/class-ai1wm-compressor.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,7 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
|
|
26 |
class Ai1wm_Compressor extends Ai1wm_Archiver {
|
27 |
|
28 |
/**
|
@@ -38,7 +38,7 @@ class Ai1wm_Compressor extends Ai1wm_Archiver {
|
|
38 |
/**
|
39 |
* Add a file to the archive
|
40 |
*
|
41 |
-
* @param string $file File to
|
42 |
* @param string $new_filename Write the file with a different name
|
43 |
* @param int $offset File offset
|
44 |
* @param int $timeout Process timeout
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
+
|
26 |
class Ai1wm_Compressor extends Ai1wm_Archiver {
|
27 |
|
28 |
/**
|
38 |
/**
|
39 |
* Add a file to the archive
|
40 |
*
|
41 |
+
* @param string $file File to add to the archive
|
42 |
* @param string $new_filename Write the file with a different name
|
43 |
* @param int $offset File offset
|
44 |
* @param int $timeout Process timeout
|
lib/vendor/servmask/archiver/class-ai1wm-extractor.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,7 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
|
|
26 |
class Ai1wm_Extractor extends Ai1wm_Archiver {
|
27 |
|
28 |
/**
|
@@ -75,7 +75,7 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
|
|
75 |
return $files_found;
|
76 |
}
|
77 |
|
78 |
-
public function extract_one_file_to( $location, $exclude = array(), $offset = 0, $timeout = 0 ) {
|
79 |
if ( false === file_exists( $location ) ) {
|
80 |
throw new Ai1wm_Not_Readable_Exception( sprintf( __( '%s doesn\'t exist', AI1WM_PLUGIN_NAME ), $location ) );
|
81 |
}
|
@@ -109,6 +109,14 @@ class Ai1wm_Extractor extends Ai1wm_Archiver {
|
|
109 |
// we need to build the path for the file
|
110 |
$path = str_replace( '/', DIRECTORY_SEPARATOR, $data['path'] );
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
// append prepend extract location
|
113 |
$path = $location . DIRECTORY_SEPARATOR . $path;
|
114 |
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
+
|
26 |
class Ai1wm_Extractor extends Ai1wm_Archiver {
|
27 |
|
28 |
/**
|
75 |
return $files_found;
|
76 |
}
|
77 |
|
78 |
+
public function extract_one_file_to( $location, $exclude = array(), $old_paths = array(), $new_paths = array(), $offset = 0, $timeout = 0 ) {
|
79 |
if ( false === file_exists( $location ) ) {
|
80 |
throw new Ai1wm_Not_Readable_Exception( sprintf( __( '%s doesn\'t exist', AI1WM_PLUGIN_NAME ), $location ) );
|
81 |
}
|
109 |
// we need to build the path for the file
|
110 |
$path = str_replace( '/', DIRECTORY_SEPARATOR, $data['path'] );
|
111 |
|
112 |
+
// replace extract paths
|
113 |
+
for ( $i = 0; $i < count( $old_paths ); $i++ ) {
|
114 |
+
if ( strpos( $path . DIRECTORY_SEPARATOR, $old_paths[$i] . DIRECTORY_SEPARATOR ) === 0 ) {
|
115 |
+
$path = substr_replace( $path, $new_paths[$i], 0, strlen( $old_paths[$i] ) );
|
116 |
+
break;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
// append prepend extract location
|
121 |
$path = $location . DIRECTORY_SEPARATOR . $path;
|
122 |
|
lib/vendor/servmask/cron/class-ai1wm-cron.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,7 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
|
|
26 |
class Ai1wm_Cron {
|
27 |
|
28 |
/*
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
+
|
26 |
class Ai1wm_Cron {
|
27 |
|
28 |
/*
|
lib/{model/class-ai1wm-maintenance.php → vendor/servmask/database/class-ai1wm-database-mysql.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,46 +23,73 @@
|
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
-
class
|
27 |
|
28 |
/**
|
29 |
-
*
|
30 |
*
|
31 |
-
* @
|
|
|
32 |
*/
|
33 |
-
public
|
34 |
-
return
|
35 |
}
|
36 |
|
37 |
/**
|
38 |
-
*
|
39 |
*
|
40 |
-
* @
|
|
|
41 |
*/
|
42 |
-
public
|
43 |
-
return
|
44 |
}
|
45 |
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
-
*
|
52 |
*
|
53 |
-
* @
|
|
|
54 |
*/
|
55 |
-
public
|
56 |
-
|
57 |
-
$title = __( 'Maintenance Mode', AI1WM_PLUGIN_NAME );
|
58 |
-
$body = sprintf(
|
59 |
-
'<h1>%s</h1><p>%s<br /><strong>%s%s</strong></p>',
|
60 |
-
__( 'Website Under Maintenance', AI1WM_PLUGIN_NAME ),
|
61 |
-
__( 'Hi, our Website is currently undergoing scheduled maintenance', AI1WM_PLUGIN_NAME ),
|
62 |
-
__( 'Please check back very soon. ', AI1WM_PLUGIN_NAME ),
|
63 |
-
__( 'Sorry for the inconvenience!', AI1WM_PLUGIN_NAME )
|
64 |
-
);
|
65 |
-
wp_die( $body, $title );
|
66 |
-
}
|
67 |
}
|
68 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Database_Mysql extends Ai1wm_Database {
|
27 |
|
28 |
/**
|
29 |
+
* Run MySQL query
|
30 |
*
|
31 |
+
* @param string $input SQL query
|
32 |
+
* @return resource
|
33 |
*/
|
34 |
+
public function query( $input ) {
|
35 |
+
return mysql_unbuffered_query( $input, $this->wpdb->dbh );
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
+
* Escape string input for mysql query
|
40 |
*
|
41 |
+
* @param string $input String to escape
|
42 |
+
* @return string
|
43 |
*/
|
44 |
+
public function quote( $input ) {
|
45 |
+
return "'" . mysql_real_escape_string( $input, $this->wpdb->dbh ) . "'";
|
46 |
}
|
47 |
|
48 |
+
/**
|
49 |
+
* Returns the error code for the most recent function call
|
50 |
+
*
|
51 |
+
* @return int
|
52 |
+
*/
|
53 |
+
public function errno() {
|
54 |
+
return mysql_errno( $this->wpdb->dbh );
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Returns a string description of the last error
|
59 |
+
*
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function error() {
|
63 |
+
return mysql_error( $this->wpdb->dbh );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Return the result from MySQL query as associative array
|
68 |
+
*
|
69 |
+
* @param resource $result MySQL resource
|
70 |
+
* @return array
|
71 |
+
*/
|
72 |
+
public function fetch_assoc( $result ) {
|
73 |
+
return mysql_fetch_assoc( $result );
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Return the result from MySQL query as row
|
78 |
+
*
|
79 |
+
* @param resource $result MySQL resource
|
80 |
+
* @return array
|
81 |
+
*/
|
82 |
+
public function fetch_row( $result ) {
|
83 |
+
return mysql_fetch_row( $result );
|
84 |
}
|
85 |
|
86 |
/**
|
87 |
+
* Free MySQL result memory
|
88 |
*
|
89 |
+
* @param resource $result MySQL resource
|
90 |
+
* @return bool
|
91 |
*/
|
92 |
+
public function free_result( $result ) {
|
93 |
+
return mysql_free_result( $result );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
+
}
|
lib/{model/class-ai1wm-error.php → vendor/servmask/database/class-ai1wm-database-mysqli.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,63 +23,73 @@
|
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
-
class
|
27 |
-
|
28 |
-
const ERROR_LIMIT = 10;
|
29 |
-
const EXCEPTION_LIMIT = 10;
|
30 |
|
31 |
/**
|
32 |
-
*
|
33 |
*
|
34 |
-
* @param
|
35 |
-
* @
|
36 |
-
* @param string $file Error File
|
37 |
-
* @param integer $line Error Line
|
38 |
-
* @return void
|
39 |
*/
|
40 |
-
public
|
41 |
-
|
42 |
-
|
43 |
-
// Limit errors
|
44 |
-
if ( count( $errors ) > self::ERROR_LIMIT ) {
|
45 |
-
array_shift( $errors );
|
46 |
-
}
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
);
|
|
|
56 |
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
-
*
|
62 |
*
|
63 |
-
* @
|
64 |
-
* @return void
|
65 |
*/
|
66 |
-
public
|
67 |
-
|
|
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
);
|
|
|
82 |
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Database_Mysqli extends Ai1wm_Database {
|
|
|
|
|
|
|
27 |
|
28 |
/**
|
29 |
+
* Run MySQL query
|
30 |
*
|
31 |
+
* @param string $input SQL query
|
32 |
+
* @return resource
|
|
|
|
|
|
|
33 |
*/
|
34 |
+
public function query( $input ) {
|
35 |
+
return mysqli_query( $this->wpdb->dbh, $input, MYSQLI_USE_RESULT );
|
36 |
+
}
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
/**
|
39 |
+
* Escape string input for mysql query
|
40 |
+
*
|
41 |
+
* @param string $input String to escape
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
public function quote( $input ) {
|
45 |
+
return "'" . mysqli_real_escape_string( $this->wpdb->dbh, $input ) . "'";
|
46 |
+
}
|
47 |
|
48 |
+
/**
|
49 |
+
* Returns the error code for the most recent function call
|
50 |
+
*
|
51 |
+
* @return int
|
52 |
+
*/
|
53 |
+
public function errno() {
|
54 |
+
return mysqli_errno( $this->wpdb->dbh );
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
+
* Returns a string description of the last error
|
59 |
*
|
60 |
+
* @return string
|
|
|
61 |
*/
|
62 |
+
public function error() {
|
63 |
+
return mysqli_error( $this->wpdb->dbh );
|
64 |
+
}
|
65 |
|
66 |
+
/**
|
67 |
+
* Return the result from MySQL query as associative array
|
68 |
+
*
|
69 |
+
* @param resource $result MySQL resource
|
70 |
+
* @return array
|
71 |
+
*/
|
72 |
+
public function fetch_assoc( $result ) {
|
73 |
+
return mysqli_fetch_assoc( $result );
|
74 |
+
}
|
75 |
|
76 |
+
/**
|
77 |
+
* Return the result from MySQL query as row
|
78 |
+
*
|
79 |
+
* @param resource $result MySQL resource
|
80 |
+
* @return array
|
81 |
+
*/
|
82 |
+
public function fetch_row( $result ) {
|
83 |
+
return mysqli_fetch_row( $result );
|
84 |
+
}
|
85 |
|
86 |
+
/**
|
87 |
+
* Free MySQL result memory
|
88 |
+
*
|
89 |
+
* @param resource $result MySQL resource
|
90 |
+
* @return bool
|
91 |
+
*/
|
92 |
+
public function free_result( $result ) {
|
93 |
+
return mysqli_free_result( $result );
|
94 |
}
|
95 |
+
}
|
lib/vendor/{mysqldump-factory/mysqldump-factory/lib/MysqlDumpUtility.php → servmask/database/class-ai1wm-database-utility.php}
RENAMED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -24,8 +23,8 @@
|
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
26 |
|
27 |
-
class
|
28 |
-
|
29 |
/**
|
30 |
* Replace all occurrences of the search string with the replacement string.
|
31 |
* This function is case-sensitive.
|
@@ -35,9 +34,8 @@ class MysqlDumpUtility
|
|
35 |
* @param string $data Data to replace.
|
36 |
* @return mixed The original string with all elements replaced as needed.
|
37 |
*/
|
38 |
-
public static function
|
39 |
-
|
40 |
-
return str_ireplace($from, $to, $data);
|
41 |
}
|
42 |
|
43 |
/**
|
@@ -51,41 +49,42 @@ class MysqlDumpUtility
|
|
51 |
* @param bool $serialized Does the array passed via $data need serializing.
|
52 |
* @return mixed The original array with all elements replaced as needed.
|
53 |
*/
|
54 |
-
public static function
|
55 |
-
{
|
56 |
-
// Some unserialized data cannot be re-serialized eg. SimpleXMLElements
|
57 |
try {
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
$tmp
|
65 |
-
|
|
|
|
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
81 |
}
|
82 |
-
}
|
83 |
|
84 |
-
|
85 |
-
|
|
|
86 |
}
|
87 |
|
88 |
-
} catch (Exception $e) {
|
89 |
// pass
|
90 |
}
|
91 |
|
@@ -98,10 +97,10 @@ class MysqlDumpUtility
|
|
98 |
* @param string $data Data to replace.
|
99 |
* @return string
|
100 |
*/
|
101 |
-
public static function
|
102 |
return str_ireplace(
|
103 |
-
array('\\\\', '\\0', "\\n", "\\r", '\Z', "\'", '\"'),
|
104 |
-
array('\\', '\0', "\n", "\r", "\x1a", "'", '"'),
|
105 |
$data
|
106 |
);
|
107 |
}
|
@@ -111,7 +110,7 @@ class MysqlDumpUtility
|
|
111 |
* @param string $data Data to replace.
|
112 |
* @return string
|
113 |
*/
|
114 |
-
public static function
|
115 |
-
return str_ireplace('\"', '"', $data);
|
116 |
}
|
117 |
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
|
26 |
+
class Ai1wm_Database_Utility {
|
27 |
+
|
28 |
/**
|
29 |
* Replace all occurrences of the search string with the replacement string.
|
30 |
* This function is case-sensitive.
|
34 |
* @param string $data Data to replace.
|
35 |
* @return mixed The original string with all elements replaced as needed.
|
36 |
*/
|
37 |
+
public static function replace_values( $from = array(), $to = array(), $data = '' ) {
|
38 |
+
return str_ireplace( $from, $to, $data );
|
|
|
39 |
}
|
40 |
|
41 |
/**
|
49 |
* @param bool $serialized Does the array passed via $data need serializing.
|
50 |
* @return mixed The original array with all elements replaced as needed.
|
51 |
*/
|
52 |
+
public static function replace_serialized_values( $from = array(), $to = array(), $data = '', $serialized = false ) {
|
|
|
|
|
53 |
try {
|
54 |
|
55 |
+
// Some unserialized data cannot be re-serialized eg. SimpleXMLElements
|
56 |
+
if ( $data ) {
|
57 |
+
if ( is_serialized( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) {
|
58 |
+
$data = self::replace_serialized_values( $from, $to, $unserialized, true );
|
59 |
+
} else if ( is_array( $data ) ) {
|
60 |
+
$tmp = array();
|
61 |
+
foreach ( $data as $key => $value ) {
|
62 |
+
$tmp[$key] = self::replace_serialized_values( $from, $to, $value, false );
|
63 |
+
}
|
64 |
|
65 |
+
$data = $tmp;
|
66 |
+
unset( $tmp );
|
67 |
+
} elseif ( is_object( $data ) ) {
|
68 |
+
$tmp = $data;
|
69 |
+
$props = get_object_vars( $data );
|
70 |
+
foreach ( $props as $key => $value ) {
|
71 |
+
$tmp->$key = self::replace_serialized_values( $from, $to, $value, false );
|
72 |
+
}
|
73 |
|
74 |
+
$data = $tmp;
|
75 |
+
unset( $tmp );
|
76 |
+
} else {
|
77 |
+
if ( is_string( $data ) ) {
|
78 |
+
$data = str_ireplace( $from, $to, $data );
|
79 |
+
}
|
80 |
}
|
|
|
81 |
|
82 |
+
if ( $serialized ) {
|
83 |
+
return serialize( $data );
|
84 |
+
}
|
85 |
}
|
86 |
|
87 |
+
} catch ( Exception $e ) {
|
88 |
// pass
|
89 |
}
|
90 |
|
97 |
* @param string $data Data to replace.
|
98 |
* @return string
|
99 |
*/
|
100 |
+
public static function unescape_mysql( $data ) {
|
101 |
return str_ireplace(
|
102 |
+
array( '\\\\', '\\0', "\\n", "\\r", '\Z', "\'", '\"', '\0' ),
|
103 |
+
array( '\\', '\0', "\n", "\r", "\x1a", "'", '"', "\0" ),
|
104 |
$data
|
105 |
);
|
106 |
}
|
110 |
* @param string $data Data to replace.
|
111 |
* @return string
|
112 |
*/
|
113 |
+
public static function unescape_quotes( $data ) {
|
114 |
+
return str_ireplace( '\"', '"', $data );
|
115 |
}
|
116 |
}
|
lib/vendor/servmask/database/class-ai1wm-database.php
ADDED
@@ -0,0 +1,864 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*
|
18 |
+
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
19 |
+
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
20 |
+
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
21 |
+
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
22 |
+
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
+
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
+
*/
|
25 |
+
|
26 |
+
abstract class Ai1wm_Database {
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Number of queries per transaction
|
30 |
+
*
|
31 |
+
* @var int
|
32 |
+
*/
|
33 |
+
const QUERIES_PER_TRANSACTION = 1000;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* WordPress database handler
|
37 |
+
*
|
38 |
+
* @access protected
|
39 |
+
* @var mixed
|
40 |
+
*/
|
41 |
+
protected $wpdb = null;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Old table prefixes
|
45 |
+
*
|
46 |
+
* @access protected
|
47 |
+
* @var array
|
48 |
+
*/
|
49 |
+
protected $old_table_prefixes = array();
|
50 |
+
|
51 |
+
/**
|
52 |
+
* New table prefixes
|
53 |
+
*
|
54 |
+
* @access protected
|
55 |
+
* @var array
|
56 |
+
*/
|
57 |
+
protected $new_table_prefixes = array();
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Old replace values
|
61 |
+
*
|
62 |
+
* @access protected
|
63 |
+
* @var array
|
64 |
+
*/
|
65 |
+
protected $old_replace_values = array();
|
66 |
+
|
67 |
+
/**
|
68 |
+
* New replace values
|
69 |
+
*
|
70 |
+
* @access protected
|
71 |
+
* @var array
|
72 |
+
*/
|
73 |
+
protected $new_replace_values = array();
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Table query clauses
|
77 |
+
*
|
78 |
+
* @access protected
|
79 |
+
* @var array
|
80 |
+
*/
|
81 |
+
protected $table_query_clauses = array();
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Table prefix columns
|
85 |
+
*
|
86 |
+
* @access protected
|
87 |
+
* @var array
|
88 |
+
*/
|
89 |
+
protected $table_prefix_columns = array();
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Include table prefixes
|
93 |
+
*
|
94 |
+
* @access protected
|
95 |
+
* @var array
|
96 |
+
*/
|
97 |
+
protected $include_table_prefixes = array();
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Exclude table prefixes
|
101 |
+
*
|
102 |
+
* @access protected
|
103 |
+
* @var array
|
104 |
+
*/
|
105 |
+
protected $exclude_table_prefixes = array();
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Constructor
|
109 |
+
*
|
110 |
+
* @param object $wpdb WPDB instance
|
111 |
+
* @return Ai1wm_Database
|
112 |
+
*/
|
113 |
+
public function __construct( $wpdb ) {
|
114 |
+
$this->wpdb = $wpdb;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Set old table prefixes
|
119 |
+
*
|
120 |
+
* @param array $prefixes List of table prefixes
|
121 |
+
* @return Ai1wm_Database
|
122 |
+
*/
|
123 |
+
public function set_old_table_prefixes( $prefixes ) {
|
124 |
+
$this->old_table_prefixes = $prefixes;
|
125 |
+
|
126 |
+
return $this;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Get old table prefixes
|
131 |
+
*
|
132 |
+
* @return array
|
133 |
+
*/
|
134 |
+
public function get_old_table_prefixes() {
|
135 |
+
return $this->old_table_prefixes;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Set new table prefixes
|
140 |
+
*
|
141 |
+
* @param array $prefixes List of table prefixes
|
142 |
+
* @return Ai1wm_Database
|
143 |
+
*/
|
144 |
+
public function set_new_table_prefixes( $prefixes ) {
|
145 |
+
$this->new_table_prefixes = $prefixes;
|
146 |
+
|
147 |
+
return $this;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Get new table prefixes
|
152 |
+
*
|
153 |
+
* @return array
|
154 |
+
*/
|
155 |
+
public function get_new_table_prefixes() {
|
156 |
+
return $this->new_table_prefixes;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Set old replace values
|
161 |
+
*
|
162 |
+
* @param array $values List of values
|
163 |
+
* @return Ai1wm_Database
|
164 |
+
*/
|
165 |
+
public function set_old_replace_values( $values ) {
|
166 |
+
$this->old_replace_values = $values;
|
167 |
+
|
168 |
+
return $this;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Get old replace values
|
173 |
+
*
|
174 |
+
* @return array
|
175 |
+
*/
|
176 |
+
public function get_old_replace_values() {
|
177 |
+
return $this->old_replace_values;
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Set new replace values
|
182 |
+
*
|
183 |
+
* @param array $values List of values
|
184 |
+
* @return Ai1wm_Database
|
185 |
+
*/
|
186 |
+
public function set_new_replace_values( $values ) {
|
187 |
+
$this->new_replace_values = $values;
|
188 |
+
|
189 |
+
return $this;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Get new replace values
|
194 |
+
*
|
195 |
+
* @return array
|
196 |
+
*/
|
197 |
+
public function get_new_replace_values() {
|
198 |
+
return $this->new_replace_values;
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Set table query clauses
|
203 |
+
*
|
204 |
+
* @param string $table Table name
|
205 |
+
* @param array $clauses Table clauses
|
206 |
+
* @return Ai1wm_Database
|
207 |
+
*/
|
208 |
+
public function set_table_query_clauses( $table, $clauses ) {
|
209 |
+
$this->table_query_clauses[ strtolower( $table ) ] = $clauses;
|
210 |
+
|
211 |
+
return $this;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Get table query clauses
|
216 |
+
*
|
217 |
+
* @param string $table Table name
|
218 |
+
* @return array
|
219 |
+
*/
|
220 |
+
public function get_table_query_clauses( $table ) {
|
221 |
+
if ( isset( $this->table_query_clauses[ strtolower( $table ) ] ) ) {
|
222 |
+
return $this->table_query_clauses[ strtolower( $table ) ];
|
223 |
+
}
|
224 |
+
|
225 |
+
return array();
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Set table prefix columns
|
230 |
+
*
|
231 |
+
* @param string $table Table name
|
232 |
+
* @param array $columns Table columns
|
233 |
+
* @return Ai1wm_Database
|
234 |
+
*/
|
235 |
+
public function set_table_prefix_columns( $table, $columns ) {
|
236 |
+
foreach ( $columns as $column ) {
|
237 |
+
$this->table_prefix_columns[ strtolower( $table ) ][ strtolower( $column ) ] = true;
|
238 |
+
}
|
239 |
+
|
240 |
+
return $this;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Get table prefix columns
|
245 |
+
*
|
246 |
+
* @param string $table Table name
|
247 |
+
* @return array
|
248 |
+
*/
|
249 |
+
public function get_table_prefix_columns( $table ) {
|
250 |
+
if ( isset( $this->table_prefix_columns[ strtolower( $table ) ] ) ) {
|
251 |
+
return $this->table_prefix_columns[ strtolower( $table ) ];
|
252 |
+
}
|
253 |
+
|
254 |
+
return array();
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Set include table prefixes
|
259 |
+
*
|
260 |
+
* @param array $prefixes List of table prefixes
|
261 |
+
* @return Ai1wm_Database
|
262 |
+
*/
|
263 |
+
public function set_include_table_prefixes( $prefixes ) {
|
264 |
+
$this->include_table_prefixes = $prefixes;
|
265 |
+
|
266 |
+
return $this;
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Get include table prefixes
|
271 |
+
*
|
272 |
+
* @return array
|
273 |
+
*/
|
274 |
+
public function get_include_table_prefixes() {
|
275 |
+
return $this->include_table_prefixes;
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Set exclude table prefixes
|
280 |
+
*
|
281 |
+
* @param array $prefixes List of table prefixes
|
282 |
+
* @return Ai1wm_Database
|
283 |
+
*/
|
284 |
+
public function set_exclude_table_prefixes( $prefixes ) {
|
285 |
+
$this->exclude_table_prefixes = $prefixes;
|
286 |
+
|
287 |
+
return $this;
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Get exclude table prefixes
|
292 |
+
*
|
293 |
+
* @return array
|
294 |
+
*/
|
295 |
+
public function get_exclude_table_prefixes() {
|
296 |
+
return $this->exclude_table_prefixes;
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Get tables
|
301 |
+
*
|
302 |
+
* @return array
|
303 |
+
*/
|
304 |
+
public function get_tables() {
|
305 |
+
$tables = array();
|
306 |
+
|
307 |
+
$result = $this->query( "SHOW TABLES FROM `{$this->wpdb->dbname}`" );
|
308 |
+
while ( $row = $this->fetch_row( $result ) ) {
|
309 |
+
if ( isset( $row[0] ) && ( $table_name = $row[0] ) ) {
|
310 |
+
|
311 |
+
// Include table prefixes
|
312 |
+
if ( $this->get_include_table_prefixes() ) {
|
313 |
+
$include = false;
|
314 |
+
|
315 |
+
// Check table prefixes
|
316 |
+
foreach ( $this->get_include_table_prefixes() as $prefix ) {
|
317 |
+
if ( stripos( $table_name, $prefix ) === 0 ) {
|
318 |
+
$include = true;
|
319 |
+
break;
|
320 |
+
}
|
321 |
+
}
|
322 |
+
|
323 |
+
// Skip current table
|
324 |
+
if ( $include === false ) {
|
325 |
+
continue;
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
// Exclude table prefixes
|
330 |
+
if ( $this->get_exclude_table_prefixes() ) {
|
331 |
+
$exclude = false;
|
332 |
+
|
333 |
+
// Check table prefixes
|
334 |
+
foreach ( $this->get_exclude_table_prefixes() as $prefix ) {
|
335 |
+
if ( stripos( $table_name, $prefix ) === 0 ) {
|
336 |
+
$exclude = true;
|
337 |
+
break;
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
// Skip current table
|
342 |
+
if ( $exclude === true ) {
|
343 |
+
continue;
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
// Add table name
|
348 |
+
$tables[] = $table_name;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
|
352 |
+
// Close result cursor
|
353 |
+
$this->free_result( $result );
|
354 |
+
|
355 |
+
return $tables;
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Export database into a file
|
360 |
+
*
|
361 |
+
* @param string $file_name Name of file
|
362 |
+
* @return bool
|
363 |
+
*/
|
364 |
+
public function export( $file_name ) {
|
365 |
+
|
366 |
+
// Set file handler
|
367 |
+
$file_handler = fopen( $file_name, 'wb' );
|
368 |
+
if ( $file_handler === false ) {
|
369 |
+
throw new Exception( 'Unable to open database file' );
|
370 |
+
}
|
371 |
+
|
372 |
+
// Write headers
|
373 |
+
if ( fwrite( $file_handler, $this->get_header() ) === false ) {
|
374 |
+
throw new Exception( 'Unable to write database header information' );
|
375 |
+
}
|
376 |
+
|
377 |
+
// Export tables
|
378 |
+
foreach ( $this->get_tables() as $table_name ) {
|
379 |
+
|
380 |
+
// Replace table name prefixes
|
381 |
+
$new_table_name = $this->replace_table_prefixes( $table_name, 0 );
|
382 |
+
|
383 |
+
// Get table structure
|
384 |
+
$structure = $this->query( "SHOW CREATE TABLE `$table_name`" );
|
385 |
+
$table = $this->fetch_assoc( $structure );
|
386 |
+
|
387 |
+
// Close structure cursor
|
388 |
+
$this->free_result( $structure );
|
389 |
+
|
390 |
+
// Get create table
|
391 |
+
if ( isset( $table['Create Table'] ) ) {
|
392 |
+
|
393 |
+
// Write table drop statement
|
394 |
+
$drop_table = "DROP TABLE IF EXISTS `$new_table_name`;\n";
|
395 |
+
|
396 |
+
// Write table statement
|
397 |
+
if ( fwrite( $file_handler, $drop_table ) === false ) {
|
398 |
+
throw new Exception( 'Unable to write database table statement' );
|
399 |
+
}
|
400 |
+
|
401 |
+
// Replace create table prefixes
|
402 |
+
$create_table = $this->replace_table_prefixes( $table['Create Table'], 14 );
|
403 |
+
|
404 |
+
// Strip table constraints
|
405 |
+
$create_table = $this->strip_table_constraints( $create_table );
|
406 |
+
|
407 |
+
// Write table structure
|
408 |
+
if ( fwrite( $file_handler, $create_table ) === false ) {
|
409 |
+
throw new Exception( 'Unable to write database table structure' );
|
410 |
+
}
|
411 |
+
|
412 |
+
// Write end of statement
|
413 |
+
if ( fwrite( $file_handler, ";\n\n" ) === false ) {
|
414 |
+
throw new Exception( 'Unable to write database end of statement' );
|
415 |
+
}
|
416 |
+
|
417 |
+
// Set query
|
418 |
+
$query = "SELECT * FROM `$table_name` ";
|
419 |
+
|
420 |
+
// Apply additional table query clauses
|
421 |
+
if ( ( $query_clauses = $this->get_table_query_clauses( $table_name ) ) ) {
|
422 |
+
$query .= $query_clauses;
|
423 |
+
}
|
424 |
+
|
425 |
+
// Apply additional table prefix columns
|
426 |
+
$columns = $this->get_table_prefix_columns( $table_name );
|
427 |
+
|
428 |
+
// Get results
|
429 |
+
$result = $this->query( $query );
|
430 |
+
|
431 |
+
$processed_rows = 0;
|
432 |
+
|
433 |
+
// Generate insert statements
|
434 |
+
while ( $row = $this->fetch_assoc( $result ) ) {
|
435 |
+
if ( $processed_rows === 0 ) {
|
436 |
+
// Write start transaction
|
437 |
+
if ( fwrite( $file_handler, "START TRANSACTION;\n" ) === false ) {
|
438 |
+
throw new Exception( 'Unable to write database start transaction' );
|
439 |
+
}
|
440 |
+
}
|
441 |
+
|
442 |
+
$items = array();
|
443 |
+
foreach ( $row as $key => $value ) {
|
444 |
+
// Replace table prefix columns
|
445 |
+
if ( isset( $columns[ strtolower( $key ) ] ) ) {
|
446 |
+
$value = $this->replace_table_prefixes( $value, 0 );
|
447 |
+
}
|
448 |
+
|
449 |
+
// Replace table values
|
450 |
+
$items[] = is_null( $value ) ? 'NULL' : $this->quote( $this->replace_table_values( $value ) );
|
451 |
+
}
|
452 |
+
|
453 |
+
// Set table values
|
454 |
+
$table_values = implode( ',', $items );
|
455 |
+
|
456 |
+
// Set insert statement
|
457 |
+
$table_insert = "INSERT INTO `$new_table_name` VALUES ($table_values);\n";
|
458 |
+
|
459 |
+
// Write insert statement
|
460 |
+
if ( fwrite( $file_handler, $table_insert ) === false ) {
|
461 |
+
throw new Exception( 'Unable to write database insert statement' );
|
462 |
+
}
|
463 |
+
|
464 |
+
$processed_rows++;
|
465 |
+
|
466 |
+
// Write end of transaction
|
467 |
+
if ( $processed_rows === Ai1wm_Database::QUERIES_PER_TRANSACTION ) {
|
468 |
+
if (fwrite( $file_handler, "COMMIT;\n" ) === false ) {
|
469 |
+
throw new Exception( 'Unable to write database end of transaction' );
|
470 |
+
}
|
471 |
+
|
472 |
+
$processed_rows = 0;
|
473 |
+
}
|
474 |
+
}
|
475 |
+
|
476 |
+
// Write end of transaction
|
477 |
+
if ( $processed_rows !== 0 ) {
|
478 |
+
if ( fwrite( $file_handler, "COMMIT;\n" ) === false ) {
|
479 |
+
throw new Exception( 'Unable to write database end of transaction' );
|
480 |
+
}
|
481 |
+
}
|
482 |
+
|
483 |
+
// Write end of statements
|
484 |
+
if ( fwrite( $file_handler, "\n" ) === false ) {
|
485 |
+
throw new Exception( 'Unable to write database end of statement' );
|
486 |
+
}
|
487 |
+
|
488 |
+
// Close result cursor
|
489 |
+
$this->free_result( $result );
|
490 |
+
}
|
491 |
+
}
|
492 |
+
|
493 |
+
// Close file handler
|
494 |
+
fclose( $file_handler );
|
495 |
+
|
496 |
+
return true;
|
497 |
+
}
|
498 |
+
|
499 |
+
/**
|
500 |
+
* Import database from a file
|
501 |
+
*
|
502 |
+
* @param string $file_name Name of file
|
503 |
+
* @return bool
|
504 |
+
*/
|
505 |
+
public function import( $file_name ) {
|
506 |
+
|
507 |
+
// Set collation name
|
508 |
+
$collation = $this->get_collation( 'utf8mb4_general_ci' );
|
509 |
+
|
510 |
+
// Set max allowed packet
|
511 |
+
$max_allowed_packet = $this->get_max_allowed_packet();
|
512 |
+
|
513 |
+
// Set file handler
|
514 |
+
$file_handler = fopen( $file_name, 'r' );
|
515 |
+
if ($file_handler === false) {
|
516 |
+
throw new Exception( 'Unable to open database file' );
|
517 |
+
}
|
518 |
+
|
519 |
+
$passed = 0;
|
520 |
+
$failed = 0;
|
521 |
+
$query = null;
|
522 |
+
|
523 |
+
// Read database file line by line
|
524 |
+
while ( ( $line = fgets( $file_handler ) ) !== false ) {
|
525 |
+
$query .= $line;
|
526 |
+
|
527 |
+
// End of query
|
528 |
+
if ( preg_match( '/;\s*$/', $query ) ) {
|
529 |
+
|
530 |
+
// Check max allowed packet
|
531 |
+
if ( strlen( $query ) <= $max_allowed_packet ) {
|
532 |
+
|
533 |
+
// Replace table prefixes
|
534 |
+
$query = $this->replace_table_prefixes( $query );
|
535 |
+
|
536 |
+
// Replace table values
|
537 |
+
$query = $this->replace_table_values( $query, true );
|
538 |
+
|
539 |
+
// Replace table collation
|
540 |
+
if ( empty( $collation ) ) {
|
541 |
+
$query = $this->replace_table_collation( $query );
|
542 |
+
}
|
543 |
+
|
544 |
+
try {
|
545 |
+
|
546 |
+
// Run SQL query
|
547 |
+
$result = $this->query( $query );
|
548 |
+
if ( $result === false ) {
|
549 |
+
throw new Exception( $this->error(), $this->errno() );
|
550 |
+
} else {
|
551 |
+
$passed++;
|
552 |
+
}
|
553 |
+
|
554 |
+
} catch ( Exception $e ) {
|
555 |
+
$failed++;
|
556 |
+
}
|
557 |
+
|
558 |
+
} else {
|
559 |
+
$failed++;
|
560 |
+
}
|
561 |
+
|
562 |
+
$query = null;
|
563 |
+
}
|
564 |
+
}
|
565 |
+
|
566 |
+
// Close file handler
|
567 |
+
fclose( $file_handler );
|
568 |
+
|
569 |
+
// Check failed queries
|
570 |
+
if ( ( ( $failed / $passed ) * 100 ) > 2 ) {
|
571 |
+
return false;
|
572 |
+
}
|
573 |
+
|
574 |
+
return true;
|
575 |
+
}
|
576 |
+
|
577 |
+
/**
|
578 |
+
* Flush database
|
579 |
+
*
|
580 |
+
* @return void
|
581 |
+
*/
|
582 |
+
public function flush() {
|
583 |
+
foreach ( $this->get_tables() as $table_name ) {
|
584 |
+
$this->query( "DROP TABLE IF EXISTS `$table_name`" );
|
585 |
+
}
|
586 |
+
}
|
587 |
+
|
588 |
+
/**
|
589 |
+
* Get MySQL version
|
590 |
+
*
|
591 |
+
* @return string
|
592 |
+
*/
|
593 |
+
protected function get_version() {
|
594 |
+
$version = null;
|
595 |
+
|
596 |
+
$result = $this->query( "SHOW VARIABLES LIKE 'version'" );
|
597 |
+
while ( $row = $this->fetch_row( $result ) ) {
|
598 |
+
if ( isset( $row[1] ) ) {
|
599 |
+
$version = $row[1];
|
600 |
+
break;
|
601 |
+
}
|
602 |
+
}
|
603 |
+
|
604 |
+
// Close result cursor
|
605 |
+
$this->free_result( $result );
|
606 |
+
|
607 |
+
return $version;
|
608 |
+
}
|
609 |
+
|
610 |
+
/**
|
611 |
+
* Get MySQL max allowed packaet
|
612 |
+
*
|
613 |
+
* @return integer
|
614 |
+
*/
|
615 |
+
protected function get_max_allowed_packet() {
|
616 |
+
$max_allowed_packet = null;
|
617 |
+
|
618 |
+
$result = $this->query( "SHOW VARIABLES LIKE 'max_allowed_packet'" );
|
619 |
+
while ( $row = $this->fetch_row( $result ) ) {
|
620 |
+
if ( isset( $row[1] ) ) {
|
621 |
+
$max_allowed_packet = $row[1];
|
622 |
+
break;
|
623 |
+
}
|
624 |
+
}
|
625 |
+
|
626 |
+
// Close result cursor
|
627 |
+
$this->free_result( $result );
|
628 |
+
|
629 |
+
return $max_allowed_packet;
|
630 |
+
}
|
631 |
+
|
632 |
+
/**
|
633 |
+
* Get MySQL collation name
|
634 |
+
*
|
635 |
+
* @param string $collation_name Collation name
|
636 |
+
* @return string
|
637 |
+
*/
|
638 |
+
protected function get_collation( $collation_name ) {
|
639 |
+
$collation_result = null;
|
640 |
+
|
641 |
+
$result = $this->query( "SHOW COLLATION LIKE '$collation_name'" );
|
642 |
+
while ( $row = $this->fetch_row( $result ) ) {
|
643 |
+
if ( isset( $row[0] ) ) {
|
644 |
+
$collation_result = $row[0];
|
645 |
+
break;
|
646 |
+
}
|
647 |
+
}
|
648 |
+
|
649 |
+
// Close result cursor
|
650 |
+
$this->free_result( $result );
|
651 |
+
|
652 |
+
return $collation_result;
|
653 |
+
}
|
654 |
+
|
655 |
+
/**
|
656 |
+
* Replace table prefixes
|
657 |
+
*
|
658 |
+
* @param string $input Table value
|
659 |
+
* @param boolean $position Replace first occurrence at a specified position
|
660 |
+
* @return string
|
661 |
+
*/
|
662 |
+
protected function replace_table_prefixes( $input, $position = false ) {
|
663 |
+
// Get table prefixes
|
664 |
+
$search = $this->get_old_table_prefixes();
|
665 |
+
$replace = $this->get_new_table_prefixes();
|
666 |
+
|
667 |
+
// Replace first occurance at a specified position
|
668 |
+
if ( $position !== false ) {
|
669 |
+
for ( $i = 0; $i < count( $search ); $i++ ) {
|
670 |
+
$current = stripos( $input, $search[$i] );
|
671 |
+
if ( $current === $position ) {
|
672 |
+
$input = substr_replace( $input, $replace[$i], $current, strlen( $search[$i] ) );
|
673 |
+
}
|
674 |
+
}
|
675 |
+
|
676 |
+
return $input;
|
677 |
+
}
|
678 |
+
|
679 |
+
// Replace all occurrences
|
680 |
+
return str_ireplace( $search, $replace, $input );
|
681 |
+
}
|
682 |
+
|
683 |
+
/**
|
684 |
+
* Replace table values
|
685 |
+
*
|
686 |
+
* @param string $input Table value
|
687 |
+
* @param boolean $parse Parse value
|
688 |
+
* @return string
|
689 |
+
*/
|
690 |
+
protected function replace_table_values( $input, $parse = false ) {
|
691 |
+
// Get replace values
|
692 |
+
$old = $this->get_old_replace_values();
|
693 |
+
$new = $this->get_new_replace_values();
|
694 |
+
|
695 |
+
$old_values = array();
|
696 |
+
$new_values = array();
|
697 |
+
|
698 |
+
// Prepare replace values
|
699 |
+
for ( $i = 0; $i < count( $old ); $i++ ) {
|
700 |
+
if ( stripos( $input, $old[$i] ) !== false ) {
|
701 |
+
$old_values[] = $old[$i];
|
702 |
+
$new_values[] = $new[$i];
|
703 |
+
}
|
704 |
+
}
|
705 |
+
|
706 |
+
// Do replace values
|
707 |
+
if ( $old_values ) {
|
708 |
+
if ( $parse ) {
|
709 |
+
return $this->parse_serialized_values( $old_values, $new_values, $input );
|
710 |
+
}
|
711 |
+
|
712 |
+
return Ai1wm_Database_Utility::replace_serialized_values( $old_values, $new_values, $input );
|
713 |
+
}
|
714 |
+
|
715 |
+
return $input;
|
716 |
+
}
|
717 |
+
|
718 |
+
/**
|
719 |
+
* Parse serialized values
|
720 |
+
*
|
721 |
+
* @param array $old_values Old replace values
|
722 |
+
* @param array $new_values New replace values
|
723 |
+
* @param string $input Table value
|
724 |
+
* @return string
|
725 |
+
*/
|
726 |
+
protected function parse_serialized_values( $old_values, $new_values, $input ) {
|
727 |
+
// Serialization format
|
728 |
+
$array = '(a:\d+:{.*?})';
|
729 |
+
$string = '(s:\d+:".*?")';
|
730 |
+
$object = '(O:\d+:".+":\d+:{.*})';
|
731 |
+
|
732 |
+
// Number of replaces
|
733 |
+
$count = 0;
|
734 |
+
|
735 |
+
// Replace serialized values
|
736 |
+
$input = preg_replace_callback( "/'($array|$string|$object)'/", array( $this, 'replace_serialized_values' ), $input, -1, $count );
|
737 |
+
|
738 |
+
// Replace values
|
739 |
+
if ( $count === 0 ) {
|
740 |
+
$input = Ai1wm_Database_Utility::replace_values( $old_values, $new_values, $input );
|
741 |
+
}
|
742 |
+
|
743 |
+
return $input;
|
744 |
+
}
|
745 |
+
|
746 |
+
/**
|
747 |
+
* Replace serialized values (callback)
|
748 |
+
*
|
749 |
+
* @param array $matches List of matches
|
750 |
+
* @return string
|
751 |
+
*/
|
752 |
+
protected function replace_serialized_values( $matches ) {
|
753 |
+
// Unescape MySQL special characters
|
754 |
+
$input = Ai1wm_Database_Utility::unescape_mysql( $matches[1] );
|
755 |
+
|
756 |
+
// Replace serialized values
|
757 |
+
$input = Ai1wm_Database_Utility::replace_serialized_values( $this->get_old_replace_values(), $this->get_new_replace_values(), $input );
|
758 |
+
|
759 |
+
// Prepare query values
|
760 |
+
return $this->quote( $input );
|
761 |
+
}
|
762 |
+
|
763 |
+
/**
|
764 |
+
* Replace table collation
|
765 |
+
*
|
766 |
+
* @param string $input SQL statement
|
767 |
+
* @return string
|
768 |
+
*/
|
769 |
+
protected function replace_table_collation($input) {
|
770 |
+
return str_ireplace( 'utf8mb4', 'utf8', $input );
|
771 |
+
}
|
772 |
+
|
773 |
+
/**
|
774 |
+
* Strip table constraints
|
775 |
+
*
|
776 |
+
* @param string $input SQL statement
|
777 |
+
* @return string
|
778 |
+
*/
|
779 |
+
protected function strip_table_constraints($input) {
|
780 |
+
$pattern = array(
|
781 |
+
'/\s+CONSTRAINT(.+)REFERENCES(.+),/i',
|
782 |
+
'/,\s+CONSTRAINT(.+)REFERENCES(.+)/i',
|
783 |
+
);
|
784 |
+
|
785 |
+
return preg_replace( $pattern, '', $input );
|
786 |
+
}
|
787 |
+
|
788 |
+
/**
|
789 |
+
* Returns header for dump file
|
790 |
+
*
|
791 |
+
* @return string
|
792 |
+
*/
|
793 |
+
protected function get_header() {
|
794 |
+
// Some info about software, source and time
|
795 |
+
$header = sprintf(
|
796 |
+
"-- All In One WP Migration SQL Dump\n" .
|
797 |
+
"-- https://servmask.com/\n" .
|
798 |
+
"--\n" .
|
799 |
+
"-- Host: %s\n" .
|
800 |
+
"-- Database: %s\n" .
|
801 |
+
"-- Class: %s\n" .
|
802 |
+
"--\n\n",
|
803 |
+
$this->wpdb->dbhost,
|
804 |
+
$this->wpdb->dbname,
|
805 |
+
get_class( $this )
|
806 |
+
);
|
807 |
+
|
808 |
+
return $header;
|
809 |
+
}
|
810 |
+
|
811 |
+
/**
|
812 |
+
* Run MySQL query
|
813 |
+
*
|
814 |
+
* @param string $input SQL query
|
815 |
+
* @return resource
|
816 |
+
*/
|
817 |
+
abstract public function query( $input );
|
818 |
+
|
819 |
+
/**
|
820 |
+
* Escape string input for mysql query
|
821 |
+
*
|
822 |
+
* @param string $input String to escape
|
823 |
+
* @return string
|
824 |
+
*/
|
825 |
+
abstract public function quote( $input );
|
826 |
+
|
827 |
+
/**
|
828 |
+
* Returns the error code for the most recent function call
|
829 |
+
*
|
830 |
+
* @return int
|
831 |
+
*/
|
832 |
+
abstract public function errno();
|
833 |
+
|
834 |
+
/**
|
835 |
+
* Returns a string description of the last error
|
836 |
+
*
|
837 |
+
* @return string
|
838 |
+
*/
|
839 |
+
abstract public function error();
|
840 |
+
|
841 |
+
/**
|
842 |
+
* Return the result from MySQL query as associative array
|
843 |
+
*
|
844 |
+
* @param resource $result MySQL resource
|
845 |
+
* @return array
|
846 |
+
*/
|
847 |
+
abstract public function fetch_assoc( $result );
|
848 |
+
|
849 |
+
/**
|
850 |
+
* Return the result from MySQL query as row
|
851 |
+
*
|
852 |
+
* @param resource $result MySQL resource
|
853 |
+
* @return array
|
854 |
+
*/
|
855 |
+
abstract public function fetch_row( $result );
|
856 |
+
|
857 |
+
/**
|
858 |
+
* Free MySQL result memory
|
859 |
+
*
|
860 |
+
* @param resource $result MySQL resource
|
861 |
+
* @return bool
|
862 |
+
*/
|
863 |
+
abstract public function free_result( $result );
|
864 |
+
}
|
lib/vendor/servmask/filesystem/class-ai1wm-file-index.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -22,29 +22,57 @@
|
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
-
class Ai1wm_File_Index {
|
26 |
|
|
|
27 |
/**
|
28 |
-
* Create a
|
29 |
*
|
30 |
-
* The method will create
|
31 |
-
* at the path specified by the argument. The file is only created if it doesn't exist.
|
32 |
*
|
33 |
-
* @param
|
34 |
-
* @
|
|
|
|
|
35 |
*/
|
36 |
-
public static function create( $
|
37 |
-
if ( ! is_file( $
|
38 |
-
|
39 |
-
$handle = fopen( $file, 'w' );
|
40 |
-
// Check if we were able to open the file
|
41 |
if ( false === $handle ) {
|
42 |
return false;
|
43 |
}
|
44 |
-
fwrite( $handle,
|
45 |
fclose( $handle );
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
|
|
25 |
|
26 |
+
class Ai1wm_File {
|
27 |
/**
|
28 |
+
* Create a file with contents
|
29 |
*
|
30 |
+
* The method will only create the file if it doesn't already exist.
|
|
|
31 |
*
|
32 |
+
* @param string $path Path to the file
|
33 |
+
* @param string $contents Contents of the file
|
34 |
+
*
|
35 |
+
* @return boolean|null
|
36 |
*/
|
37 |
+
public static function create( $path, $contents ) {
|
38 |
+
if ( ! is_file( $path ) ) {
|
39 |
+
$handle = fopen( $path, 'w' );
|
|
|
|
|
40 |
if ( false === $handle ) {
|
41 |
return false;
|
42 |
}
|
43 |
+
fwrite( $handle, $contents );
|
44 |
fclose( $handle );
|
45 |
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
class Ai1wm_File_Index {
|
50 |
+
/**
|
51 |
+
* Create a index.php file
|
52 |
+
*
|
53 |
+
* The method will create index.php file with contents '<?php // silence is golden' without the single quotes
|
54 |
+
* at the path specified by the argument.
|
55 |
+
*
|
56 |
+
* @param string $path Path to the index.php file
|
57 |
+
* @return boolean|null
|
58 |
+
*/
|
59 |
+
public static function create( $path ) {
|
60 |
+
$contents = '<?php // silence is golden';
|
61 |
+
return Ai1wm_File::create( $path, $contents );
|
62 |
+
}
|
63 |
+
}
|
64 |
|
65 |
+
class Ai1wm_File_Htaccess {
|
66 |
+
/**
|
67 |
+
* Create .htaccess file
|
68 |
+
*
|
69 |
+
* The method will create .htaccess file with contents 'AddType application/octet-stream .wpress'
|
70 |
+
*
|
71 |
+
* @param string $path Path to the .htaccess file
|
72 |
+
* @return boolean|null
|
73 |
+
*/
|
74 |
+
public static function create( $path ) {
|
75 |
+
$contents = "<IfModule mod_mime.c>\nAddType application/octet-stream .wpress\n</IfModule>";
|
76 |
+
return Ai1wm_File::create( $path, $contents );
|
77 |
}
|
78 |
+
}
|
lib/vendor/servmask/filter/class-ai1wm-extension-filter.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,7 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
|
|
26 |
class Ai1wm_Extension_Filter extends FilterIterator {
|
27 |
|
28 |
protected $include = array();
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
+
|
26 |
class Ai1wm_Extension_Filter extends FilterIterator {
|
27 |
|
28 |
protected $include = array();
|
lib/vendor/servmask/filter/class-ai1wm-recursive-exclude-filter.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,7 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
|
|
26 |
class Ai1wm_Recursive_Exclude_Filter extends RecursiveFilterIterator {
|
27 |
|
28 |
protected $exclude = array();
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
+
|
26 |
class Ai1wm_Recursive_Exclude_Filter extends RecursiveFilterIterator {
|
27 |
|
28 |
protected $exclude = array();
|
lib/vendor/servmask/iterator/class-ai1wm-recursive-directory-iterator.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
* Copyright (C) 2014 ServMask Inc.
|
5 |
*
|
6 |
* This program is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
@@ -23,6 +22,7 @@
|
|
23 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
24 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
25 |
*/
|
|
|
26 |
class Ai1wm_Recursive_Directory_Iterator extends RecursiveDirectoryIterator {
|
27 |
|
28 |
protected $exclude = array();
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
22 |
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
23 |
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
24 |
*/
|
25 |
+
|
26 |
class Ai1wm_Recursive_Directory_Iterator extends RecursiveDirectoryIterator {
|
27 |
|
28 |
protected $exclude = array();
|
lib/view/assets/css/{backup.min.css → backups.min.css}
RENAMED
@@ -1 +1 @@
|
|
1 |
-
@charset "UTF-8";.ai1wm-divider{-ms-box-sizing:border-box;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;border:none;height:0;background-color:transparent;font-size:14px;font-weight:700;text-align:center;text-transform:uppercase;color:rgba(0,0,0,.8);position:relative;top:0%;left:0%;margin:1rem 2.5rem;height:auto;padding:0;line-height:1}.ai1wm-divider:before,.ai1wm-divider:after{position:absolute;content:" ";z-index:3;width:50%;top:50%;height:0%;border-top:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(255,255,255,.8)}.ai1wm-divider:before{left:0%;margin-left:-2.5rem}.ai1wm-divider:after{left:auto;right:0%;margin-right:-2.5rem}@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}[class^="ai1wm-icon-"],[class*=" ai1wm-icon-"]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-chevron-down{display:inline-block;position:relative;-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg);margin-left:.5em!important}.ai1wm-icon-chevron-down:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-alone{margin:0!important}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:before,.ai1wm-row:after{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message,.ai1wm-right .ai1wm-http-authentication{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{margin:0;padding:0;float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-row,.ai1wm-right{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:before,.ai1wm-container:after{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 #fff;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-replace-row .ai1wm-field-inline{float:left;width:100%}.ai1wm-replace-row .ai1wm-field-inline input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type="text"],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#EFEFEF;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#F2F8F0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#F1D7D7;color:#A95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#D95C5C;border:2px solid #D95C5C;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#D95C5C}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block}.ai1wm-button-group.ai1wm-button-export{width:147px}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:150px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import{width:158px}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:180px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{padding:6px 25px 1px;height:22px}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:6px 25px 1px 26px;height:22px;line-height:22px;text-decoration:none;color:#27ae60;text-align:left}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{-webkit-transform:translate(11px,-1px);transform:translate(11px,-1px);position:relative;display:inline-block;width:12px;height:10px}.ai1wm-line{display:inline-block;width:100%;height:2px;margin:auto;background:#27ae60;position:absolute;transition:all .2s ease-in-out}.ai1wm-line-first{top:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third,.ai1wm-line-second{top:50%}.ai1wm-line-third{top:100%}.ai1wm-button-gray{border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-green{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-green-small{border:2px solid #6eb649;background-color:transparent;color:#6eb649;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue{border:2px solid #00aff0;background-color:transparent;color:#00aff0;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;background-color:transparent;color:#e74c3c;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-alone{border-radius:50px!important;padding:5px 8px!important}.ai1wm-button-blue[disabled="disabled"],.ai1wm-button-green[disabled="disabled"],.ai1wm-button-red[disabled="disabled"],.ai1wm-button-green-small[disabled="disabled"]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled="disabled"]:hover{color:#00aff0}.ai1wm-button-red[disabled="disabled"]:hover{color:#e74c3c}.ai1wm-button-green[disabled="disabled"]:hover{color:#27ae60}.ai1wm-button-blue[disabled="disabled"]:hover,.ai1wm-button-green[disabled="disabled"]:hover,.ai1wm-button-red[disabled="disabled"]:hover,.ai1wm-button-green-small[disabled="disabled"]:hover{background:0 0}.ai1wm-button-gray i,.ai1wm-button-green i,.ai1wm-button-blue i,.ai1wm-button-red i{margin-left:-.5em;margin-right:.2em}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type="radio"].ai1wm-flat-radio-button{display:none}input[type="radio"].ai1wm-flat-radio-button+a i,input[type="radio"].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type="radio"].ai1wm-flat-radio-button:checked+a i,input[type="radio"].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:before,.ai1wm-clear:after{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-list-expanded{display:block!important}.ai1wm-field-inline input{border-radius:5px}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #D6D6D6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-feedback-cancel:active{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:none;color:#333;text-deciration:none}.ai1wm-feedback-types>li>a>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url("../img/logo.svg") no-repeat center center}.ai1wm-hide{display:none}#ai1wm-backup-progress{background-color:#dfdfdf;height:20px;width:350px;border-radius:15px}#ai1wm-backup-progress-bar{background-color:#00aff0;height:20px;line-height:20px;border-radius:15px;color:#fff;width:0;text-align:center}.ai1wm-backups{width:100%;margin:20px 0 0;padding:0;border-collapse:collapse}.ai1wm-backups .ai1wm-column-name{text-align:left}.ai1wm-backups .ai1wm-column-date,.ai1wm-backups .ai1wm-column-size{text-align:center}.ai1wm-backups .ai1wm-column-actions{text-align:right}.ai1wm-backups thead th{padding:4px 6px;text-align:left;font-size:1.2em}.ai1wm-backups tbody tr:first-child{border-top:1px solid #ccc}.ai1wm-backups tbody tr{border-bottom:1px solid #ccc}.ai1wm-backups tbody tr:hover{background:rgba(0,0,0,.1)}.ai1wm-backups tbody td{padding:4px 6px;box-sizing:border-box;line-height:36px}.ai1wm-backups tbody td span{font-weight:700}.ai1wm-backups tbody td.ai1wm-backup-actions{text-align:right;width:250px}.ai1wm-backups tbody td.ai1wm-backup-actions a{margin-left:4px}.ai1wm-backups tbody td.ai1wm-backup-actions span{transition:width 2s cubic-bezier(.19,1,.22,1);display:inline-block;width:0;text-align:center;visibility:hidden}.ai1wm-backups tbody td.ai1wm-backup-actions .ai1wm-button-on span{width:80px;visibility:visible}.ai1wm-authentication{margin:10px 0}.ai1wm-authentication .ai1wm-authentication-info{font-size:.7rem;line-height:1rem;margin:4px 0 8px}
|
1 |
+
@charset "UTF-8";.ai1wm-divider{-ms-box-sizing:border-box;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;border:none;height:0;background-color:transparent;font-size:14px;font-weight:700;text-align:center;text-transform:uppercase;color:rgba(0,0,0,.8);position:relative;top:0%;left:0%;margin:1rem 2.5rem;height:auto;padding:0;line-height:1}.ai1wm-divider:before,.ai1wm-divider:after{position:absolute;content:" ";z-index:3;width:50%;top:50%;height:0%;border-top:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(255,255,255,.8)}.ai1wm-divider:before{left:0%;margin-left:-2.5rem}.ai1wm-divider:after{left:auto;right:0%;margin-right:-2.5rem}@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}[class^="ai1wm-icon-"],[class*=" ai1wm-icon-"]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-chevron-down{display:inline-block;position:relative;-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg);margin-left:.5em!important}.ai1wm-icon-chevron-down:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-alone{margin:0!important}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:before,.ai1wm-row:after{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message,.ai1wm-right .ai1wm-http-authentication{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{margin:0;padding:0;float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-row,.ai1wm-right{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:before,.ai1wm-container:after{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 #fff;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-replace-row .ai1wm-field-inline{float:left;width:100%}.ai1wm-replace-row .ai1wm-field-inline input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type="text"],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#EFEFEF;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#F2F8F0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#F1D7D7;color:#A95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#D95C5C;border:2px solid #D95C5C;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#D95C5C}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block}.ai1wm-button-group.ai1wm-button-export{width:147px}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:180px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import{width:158px}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:210px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{padding:6px 25px 1px;height:22px}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:6px 25px 1px 26px;height:22px;line-height:22px;text-decoration:none;color:#27ae60;text-align:left}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{-webkit-transform:translate(11px,-1px);transform:translate(11px,-1px);position:relative;display:inline-block;width:12px;height:10px}.ai1wm-line{display:inline-block;width:100%;height:2px;margin:auto;background:#27ae60;position:absolute;transition:all .2s ease-in-out}.ai1wm-line-first{top:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third,.ai1wm-line-second{top:50%}.ai1wm-line-third{top:100%}.ai1wm-button-gray{border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-green{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-green-small{border:2px solid #6eb649;background-color:transparent;color:#6eb649;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue{border:2px solid #00aff0;background-color:transparent;color:#00aff0;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;background-color:transparent;color:#e74c3c;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-alone{border-radius:50px!important;padding:5px 8px!important}.ai1wm-button-blue[disabled="disabled"],.ai1wm-button-green[disabled="disabled"],.ai1wm-button-red[disabled="disabled"],.ai1wm-button-green-small[disabled="disabled"]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled="disabled"]:hover{color:#00aff0}.ai1wm-button-red[disabled="disabled"]:hover{color:#e74c3c}.ai1wm-button-green[disabled="disabled"]:hover{color:#27ae60}.ai1wm-button-blue[disabled="disabled"]:hover,.ai1wm-button-green[disabled="disabled"]:hover,.ai1wm-button-red[disabled="disabled"]:hover,.ai1wm-button-green-small[disabled="disabled"]:hover{background:0 0}.ai1wm-button-gray i,.ai1wm-button-green i,.ai1wm-button-blue i,.ai1wm-button-red i{margin-left:-.5em;margin-right:.2em}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type="radio"].ai1wm-flat-radio-button{display:none}input[type="radio"].ai1wm-flat-radio-button+a i,input[type="radio"].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type="radio"].ai1wm-flat-radio-button:checked+a i,input[type="radio"].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:before,.ai1wm-clear:after{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-list-expanded{display:block!important}.ai1wm-field-inline input{border-radius:5px}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #D6D6D6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-feedback-cancel:active{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:none;color:#333;text-deciration:none}.ai1wm-feedback-types>li>a>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url("../img/logo.svg") no-repeat center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:left;line-height:1.5em}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-growl-info{position:fixed;z-index:200000;top:0;margin-top:16px;right:16px;width:200px;padding:16px;background:#f1c40f;border:1px solid #e67e22;border-radius:5px;color:#111}#ai1wm-backup-progress{background-color:#dfdfdf;height:20px;width:350px;border-radius:15px}#ai1wm-backup-progress-bar{background-color:#00aff0;height:20px;line-height:20px;border-radius:15px;color:#fff;width:0;text-align:center}.ai1wm-backups{width:100%;margin:20px 0 0;padding:0;border-collapse:collapse}.ai1wm-backups .ai1wm-column-name{text-align:left}.ai1wm-backups .ai1wm-column-date,.ai1wm-backups .ai1wm-column-size{text-align:center}.ai1wm-backups .ai1wm-column-actions{text-align:right}.ai1wm-backups thead th{padding:4px 6px;text-align:left;font-size:1.2em}.ai1wm-backups tbody tr:first-child{border-top:1px solid #ccc}.ai1wm-backups tbody tr{border-bottom:1px solid #ccc}.ai1wm-backups tbody tr:hover{background:rgba(0,0,0,.1)}.ai1wm-backups tbody td{padding:4px 6px;box-sizing:border-box;line-height:36px}.ai1wm-backups tbody td span{font-weight:700}.ai1wm-backups tbody td.ai1wm-backup-actions{text-align:right;width:250px}.ai1wm-backups tbody td.ai1wm-backup-actions a{margin-left:4px}.ai1wm-backups tbody td.ai1wm-backup-actions span{transition:width 2s cubic-bezier(.19,1,.22,1);display:inline-block;width:0;text-align:center;visibility:hidden}.ai1wm-backups tbody td.ai1wm-backup-actions .ai1wm-button-on span{width:80px;visibility:visible}.ai1wm-authentication{margin:10px 0}.ai1wm-authentication .ai1wm-authentication-info{font-size:.7rem;line-height:1rem;margin:4px 0 8px}
|
lib/view/assets/css/export.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@charset "UTF-8";.ai1wm-divider{-ms-box-sizing:border-box;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;border:none;height:0;background-color:transparent;font-size:14px;font-weight:700;text-align:center;text-transform:uppercase;color:rgba(0,0,0,.8);position:relative;top:0%;left:0%;margin:1rem 2.5rem;height:auto;padding:0;line-height:1}.ai1wm-divider:before,.ai1wm-divider:after{position:absolute;content:" ";z-index:3;width:50%;top:50%;height:0%;border-top:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(255,255,255,.8)}.ai1wm-divider:before{left:0%;margin-left:-2.5rem}.ai1wm-divider:after{left:auto;right:0%;margin-right:-2.5rem}@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}[class^="ai1wm-icon-"],[class*=" ai1wm-icon-"]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-chevron-down{display:inline-block;position:relative;-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg);margin-left:.5em!important}.ai1wm-icon-chevron-down:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-alone{margin:0!important}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:before,.ai1wm-row:after{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message,.ai1wm-right .ai1wm-http-authentication{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{margin:0;padding:0;float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-row,.ai1wm-right{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:before,.ai1wm-container:after{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 #fff;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-replace-row .ai1wm-field-inline{float:left;width:100%}.ai1wm-replace-row .ai1wm-field-inline input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type="text"],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#EFEFEF;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#F2F8F0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#F1D7D7;color:#A95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#D95C5C;border:2px solid #D95C5C;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#D95C5C}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block}.ai1wm-button-group.ai1wm-button-export{width:147px}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:150px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import{width:158px}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:180px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{padding:6px 25px 1px;height:22px}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:6px 25px 1px 26px;height:22px;line-height:22px;text-decoration:none;color:#27ae60;text-align:left}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{-webkit-transform:translate(11px,-1px);transform:translate(11px,-1px);position:relative;display:inline-block;width:12px;height:10px}.ai1wm-line{display:inline-block;width:100%;height:2px;margin:auto;background:#27ae60;position:absolute;transition:all .2s ease-in-out}.ai1wm-line-first{top:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third,.ai1wm-line-second{top:50%}.ai1wm-line-third{top:100%}.ai1wm-button-gray{border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-green{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-green-small{border:2px solid #6eb649;background-color:transparent;color:#6eb649;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue{border:2px solid #00aff0;background-color:transparent;color:#00aff0;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;background-color:transparent;color:#e74c3c;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-alone{border-radius:50px!important;padding:5px 8px!important}.ai1wm-button-blue[disabled="disabled"],.ai1wm-button-green[disabled="disabled"],.ai1wm-button-red[disabled="disabled"],.ai1wm-button-green-small[disabled="disabled"]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled="disabled"]:hover{color:#00aff0}.ai1wm-button-red[disabled="disabled"]:hover{color:#e74c3c}.ai1wm-button-green[disabled="disabled"]:hover{color:#27ae60}.ai1wm-button-blue[disabled="disabled"]:hover,.ai1wm-button-green[disabled="disabled"]:hover,.ai1wm-button-red[disabled="disabled"]:hover,.ai1wm-button-green-small[disabled="disabled"]:hover{background:0 0}.ai1wm-button-gray i,.ai1wm-button-green i,.ai1wm-button-blue i,.ai1wm-button-red i{margin-left:-.5em;margin-right:.2em}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type="radio"].ai1wm-flat-radio-button{display:none}input[type="radio"].ai1wm-flat-radio-button+a i,input[type="radio"].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type="radio"].ai1wm-flat-radio-button:checked+a i,input[type="radio"].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:before,.ai1wm-clear:after{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-list-expanded{display:block!important}.ai1wm-field-inline input{border-radius:5px}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #D6D6D6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-feedback-cancel:active{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:none;color:#333;text-deciration:none}.ai1wm-feedback-types>li>a>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url("../img/logo.svg") no-repeat center center}.ai1wm-hide{display:none}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-accordion{margin:1em 0;display:block}.ai1wm-accordion h4{cursor:pointer;color:rgba(0,116,162,.8);margin:0}.ai1wm-accordion h4 small{color:#444;font-weight:400}.ai1wm-accordion .ai1wm-icon-arrow-right{transition:-webkit-transform .1s ease-out;transition:transform .1s ease-out}.ai1wm-accordion ul{margin:0;padding:0;list-style:none;visibility:hidden;height:0;transition:height .2s cubic-bezier(.19,1,.22,1)}.ai1wm-accordion.ai1wm-open h4 .ai1wm-icon-arrow-right{-webkit-transform:rotate(90deg);transform:rotate(90deg);display:inline-block}.ai1wm-accordion.ai1wm-open ul{height:auto;margin:.6em 0 0 2em;visibility:visible}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-query-arrow{position:relative;top:4px;float:right}.ai1wm-query.ai1wm-open{background:#ebebeb!important}.ai1wm-query.ai1wm-open p small{border-bottom:1px dashed #000}.ai1wm-query.ai1wm-open div{visibility:visible!important;height:82px!important;margin-top:8px}.ai1wm-query.ai1wm-open .ai1wm-query-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ai1wm-query{width:100%;margin:0 0 10px;list-style:none;background:0 0;border:1px solid #d8d8d8;padding:10px;border-radius:5px;box-sizing:border-box}.ai1wm-query div{transition:height .2s cubic-bezier(.19,1,.22,1);visibility:hidden;height:0}.ai1wm-query div input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px;border:1px solid #ddd;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);background-color:#fff;color:#333;transition:.05s border-color ease-in-out;border-radius:5px}.ai1wm-query div input:focus{border-color:#5b9dd9;box-shadow:0 0 2px rgba(30,140,190,.8)}.ai1wm-query p{margin:0;cursor:pointer}.ai1wm-query p small{display:inline;width:auto;float:none}.ai1wm-query-arrow{transition:-webkit-transform .1s ease-out;transition:transform .1s ease-out}.ai1wm-include-tables{display:inline-block;width:300px;margin:0 6px 0 0}.ai1wm-include-plugins{display:inline-block;width:300px;vertical-align:top}.ai1wm-include-media{display:inline-block;width:300px;margin:0 6px 0 0}.ai1wm-include-themes{display:inline-block;width:300px;vertical-align:top}.ai1wm-export-stats{margin-bottom:1em}#ai1wm-export-download{display:none;margin:0 0 2em}#ai1wm-export-download-stop{display:inline-block;margin:0 0 2em}#ai1wm-export-download.ai1wm-active{display:inline-block;-webkit-animation:ai1wm-fadein .5s;animation:ai1wm-fadein .5s}#ai1wm-export-download.ai1wm-emphasize{display:inline-block;-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}#ai1wm-export-download-size{display:block;color:#34495e}
|
1 |
+
@charset "UTF-8";.ai1wm-divider{-ms-box-sizing:border-box;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;border:none;height:0;background-color:transparent;font-size:14px;font-weight:700;text-align:center;text-transform:uppercase;color:rgba(0,0,0,.8);position:relative;top:0%;left:0%;margin:1rem 2.5rem;height:auto;padding:0;line-height:1}.ai1wm-divider:before,.ai1wm-divider:after{position:absolute;content:" ";z-index:3;width:50%;top:50%;height:0%;border-top:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(255,255,255,.8)}.ai1wm-divider:before{left:0%;margin-left:-2.5rem}.ai1wm-divider:after{left:auto;right:0%;margin-right:-2.5rem}@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}[class^="ai1wm-icon-"],[class*=" ai1wm-icon-"]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-chevron-down{display:inline-block;position:relative;-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg);margin-left:.5em!important}.ai1wm-icon-chevron-down:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-alone{margin:0!important}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:before,.ai1wm-row:after{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message,.ai1wm-right .ai1wm-http-authentication{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{margin:0;padding:0;float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-row,.ai1wm-right{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:before,.ai1wm-container:after{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 #fff;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-replace-row .ai1wm-field-inline{float:left;width:100%}.ai1wm-replace-row .ai1wm-field-inline input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type="text"],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#EFEFEF;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#F2F8F0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#F1D7D7;color:#A95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#D95C5C;border:2px solid #D95C5C;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#D95C5C}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block}.ai1wm-button-group.ai1wm-button-export{width:147px}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:180px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import{width:158px}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:210px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{padding:6px 25px 1px;height:22px}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:6px 25px 1px 26px;height:22px;line-height:22px;text-decoration:none;color:#27ae60;text-align:left}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{-webkit-transform:translate(11px,-1px);transform:translate(11px,-1px);position:relative;display:inline-block;width:12px;height:10px}.ai1wm-line{display:inline-block;width:100%;height:2px;margin:auto;background:#27ae60;position:absolute;transition:all .2s ease-in-out}.ai1wm-line-first{top:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third,.ai1wm-line-second{top:50%}.ai1wm-line-third{top:100%}.ai1wm-button-gray{border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-green{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-green-small{border:2px solid #6eb649;background-color:transparent;color:#6eb649;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue{border:2px solid #00aff0;background-color:transparent;color:#00aff0;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;background-color:transparent;color:#e74c3c;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-alone{border-radius:50px!important;padding:5px 8px!important}.ai1wm-button-blue[disabled="disabled"],.ai1wm-button-green[disabled="disabled"],.ai1wm-button-red[disabled="disabled"],.ai1wm-button-green-small[disabled="disabled"]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled="disabled"]:hover{color:#00aff0}.ai1wm-button-red[disabled="disabled"]:hover{color:#e74c3c}.ai1wm-button-green[disabled="disabled"]:hover{color:#27ae60}.ai1wm-button-blue[disabled="disabled"]:hover,.ai1wm-button-green[disabled="disabled"]:hover,.ai1wm-button-red[disabled="disabled"]:hover,.ai1wm-button-green-small[disabled="disabled"]:hover{background:0 0}.ai1wm-button-gray i,.ai1wm-button-green i,.ai1wm-button-blue i,.ai1wm-button-red i{margin-left:-.5em;margin-right:.2em}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type="radio"].ai1wm-flat-radio-button{display:none}input[type="radio"].ai1wm-flat-radio-button+a i,input[type="radio"].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type="radio"].ai1wm-flat-radio-button:checked+a i,input[type="radio"].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:before,.ai1wm-clear:after{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-list-expanded{display:block!important}.ai1wm-field-inline input{border-radius:5px}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #D6D6D6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-feedback-cancel:active{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:none;color:#333;text-deciration:none}.ai1wm-feedback-types>li>a>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url("../img/logo.svg") no-repeat center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:left;line-height:1.5em}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.ai1wm-accordion{margin:1em 0;display:block}.ai1wm-accordion h4{cursor:pointer;color:rgba(0,116,162,.8);margin:0}.ai1wm-accordion h4 small{color:#444;font-weight:400;display:inline}.ai1wm-accordion .ai1wm-icon-arrow-right{transition:-webkit-transform .1s ease-out;transition:transform .1s ease-out}.ai1wm-accordion ul{margin:0;padding:0;list-style:none;visibility:hidden;height:0;transition:height .2s cubic-bezier(.19,1,.22,1)}.ai1wm-accordion.ai1wm-open h4 .ai1wm-icon-arrow-right{-webkit-transform:rotate(90deg);transform:rotate(90deg);display:inline-block}.ai1wm-accordion.ai1wm-open ul{height:auto;margin:.6em 0 0 2em;visibility:visible}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-query-arrow{position:relative;top:4px;float:right}.ai1wm-query.ai1wm-open{background:#ebebeb!important}.ai1wm-query.ai1wm-open p small{border-bottom:1px dashed #000}.ai1wm-query.ai1wm-open div{visibility:visible!important;height:82px!important;margin-top:8px}.ai1wm-query.ai1wm-open .ai1wm-query-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ai1wm-query{width:100%;margin:0 0 10px;list-style:none;background:0 0;border:1px solid #d8d8d8;padding:10px;border-radius:5px;box-sizing:border-box}.ai1wm-query div{transition:height .2s cubic-bezier(.19,1,.22,1);visibility:hidden;height:0}.ai1wm-query div input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px;border:1px solid #ddd;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);background-color:#fff;color:#333;transition:.05s border-color ease-in-out;border-radius:5px}.ai1wm-query div input:focus{border-color:#5b9dd9;box-shadow:0 0 2px rgba(30,140,190,.8)}.ai1wm-query p{margin:0;cursor:pointer}.ai1wm-query p small{display:inline;width:auto;float:none}.ai1wm-query-arrow{transition:-webkit-transform .1s ease-out;transition:transform .1s ease-out}.ai1wm-include-tables{display:inline-block;width:300px;margin:0 6px 0 0}.ai1wm-include-plugins{display:inline-block;width:300px;vertical-align:top}.ai1wm-include-media{display:inline-block;width:300px;margin:0 6px 0 0}.ai1wm-include-themes{display:inline-block;width:300px;vertical-align:top}.ai1wm-export-stats{margin-bottom:1em}#ai1wm-export-download{display:none;margin:0 0 2em}#ai1wm-export-download-stop{display:inline-block;margin:0 0 2em}#ai1wm-export-download.ai1wm-active{display:inline-block;-webkit-animation:ai1wm-fadein .5s;animation:ai1wm-fadein .5s}#ai1wm-export-download.ai1wm-emphasize{display:inline-block;-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}#ai1wm-export-download-size{display:block;color:#34495e}
|
lib/view/assets/css/import.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@charset "UTF-8";.ai1wm-divider{-ms-box-sizing:border-box;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;border:none;height:0;background-color:transparent;font-size:14px;font-weight:700;text-align:center;text-transform:uppercase;color:rgba(0,0,0,.8);position:relative;top:0%;left:0%;margin:1rem 2.5rem;height:auto;padding:0;line-height:1}.ai1wm-divider:before,.ai1wm-divider:after{position:absolute;content:" ";z-index:3;width:50%;top:50%;height:0%;border-top:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(255,255,255,.8)}.ai1wm-divider:before{left:0%;margin-left:-2.5rem}.ai1wm-divider:after{left:auto;right:0%;margin-right:-2.5rem}@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}[class^="ai1wm-icon-"],[class*=" ai1wm-icon-"]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-chevron-down{display:inline-block;position:relative;-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg);margin-left:.5em!important}.ai1wm-icon-chevron-down:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-alone{margin:0!important}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:before,.ai1wm-row:after{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message,.ai1wm-right .ai1wm-http-authentication{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{margin:0;padding:0;float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-row,.ai1wm-right{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:before,.ai1wm-container:after{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 #fff;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-replace-row .ai1wm-field-inline{float:left;width:100%}.ai1wm-replace-row .ai1wm-field-inline input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type="text"],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#EFEFEF;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#F2F8F0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#F1D7D7;color:#A95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#D95C5C;border:2px solid #D95C5C;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#D95C5C}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block}.ai1wm-button-group.ai1wm-button-export{width:147px}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:150px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import{width:158px}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:180px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{padding:6px 25px 1px;height:22px}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:6px 25px 1px 26px;height:22px;line-height:22px;text-decoration:none;color:#27ae60;text-align:left}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{-webkit-transform:translate(11px,-1px);transform:translate(11px,-1px);position:relative;display:inline-block;width:12px;height:10px}.ai1wm-line{display:inline-block;width:100%;height:2px;margin:auto;background:#27ae60;position:absolute;transition:all .2s ease-in-out}.ai1wm-line-first{top:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third,.ai1wm-line-second{top:50%}.ai1wm-line-third{top:100%}.ai1wm-button-gray{border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-green{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-green-small{border:2px solid #6eb649;background-color:transparent;color:#6eb649;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue{border:2px solid #00aff0;background-color:transparent;color:#00aff0;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;background-color:transparent;color:#e74c3c;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-alone{border-radius:50px!important;padding:5px 8px!important}.ai1wm-button-blue[disabled="disabled"],.ai1wm-button-green[disabled="disabled"],.ai1wm-button-red[disabled="disabled"],.ai1wm-button-green-small[disabled="disabled"]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled="disabled"]:hover{color:#00aff0}.ai1wm-button-red[disabled="disabled"]:hover{color:#e74c3c}.ai1wm-button-green[disabled="disabled"]:hover{color:#27ae60}.ai1wm-button-blue[disabled="disabled"]:hover,.ai1wm-button-green[disabled="disabled"]:hover,.ai1wm-button-red[disabled="disabled"]:hover,.ai1wm-button-green-small[disabled="disabled"]:hover{background:0 0}.ai1wm-button-gray i,.ai1wm-button-green i,.ai1wm-button-blue i,.ai1wm-button-red i{margin-left:-.5em;margin-right:.2em}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type="radio"].ai1wm-flat-radio-button{display:none}input[type="radio"].ai1wm-flat-radio-button+a i,input[type="radio"].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type="radio"].ai1wm-flat-radio-button:checked+a i,input[type="radio"].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:before,.ai1wm-clear:after{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-list-expanded{display:block!important}.ai1wm-field-inline input{border-radius:5px}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #D6D6D6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-feedback-cancel:active{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:none;color:#333;text-deciration:none}.ai1wm-feedback-types>li>a>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url("../img/logo.svg") no-repeat center center}.ai1wm-hide{display:none}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-growl-info{position:fixed;z-index:200000;top:0;margin-top:16px;right:16px;width:200px;padding:16px;background:#f1c40f;border:1px solid #e67e22;border-radius:5px;color:#111}.ai1wm-drag-drop-area{border:3px dashed #ddd;height:200px;margin:20px 0 16px;background:#fff;text-align:center;border-radius:30px}.ai1wm-drag-drop-area.dragover{background:rgba(255,255,255,.4);border-color:green}.ai1wm-drag-over .ai1wm-drag-drop-area{border-color:#83b4d8}.ai1wm-import-form{position:relative}#ai1wm-import-init{position:absolute;top:10px;left:10%;width:80%;text-align:center}#ai1wm-import-init>p{font-size:18px;color:#9e9e9e}#ai1wm-import-init>p>i{font-size:46px}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-unlimited-import a{text-decoration:none}.ai1wm-max-upload-size{border-bottom:1px solid #000}.ai1wm-progress-bar{position:relative;display:inline-block;background-color:#bdc3c7;height:32px;width:100%;border-radius:15px;top:35px}.ai1wm-progress-bar-meter{background-color:#2ecc71;border-radius:15px;width:0;text-align:center}.ai1wm-progress-bar-meter,.ai1wm-progress-bar-percent{display:inline-block;float:left;height:32px;line-height:32px;color:#fff}.ai1wm-progress-bar-percent{position:absolute;width:50px;left:50%;-webkit-transform:translate(-24px,0);transform:translate(-24px,0);font-size:.5em;background:0 0}
|
1 |
+
@charset "UTF-8";.ai1wm-divider{-ms-box-sizing:border-box;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;border:none;height:0;background-color:transparent;font-size:14px;font-weight:700;text-align:center;text-transform:uppercase;color:rgba(0,0,0,.8);position:relative;top:0%;left:0%;margin:1rem 2.5rem;height:auto;padding:0;line-height:1}.ai1wm-divider:before,.ai1wm-divider:after{position:absolute;content:" ";z-index:3;width:50%;top:50%;height:0%;border-top:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(255,255,255,.8)}.ai1wm-divider:before{left:0%;margin-left:-2.5rem}.ai1wm-divider:after{left:auto;right:0%;margin-right:-2.5rem}@-webkit-keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@keyframes ai1wm-rotate{0%{-webkit-transform:rotateZ(0);transform:rotateZ(0)}25%{-webkit-transform:rotateZ(-90deg);transform:rotateZ(-90deg)}50%{-webkit-transform:rotateZ(-180deg);transform:rotateZ(-180deg)}75%{-webkit-transform:rotateZ(-270deg);transform:rotateZ(-270deg)}100%{-webkit-transform:rotateZ(-360deg);transform:rotateZ(-360deg)}}@-webkit-keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-emphasize{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);transform:scale(1.2)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes ai1wm-fadein{0%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1.5);transform:scale(1.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}[class^="ai1wm-icon-"],[class*=" ai1wm-icon-"]{font-family:'servmask';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ai1wm-icon-file-zip:before{content:"\e60f"}.ai1wm-icon-folder:before{content:"\e60e"}.ai1wm-icon-file:before{content:"\e60b"}.ai1wm-icon-file-content:before{content:"\e60c"}.ai1wm-icon-cloud-upload:before{content:"\e600"}.ai1wm-icon-history:before{content:"\e603"}.ai1wm-icon-notification:before{content:"\e619"}.ai1wm-icon-arrow-down:before{content:"\e604"}.ai1wm-icon-close:before{content:"\e61a"}.ai1wm-icon-wordpress2:before{content:"\e620"}.ai1wm-icon-arrow-right:before{content:"\e605"}.ai1wm-icon-plus2:before{content:"\e607"}.ai1wm-icon-export:before{content:"\e601"}.ai1wm-icon-publish:before{content:"\e602"}.ai1wm-icon-paperplane:before{content:"\e608"}.ai1wm-icon-help:before{content:"\e609"}.ai1wm-icon-chevron-right:before{content:"\e60d"}.ai1wm-icon-chevron-down{display:inline-block;position:relative;-webkit-transform:rotateZ(90deg);transform:rotateZ(90deg);margin-left:.5em!important}.ai1wm-icon-chevron-down:before{content:"\e60d"}.ai1wm-icon-dropbox:before{content:"\e606"}.ai1wm-icon-gear:before{content:"\e60a"}.ai1wm-icon-alone{margin:0!important}@media (min-width:855px){.ai1wm-row{margin-right:399px}.ai1wm-row:before,.ai1wm-row:after{content:" ";display:table}.ai1wm-row:after{clear:both}.ai1wm-left{float:left;width:100%}.ai1wm-right{float:right;width:377px;margin-right:-399px}.ai1wm-right .ai1wm-sidebar{width:100%}.ai1wm-right .ai1wm-segment{width:333px;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;color:#333;background-color:#f9f9f9;padding:20px;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box}.ai1wm-right .ai1wm-segment h2{margin:22px 0 0;padding:0;font-weight:700;font-size:14px;text-transform:uppercase;text-align:center}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message,.ai1wm-right .ai1wm-http-authentication{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-holder{position:relative;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-holder h1{margin:0;padding:0;float:left;font-weight:300;font-size:22px;text-transform:uppercase}.ai1wm-holder h1 i{position:relative;top:2px}@media (max-width:854px){.ai1wm-container{margin-left:10px!important}.ai1wm-row,.ai1wm-right{margin-right:0!important}.ai1wm-right{float:left!important;width:100%!important;margin-top:18px}.ai1wm-right .ai1wm-sidebar{width:auto!important;border:1px solid #d6d6d6;border-radius:3px;box-shadow:inset 0 1px 0 0 #fff;padding:20px;background:#f9f9f9}.ai1wm-right .ai1wm-feedback-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-right .ai1wm-feedback-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-right .ai1wm-feedback-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px;border-radius:3px}.ai1wm-right .ai1wm-feedback-terms-segment>.ai1wm-feedback-terms{border-radius:3px}}.ai1wm-container{margin:20px 20px 0 2px}.ai1wm-container:before,.ai1wm-container:after{content:" ";display:table}.ai1wm-container:after{clear:both}.ai1wm-replace-row{width:100%;box-shadow:outset 0 1px 0 0 #fff;border-radius:3px;color:#333;font-size:11px;font-weight:700;background-color:#f9f9f9;text-decoration:none;text-shadow:0 1px 0 #fff;background-clip:padding-box;margin-bottom:10px}.ai1wm-replace-row .ai1wm-field-inline{float:left;width:100%}.ai1wm-replace-row .ai1wm-field-inline input{width:100%;font-weight:400;font-size:.8rem;padding:0 10px;height:2.3rem;line-height:2.3rem;margin-bottom:4px}.ai1wm-field{margin-bottom:4px}.ai1wm-field input[type="text"],.ai1wm-field textarea{width:100%;font-weight:400}.ai1wm-field-set{margin-top:18px}.ai1wm-message{-moz-box-sizing:border-box;background-color:#EFEFEF;border-radius:4px;color:rgba(0,0,0,.6);height:auto;margin:10px 0;min-height:18px;padding:6px 10px;position:relative;border:1px solid;transition:opacity .1s ease 0s,color .1s ease 0s,background .1s ease 0s,box-shadow .1s ease 0s}.ai1wm-message.ai1wm-success-message{background-color:#F2F8F0;color:#119000;font-size:12px}.ai1wm-message.ai1wm-info-message{background-color:#d9edf7;color:#31708f;font-size:11px}.ai1wm-message.ai1wm-error-message{background-color:#F1D7D7;color:#A95252;font-size:12px}.ai1wm-message.ai1wm-red-message{color:#D95C5C;border:2px solid #D95C5C;background-color:transparent}.ai1wm-message.ai1wm-red-message h3{margin:.4em 0;color:#D95C5C}.ai1wm-message p{margin:4px 0;font-size:12px}.ai1wm-message-warning{display:block;font-size:14px;line-height:18px;padding:12px 20px;margin:0 0 22px;background-color:#f9f9f9;border:1px solid #d6d6d6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;border-left:4px solid #ffba00}.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block}.ai1wm-button-group.ai1wm-button-export{width:147px}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:180px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import{width:158px}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:210px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{padding:6px 25px 1px;height:22px}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:6px 25px 1px 26px;height:22px;line-height:22px;text-decoration:none;color:#27ae60;text-align:left}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{-webkit-transform:translate(11px,-1px);transform:translate(11px,-1px);position:relative;display:inline-block;width:12px;height:10px}.ai1wm-line{display:inline-block;width:100%;height:2px;margin:auto;background:#27ae60;position:absolute;transition:all .2s ease-in-out}.ai1wm-line-first{top:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third,.ai1wm-line-second{top:50%}.ai1wm-line-third{top:100%}.ai1wm-button-gray{border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-green{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-green-small{border:2px solid #6eb649;background-color:transparent;color:#6eb649;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue{border:2px solid #00aff0;background-color:transparent;color:#00aff0;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;background-color:transparent;color:#e74c3c;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-alone{border-radius:50px!important;padding:5px 8px!important}.ai1wm-button-blue[disabled="disabled"],.ai1wm-button-green[disabled="disabled"],.ai1wm-button-red[disabled="disabled"],.ai1wm-button-green-small[disabled="disabled"]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled="disabled"]:hover{color:#00aff0}.ai1wm-button-red[disabled="disabled"]:hover{color:#e74c3c}.ai1wm-button-green[disabled="disabled"]:hover{color:#27ae60}.ai1wm-button-blue[disabled="disabled"]:hover,.ai1wm-button-green[disabled="disabled"]:hover,.ai1wm-button-red[disabled="disabled"]:hover,.ai1wm-button-green-small[disabled="disabled"]:hover{background:0 0}.ai1wm-button-gray i,.ai1wm-button-green i,.ai1wm-button-blue i,.ai1wm-button-red i{margin-left:-.5em;margin-right:.2em}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type="radio"].ai1wm-flat-radio-button{display:none}input[type="radio"].ai1wm-flat-radio-button+a i,input[type="radio"].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type="radio"].ai1wm-flat-radio-button:checked+a i,input[type="radio"].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-clear{*zoom:1;clear:both}.ai1wm-clear:before,.ai1wm-clear:after{content:" ";display:table}.ai1wm-clear:after{clear:both}.ai1wm-list-expanded{display:block!important}.ai1wm-field-inline input{border-radius:5px}.ai1wm-container .ai1wm-row label{position:relative;top:-1px}.ai1wm-share-button-container{text-align:center}.ai1wm-share-button-container .ai1wm-share-button{text-decoration:none;margin:10px;font-size:30px}.ai1wm-report-problem{position:relative;float:right}.ai1wm-report-problem-dialog{position:absolute;z-index:999;width:280px;right:0;background-color:#fff;margin:6px 0 0;padding:15px 15px 10px;border:1px solid #D6D6D6;border-radius:3px;box-shadow:0 1px 0 0 #fff inset;display:none}.ai1wm-report-email{width:100%;font-weight:400;font-size:.8rem;height:2.3rem;line-height:2.3rem;border-radius:5px;margin-bottom:4px;padding:0 10px}.ai1wm-report-message{width:100%;border-radius:3px;font-size:.8rem;padding:6px 10px;resize:none}.ai1wm-report-cancel:link,.ai1wm-report-cancel:visited,.ai1wm-report-cancel:active,.ai1wm-feedback-cancel:link,.ai1wm-feedback-cancel:visited,.ai1wm-feedback-cancel:active{float:right;line-height:34px;outline:0;text-decoration:none;color:#e74c3c}.ai1wm-report-active{display:block}.ai1wm-report-terms-segment{font-size:.7rem;line-height:1rem;margin:4px 0 8px}.ai1wm-report-terms-segment>.ai1wm-report-terms{border-radius:3px}.ai1wm-no-underline{text-decoration:none}.ai1wm-top-negative-four{top:-4px}.ai1wm-feedback-form{display:none}.ai1wm-feedback-types{margin:0;padding:0;list-style:none}.ai1wm-feedback-types li{margin:14px 0;padding:0}.ai1wm-feedback-types>li>label>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-feedback-types>li>a{height:29px;outline:none;color:#333;text-deciration:none}.ai1wm-feedback-types>li>a>span{display:inline-block;padding:5px 0 6px 8px}.ai1wm-loader{display:inline-block;width:128px;height:128px;position:relative;-webkit-animation:ai1wm-rotate 1.5s infinite linear;animation:ai1wm-rotate 1.5s infinite linear;background:url("../img/logo.svg") no-repeat center center}.ai1wm-hide{display:none}.ai1wm-label{border:1px solid #5cb85c;background-color:transparent;color:#5cb85c;cursor:pointer;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;padding:.2em .6em;font-size:.8em;border-radius:5px}.ai1wm-label:hover{background-color:#5cb85c;color:#fff}.ai1wm-dialog-message{text-align:left;line-height:1.5em}.ai1wm-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:100001}.ai1wm-modal-container{position:fixed;display:none;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:16px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box;text-align:center}.ai1wm-modal-container section{display:block;min-height:102px}.ai1wm-modal-container section h1{margin:0;padding:0}.ai1wm-modal-container section h1 .ai1wm-title-green{color:#27ae60;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-title-red{color:#e74c3c;font-size:20px}.ai1wm-modal-container section h1 .ai1wm-loader{width:32px;height:32px}.ai1wm-modal-container section h1 .ai1wm-icon-notification{font-size:1.2em;color:#e74c3c}.ai1wm-modal-container section p{margin:0;padding:12px 0}.ai1wm-modal-container section p .ai1wm-modal-subtitle-green{color:#27ae60}.ai1wm-modal-container section p .ai1wm-modal-subtitle-red{color:#e74c3c}.ai1wm-modal-container section p .ai1wm-modal-subdescription{display:block;text-align:left}.ai1wm-modal-container section p a.ai1wm-button-green{display:inline-block;position:relative;top:26px}.ai1wm-modal-container section p a.ai1wm-emphasize{-webkit-animation:ai1wm-emphasize 1s infinite;animation:ai1wm-emphasize 1s infinite}.ai1wm-modal-container section p em{display:block;color:#34495e;font-style:normal}.ai1wm-growl-info{position:fixed;z-index:200000;top:0;margin-top:16px;right:16px;width:200px;padding:16px;background:#f1c40f;border:1px solid #e67e22;border-radius:5px;color:#111}.ai1wm-drag-drop-area{border:3px dashed #ddd;height:200px;margin:20px 0 16px;background:#fff;text-align:center;border-radius:30px}.ai1wm-drag-drop-area.dragover{background:rgba(255,255,255,.4);border-color:green}.ai1wm-drag-over .ai1wm-drag-drop-area{border-color:#83b4d8}.ai1wm-import-form{position:relative}#ai1wm-import-init{position:absolute;top:10px;left:10%;width:80%;text-align:center}#ai1wm-import-init>p{font-size:18px;color:#9e9e9e}#ai1wm-import-init>p>i{font-size:46px}.ai1wm-unlimited-import a{text-decoration:none}.ai1wm-max-upload-size{border-bottom:1px solid #000}.ai1wm-progress-bar{position:relative;display:inline-block;background-color:#bdc3c7;height:32px;width:100%;border-radius:15px;top:35px}.ai1wm-progress-bar-meter{background-color:#2ecc71;border-radius:15px;width:0;text-align:center}.ai1wm-progress-bar-meter,.ai1wm-progress-bar-percent{display:inline-block;float:left;height:32px;line-height:32px;color:#fff}.ai1wm-progress-bar-percent{position:absolute;width:50px;left:50%;-webkit-transform:translate(-24px,0);transform:translate(-24px,0);font-size:.5em;background:0 0}
|
lib/view/assets/css/updater.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@charset "UTF-8";.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block}.ai1wm-button-group.ai1wm-button-export{width:147px}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:
|
1 |
+
@charset "UTF-8";.ai1wm-button-group{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;text-transform:uppercase;font-weight:600;transition:background-color .2s ease-out;display:inline-block}.ai1wm-button-group.ai1wm-button-export{width:147px}.ai1wm-button-group.ai1wm-button-export.ai1wm-open>.ai1wm-dropdown-menu{height:180px;border-top:1px solid #27ae60}.ai1wm-button-group.ai1wm-button-import{width:158px}.ai1wm-button-group.ai1wm-button-import.ai1wm-open>.ai1wm-dropdown-menu{height:210px;border-top:1px solid #27ae60}.ai1wm-button-group .ai1wm-button-main{padding:6px 25px 1px;height:22px}.ai1wm-button-group .ai1wm-dropdown-menu{height:0;overflow:hidden;transition:height .2s cubic-bezier(.19,1,.22,1);border-top:none}.ai1wm-dropdown-menu{list-style:none}.ai1wm-dropdown-menu,.ai1wm-dropdown-menu li{margin:0!important;padding:0}.ai1wm-dropdown-menu li a,.ai1wm-dropdown-menu li a:visited{display:block;padding:6px 25px 1px 26px;height:22px;line-height:22px;text-decoration:none;color:#27ae60;text-align:left}.ai1wm-dropdown-menu li a:hover,.ai1wm-dropdown-menu li a:visited:hover{text-decoration:none;color:#111}.ai1mw-lines{-webkit-transform:translate(11px,-1px);transform:translate(11px,-1px);position:relative;display:inline-block;width:12px;height:10px}.ai1wm-line{display:inline-block;width:100%;height:2px;margin:auto;background:#27ae60;position:absolute;transition:all .2s ease-in-out}.ai1wm-line-first{top:0}div.ai1wm-open .ai1wm-line-first,div.ai1wm-open .ai1wm-line-third,.ai1wm-line-second{top:50%}.ai1wm-line-third{top:100%}.ai1wm-button-gray{border:2px solid #95a5a6;background-color:transparent;color:#95a5a6;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-gray:hover{background-color:#95a5a6;color:#fff}.ai1wm-button-green{border:2px solid #27ae60;background-color:transparent;color:#27ae60;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green:hover{background-color:#27ae60;color:#fff}.ai1wm-button-green-small{border:2px solid #6eb649;background-color:transparent;color:#6eb649;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-green-small:hover{background-color:#6eb649;color:#fff}.ai1wm-button-blue{border:2px solid #00aff0;background-color:transparent;color:#00aff0;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-blue:hover{background-color:#00aff0;color:#fff}.ai1wm-button-red{border:2px solid #e74c3c;background-color:transparent;color:#e74c3c;border-radius:5px;cursor:pointer;padding:5px 25px 5px 26px;text-transform:uppercase;font-weight:600;outline:none;transition:background-color .2s ease-out;text-decoration:none}.ai1wm-button-red:hover{background-color:#e74c3c;color:#fff}.ai1wm-button-alone{border-radius:50px!important;padding:5px 8px!important}.ai1wm-button-blue[disabled="disabled"],.ai1wm-button-green[disabled="disabled"],.ai1wm-button-red[disabled="disabled"],.ai1wm-button-green-small[disabled="disabled"]{opacity:.6;cursor:default}.ai1wm-button-blue[disabled="disabled"]:hover{color:#00aff0}.ai1wm-button-red[disabled="disabled"]:hover{color:#e74c3c}.ai1wm-button-green[disabled="disabled"]:hover{color:#27ae60}.ai1wm-button-blue[disabled="disabled"]:hover,.ai1wm-button-green[disabled="disabled"]:hover,.ai1wm-button-red[disabled="disabled"]:hover,.ai1wm-button-green-small[disabled="disabled"]:hover{background:0 0}.ai1wm-button-gray i,.ai1wm-button-green i,.ai1wm-button-blue i,.ai1wm-button-red i{margin-left:-.5em;margin-right:.2em}.ai1wm-message-close-button{position:absolute;right:10px;top:6px;text-decoration:none;font-size:10px}input[type="radio"].ai1wm-flat-radio-button{display:none}input[type="radio"].ai1wm-flat-radio-button+a i,input[type="radio"].ai1wm-flat-radio-button+label i{vertical-align:middle;float:left;width:25px;height:25px;border-radius:50%;background:0 0;border:2px solid #ccc;content:" ";cursor:pointer;position:relative;box-sizing:content-box}input[type="radio"].ai1wm-flat-radio-button:checked+a i,input[type="radio"].ai1wm-flat-radio-button:checked+label i{background-color:#d9d9d9;border-color:#6f6f6f}.ai1wm-icon-update{font-size:13px;padding:0;margin:0;font-weight:400}.ai1wm-icon-update:before{color:#d54e21;content:'\f463';display:inline-block;font:20px/1 'dashicons';speak:none;padding:0;margin:0;vertical-align:top}.ai1wm-modal-dialog{position:fixed;top:0;right:0;bottom:0;left:0;background:rgba(0,0,0,.7);z-index:99999;opacity:0;transition:opacity 400ms ease-in;pointer-events:none}.ai1wm-modal-dialog:target{opacity:1;pointer-events:auto}.ai1wm-modal-dialog .ai1wm-modal-container{position:fixed;top:50%;left:50%;z-index:100002;width:480px;height:auto;padding:6px 16px 10px;-webkit-transform:translate(-240px,-94px);transform:translate(-240px,-94px);border:1px solid #fff;box-shadow:0 2px 6px #292929;border-radius:6px;background:#f6f6f6;box-sizing:border-box}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-modal-error{color:red}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-modal-buttons{text-align:left}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-purchase-id{width:100%;padding:6px}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-help-link{font-weight:700}.ai1wm-modal-dialog .ai1wm-modal-container .ai1wm-purchase-discard{margin-left:1em}
|
lib/view/assets/javascript/backup.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function e(a,t,i){function r(s,n){if(!t[s]){if(!a[s]){var m="function"==typeof require&&require;if(!n&&m)return m(s,!0);if(c)return c(s,!0);throw new Error("Cannot find module '"+s+"'")}var o=t[s]={exports:{}};a[s][0].call(o.exports,function(e){var t=a[s][1][e];return r(t?t:e)},o,o.exports,e,a,t,i)}return t[s].exports}for(var c="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e){e("./servmask/report"),e("./servmask/maintenance"),e("./servmask/feedback");jQuery(document).ready(function(e){"use strict";e(".ai1wm-backup-actions > a").hover(function(){e(this).addClass("ai1wm-button-on")},function(){e(this).removeClass("ai1wm-button-on")}),e(".ai1wm-backup-delete").click(function(a){var t=e(this),i=t.data("delete-file");confirm("Are you sure you want to delete this file?")&&e.ajax({type:"POST",url:ai1wm_backup.ajax.url,data:{file:i},success:function(a){var i=a.errors;0===i.length&&(t.closest("tr").remove(),0===e(".ai1wm-backups tbody tr").length&&(e(".ai1wm-backups").addClass("ai1wm-hide"),e(".ai1wm-backups-empty").removeClass("ai1wm-hide")))},dataType:"json"}),a.preventDefault()})})},{"./servmask/feedback":2,"./servmask/maintenance":3,"./servmask/report":4}],2:[function(){jQuery(document).ready(function(e){"use strict";e(".ai1wm-feedback-type").attr("checked",!1),e("#ai1wm-feedback-type-link-1").click(function(a){var t=e("#ai1wm-feedback-type-1");t.is(":checked")?(t.attr("checked",!1),a.preventDefault()):t.attr("checked",!0)}),e("#ai1wm-feedback-type-2").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-3").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","Leave plugin developers any feedback here"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-type-3").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-2").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","How may we help you?"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-cancel").click(function(a){e(".ai1wm-feedback-form").fadeOut(function(){e(".ai1wm-feedback-type").attr("checked",!1).closest("li").show()}),a.preventDefault()}),e("#ai1wm-feedback-submit").click(function(){var a=ai1wm_feedback.ajax.url,t=e(".ai1wm-feedback-type:checked").val(),i=e(".ai1wm-feedback-email").val(),r=e(".ai1wm-feedback-message").val(),c=e(".ai1wm-feedback-terms").is(":checked");e.ajax({type:"POST",url:a,data:{type:t,email:i,message:r,terms:+c},success:function(a){var t=a.errors;if(t.length>0){e(".ai1wm-feedback .ai1wm-message").remove();var i=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(t,function(e,a){i.append("<p>"+a+"</p>")}),e(".ai1wm-feedback").prepend(i)}else{var r=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your feedback!</p>");e(".ai1wm-feedback").html(r)}},dataType:"json",async:!1})})})},{}],3:[function(){jQuery(document).ready(function(e){"use strict";e("#ai1wm-maintenance-off").click(function(a){var t=ai1wm_maintenance.ajax.url,i=e(this);e.ajax({type:"POST",url:t,success:function(){i.closest(".ai1wm-message-warning").remove()}}),a.preventDefault()})})},{}],4:[function(){jQuery(document).ready(function(e){"use strict";e("#ai1wm-report-problem-button").click(function(a){e(this).next(".ai1wm-report-problem-dialog").toggleClass("ai1wm-report-active"),a.preventDefault()}),e("#ai1wm-report-cancel").click(function(a){e(this).closest(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active"),a.preventDefault()}),e("#ai1wm-report-submit").click(function(){var a=ai1wm_report.ajax.url,t=e(".ai1wm-report-email").val(),i=e(".ai1wm-report-message").val(),r=e(".ai1wm-report-terms").is(":checked");e.ajax({type:"POST",url:a,data:{email:t,message:i,terms:+r},success:function(a){var t=a.errors;if(t.length>0){e(".ai1wm-report-problem-dialog .ai1wm-message").remove();var i=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(t,function(e,a){i.append("<p>"+a+"</p>")}),e(".ai1wm-report-problem-dialog").prepend(i)}else{var r=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your request!</p>");e(".ai1wm-report-problem-dialog").html(r),setTimeout(function(){e(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active")},2e3)}},dataType:"json",async:!1})})})},{}]},{},[1]);
|
|
lib/view/assets/javascript/backups.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function e(a,t,i){function o(n,s){if(!t[n]){if(!a[n]){var p="function"==typeof require&&require;if(!s&&p)return p(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var c=t[n]={exports:{}};a[n][0].call(c.exports,function(e){var t=a[n][1][e];return o(t?t:e)},c,c.exports,e,a,t,i)}return t[n].exports}for(var r="function"==typeof require&&require,n=0;n<i.length;n++)o(i[n]);return o}({1:[function(e){var a=(e("./servmask/report"),e("./servmask/feedback"),e("./servmask/util")),t=e("./import/import");jQuery(document).ready(function(e){"use strict";e(".ai1wm-backup-actions > a").hover(function(){e(this).addClass("ai1wm-button-on")},function(){e(this).removeClass("ai1wm-button-on")}),e(".ai1wm-backup-delete").click(function(a){var t=e(this);confirm("Are you sure you want to delete this file?")&&e.ajax({type:"POST",url:ai1wm_backups.ajax.url,data:{archive:t.data("archive")},success:function(a){var i=a.errors;0===i.length&&(t.closest("tr").remove(),0===e(".ai1wm-backups tbody tr").length&&(e(".ai1wm-backups").addClass("ai1wm-hide"),e(".ai1wm-backups-empty").removeClass("ai1wm-hide")))},dataType:"json"}),a.preventDefault()});var i=new t;e(".ai1wm-backup-restore").click(function(t){var o=a.random(12),r=e(this).data("archive");i.start({storage:o,archive:r,backups:!0}),i.onConfirm=function(){i.confirm({storage:o,archive:r,backups:!0,priority:150})},t.preventDefault()})})},{"./import/import":2,"./servmask/feedback":4,"./servmask/report":5,"./servmask/util":6}],2:[function(e,a){var t=e("./modal"),i=jQuery,o=function(){var e=this;this.modal=new t,this.modal.onConfirm=function(){e.onConfirm()},this.modal.onStop=function(){e.onStop()}};o.prototype.start=function(e){var a=this;i(window).bind("beforeunload",function(){return"You are about to stop importing your website, are you sure?"}),this.stop=!1,this.setStatus({type:"info",message:"Preparing to import..."}),i.post(ai1wm_import.ajax.url,i.extend({secret_key:ai1wm_import.secret_key},e)).done(function(){a.getStatus()}).fail(function(){a.setStatus({type:"error",message:"Unable to start the import. Refresh the page and try again"})})},o.prototype.confirm=function(e){var a=this;i.post(ai1wm_import.ajax.url,i.extend({secret_key:ai1wm_import.secret_key},e)).done(function(){a.getStatus(ai1wm_import.status.php)}).fail(function(){a.setStatus({type:"error",message:"Unable to confirm the import. Refresh the page and try again"})})},o.prototype.clean=function(e){var a=this;this.stop=!0,i.post(ai1wm_import.ajax.url,i.extend({secret_key:ai1wm_import.secret_key},e)).done(function(){i(window).unbind("beforeunload")}).fail(function(){a.setStatus({type:"error",message:"Unable to clean the import. Refresh the page and try again"})})},o.prototype.getStatus=function(e,a){var t=this,a=a||0;this.stop||i.ajax({cache:!1,url:e,dataType:"json"}).done(function(o){if(o)switch(t.setStatus(o),o.type){case"done":case"error":return i(window).unbind("beforeunload"),void 0;case"confirm":return}setTimeout(function(){t.getStatus(e,a)},3e3)}).fail(function(){a++,a>=6?t.setStatus({type:"error",message:"Unable to retrieve status of the export. Is your server running?"}):a>=3?t.getStatus(ai1wm_import.status.js,a):t.getStatus(ai1wm_import.status.php,a)})},o.prototype.setStatus=function(e){this.modal.render(e)},o.prototype.onConfirm=function(){throw"onConfirm event is not implemented"},o.prototype.onStop=function(){throw"onStop event is not implemented"},a.exports=o},{"./modal":3}],3:[function(e,a){var t=jQuery,i=function(){var e=this;this.error=function(a){var i=t("<div></div>"),o=t("<section></section>"),r=t("<h1></h1>"),n=t("<p></p>").html(a.message),s=t("<div></div>"),p=t("<span></span>").addClass("ai1wm-title-red").text("Unable to import"),c=t('<button class="ai1wm-button-red">Close</button>').on("click",function(){e.modal.hide(),e.overlay.hide()});s.append(c),r.append(p),o.append(r).append(n),i.append(o).append(s),e.modal.html(i).show(),e.overlay.show()},this.progress=function(a){var i=t("<div></div>"),o=t("<section></section>"),r=t("<h1></h1>"),n=(t("<p></p>"),t("<div></div>")),s=t('<span class="ai1wm-progress-bar"></span>'),p=t('<span class="ai1wm-progress-bar-meter"></span>').width(a.percent+"%"),c=t('<span class="ai1wm-progress-bar-percent">0%</span>').text(a.percent+"%"),m=t('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').on("click",function(){t(this).attr("disabled","disabled"),e.onStop(),e.modal.hide(),e.overlay.hide()});s.append(p).append(c),n.append(m),r.append(s),o.append(r),i.append(o).append(n),e.modal.html(i).show(),e.overlay.show()},this.confirm=function(a){var i=t("<div></div>"),o=t("<section></section>"),r=t("<h1></h1>"),n=t("<p></p>").html(a.message),s=t("<div></div>"),p=t('<span class="ai1wm-icon-notification"></span>'),c=t('<button class="ai1wm-button-green">Continue</button>').on("click",function(){t(this).attr("disabled","disabled"),e.onConfirm()});s.append(c),r.append(p),o.append(r).append(n),i.append(o).append(s),e.modal.html(i).show(),e.overlay.show()},this.info=function(a){var i=t("<div></div>"),o=t("<section></section>"),r=t("<h1></h1>"),n=t("<p></p>").html(a.message),s=t("<div></div>"),p=t('<span class="ai1wm-loader"></span>'),c=t('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').attr("disabled","disabled");s.append(c),r.append(p),o.append(r).append(n),i.append(o).append(s),e.modal.html(i).show(),e.overlay.show()},this.done=function(a){var i=t("<div></div>"),o=t("<section></section>"),r=t("<h1></h1>"),n=t("<p></p>").html(a.message),s=t("<div></div>"),p=t("<span></span>").addClass("ai1wm-title-green").text(a.title),c=t('<button class="ai1wm-button-red">Close</button>').on("click",function(){e.modal.hide(),e.overlay.hide()});s.append(c),r.append(p),o.append(r).append(n),i.append(o).append(s),e.modal.html(i).show(),e.overlay.show()},this.overlay=t('<div class="ai1wm-overlay"></div>'),this.modal=t('<div class="ai1wm-modal-container"></div>'),t("body").append(this.overlay).append(this.modal)};i.prototype.render=function(e){switch(e.type){case"error":this.error(e);break;case"confirm":this.confirm(e);break;case"progress":this.progress(e);break;case"info":this.info(e);break;case"done":this.done(e)}},a.exports=i},{}],4:[function(){jQuery(document).ready(function(e){"use strict";e(".ai1wm-feedback-type").attr("checked",!1),e("#ai1wm-feedback-type-link-1").click(function(a){var t=e("#ai1wm-feedback-type-1");t.is(":checked")?(t.attr("checked",!1),a.preventDefault()):t.attr("checked",!0)}),e("#ai1wm-feedback-type-2").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-3").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","Leave plugin developers any feedback here"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-type-3").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-2").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","How may we help you?"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-cancel").click(function(a){e(".ai1wm-feedback-form").fadeOut(function(){e(".ai1wm-feedback-type").attr("checked",!1).closest("li").show()}),a.preventDefault()}),e("#ai1wm-feedback-submit").click(function(){var a=e(".ai1wm-feedback-type:checked").val(),t=e(".ai1wm-feedback-email").val(),i=e(".ai1wm-feedback-message").val(),o=e(".ai1wm-feedback-terms").is(":checked");e.ajax({type:"POST",url:ai1wm_feedback.ajax.url,data:{"ai1wm-type":a,"ai1wm-email":t,"ai1wm-message":i,"ai1wm-terms":+o},success:function(a){var t=a.errors;if(t.length>0){e(".ai1wm-feedback .ai1wm-message").remove();var i=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(t,function(e,a){i.append("<p>"+a+"</p>")}),e(".ai1wm-feedback").prepend(i)}else{var o=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your feedback!</p>");e(".ai1wm-feedback").html(o)}},dataType:"json",async:!1})})})},{}],5:[function(){jQuery(document).ready(function(e){"use strict";e("#ai1wm-report-problem-button").click(function(a){e(this).next(".ai1wm-report-problem-dialog").toggleClass("ai1wm-report-active"),a.preventDefault()}),e("#ai1wm-report-cancel").click(function(a){e(this).closest(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active"),a.preventDefault()}),e("#ai1wm-report-submit").click(function(){var a=e(".ai1wm-report-email").val(),t=e(".ai1wm-report-message").val(),i=e(".ai1wm-report-terms").is(":checked");e.ajax({type:"POST",url:ai1wm_report.ajax.url,data:{"ai1wm-email":a,"ai1wm-message":t,"ai1wm-terms":+i},success:function(a){var t=a.errors;if(t.length>0){e(".ai1wm-report-problem-dialog .ai1wm-message").remove();var i=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(t,function(e,a){i.append("<p>"+a+"</p>")}),e(".ai1wm-report-problem-dialog").prepend(i)}else{var o=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your request!</p>");e(".ai1wm-report-problem-dialog").html(o),setTimeout(function(){e(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active")},2e3)}},dataType:"json",async:!1})})})},{}],6:[function(e,a){var t=jQuery;a.exports={random:function(e){for(var a="",t="abcdefghijklmnopqrstuvwxyz0123456789",i=0;e>i;i++)a+=t.charAt(Math.floor(Math.random()*t.length));return a},form:function(e){return t(e).serializeArray()},ucfirst:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}}},{}]},{},[1]);
|
lib/view/assets/javascript/export.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function e(t,a,i){function s(o,n){if(!a[o]){if(!t[o]){var c="function"==typeof require&&require;if(!n&&c)return c(o,!0);if(r)return r(o,!0);throw new Error("Cannot find module '"+o+"'")}var m=a[o]={exports:{}};t[o][0].call(m.exports,function(e){var a=t[o][1][e];return s(a?a:e)},m,m.exports,e,t,a,i)}return a[o].exports}for(var r="function"==typeof require&&require,o=0;o<i.length;o++)s(i[o]);return s}({1:[function(e){var t=(e("./jquery/query"),e("./jquery/find_replace"),e("./jquery/message_close"),e("./servmask/report"),e("./servmask/maintenance"),e("./servmask/feedback"),e("./servmask/export_controller"));jQuery(document).ready(function(e){"use strict";e("#ai1wm-export-file").click(function(e){e.preventDefault();var a=new t("file");a.start()}),e(".ai1wm-accordion > .ai1wm-title").click(function(){e(this).parent().toggleClass("ai1wm-active")}),e("#ai1wm-add-new-replace-button").ai1wm_find_replace(),e(".ai1wm-message-close-button").ai1wm_message_close(),e(".ai1wm-expandable > p:first, .ai1wm-expandable > h4:first, .ai1wm-expandable > div.ai1wm-button-main").on("click",function(){e(this).parent().toggleClass("ai1wm-open")}),e(".ai1wm-collapsable").ai1wm_query()})},{"./jquery/find_replace":2,"./jquery/message_close":3,"./jquery/query":4,"./servmask/export_controller":6,"./servmask/feedback":8,"./servmask/maintenance":9,"./servmask/report":10}],2:[function(){!function(e){e.fn.ai1wm_find_replace=function(){return e(this).click(function(t){t.preventDefault();var a=e("#ai1wm-queries > li:first").clone();a.find("input").val(""),a.find(".ai1wm-query-find-text").html("<text>"),a.find(".ai1wm-query-replace-text").html("<another-text>"),e("#ai1wm-queries > li").removeClass("ai1wm-open"),e(a).addClass("ai1wm-open"),e("#ai1wm-queries").append(a),e(a).ai1wm_query(),e(a).find("p:first").on("click",function(){e(this).parent().toggleClass("ai1wm-open")})}),this}}(jQuery)},{}],3:[function(){!function(e){e.fn.ai1wm_message_close=function(){return e(this).click(function(t){var a=ai1wm_message.ajax.url,i=e(this),s=i.attr("data-key");e.ajax({type:"POST",url:a,data:{key:s},success:function(e){var t=e.errors;0===t.length&&i.closest(".ai1wm-message").remove()},dataType:"json"}),t.preventDefault()}),this}}(jQuery)},{}],4:[function(){!function(e){e.fn.ai1wm_query=function(){var t=e(this).find("input.ai1wm-query-find-input"),a=e(this).find("input.ai1wm-query-replace-input"),i=e(this).find("small.ai1wm-query-find-text"),s=e(this).find("small.ai1wm-query-replace-text");return t.on("change paste input keypress keydown keyup",function(){var t=e(this).val().length>0?e(this).val():"<text>";i.text(t)}),a.on("change paste input keypress keydown keyup",function(){var t=e(this).val().length>0?e(this).val():"<another-text>";s.text(t)}),this}}(jQuery)},{}],5:[function(e,t){var a=jQuery,i=function(e){this._stop=!1,this._provider=e,this._storage=this.random(12)};i.prototype.start=function(e){var t=this,i=new jQuery.Deferred,s=e.concat("&",a.param({method:"start",secret_key:ai1wm_export.secret_key,provider:t._provider,storage:t._storage}));return a.post(ai1wm_export.ajax.url,s).done(function(){t.getStatus(ai1wm_export.status.php).progress(function(e){i.notify(e)}).done(function(){i.resolve()}).fail(function(e){i.reject(e)})}).fail(function(){i.reject({message:"Unable to start the export. Refresh the page and try again"})}),i.promise()},i.prototype.getStatus=function(e,t,i){var s=this;return t=t||new jQuery.Deferred,i=i||0,s._stop?t.resolve():(a.ajax({cache:!1,url:e,dataType:"json"}).done(function(i){if(i)switch(t.notify(i),i.type){case"finish":case"download":t.resolve(),a.post(ai1wm_export.ajax.url,{method:"clean",secret_key:ai1wm_export.secret_key,provider:s._provider,storage:s._storage});break;default:setTimeout(function(){s.getStatus(e,t)},3e3)}}).fail(function(){i++,i>=6?t.reject({message:"Unable to retrieve status of the export. Is your server running?"}):i>=3?s.getStatus(ai1wm_export.status.js,t,i):s.getStatus(ai1wm_export.status.php,t,i)}),t.promise())},i.prototype.stop=function(e,t){var e=new jQuery.Deferred,i=this;return e=e||new jQuery.Deferred,t=t||0,t>0?e.notify({message:"Please wait, stopping the export... Retry "+t}):(e.notify({message:"Please wait, stopping the export..."}),i._stop=!0),a.post(ai1wm_export.ajax.url,{method:"stop",secret_key:ai1wm_export.secret_key,provider:i._provider,storage:i._storage}).done(function(){e.resolve()}).fail(function(){t++,t>=3?e.reject({message:"Unable to retrieve status of the export. Is your server running?"}):i.stop(e,t)}),e.promise()},i.prototype.random=function(e){for(var t="",a="abcdefghijklmnopqrstuvwxyz0123456789",i=0;e>i;i++)t+=a.charAt(Math.floor(Math.random()*a.length));return t},t.exports=i},{}],6:[function(e,t){(function(a){var i=e("./export_modal"),s=e("./export"),r=jQuery,o=function(e){this._export=new s(e),this._modal=new i};o.prototype.start=function(){var e=this;this._modal._stop.on("click",function(t){t.preventDefault(),e.stop()}),this._modal._close.on("click",function(t){t.preventDefault(),e._modal.remove()}),this._modal.show(),e._modal._loader.show(),e._modal._stop.show();var t=r("#ai1wm-export-form").serialize();e.display({type:"info",message:"Preparing to export..."}),this._export.start(t).progress(function(t){e.display(t)}).done(function(){}).fail(function(e){alert(e.message)})},o.prototype.display=function(e){var t=this;switch(t._modal.reset(),t._modal.show(),e.type){case"error":t._modal._title.html(e.title),t._modal._title.addClass("ai1wm-title-red"),t._modal._title.show(),t._modal._message.html(e.message),t._modal._message.css("text-align","left"),t._modal._message.show(),t._modal._close.show();break;case"download":t._modal._message.html(e.message),t._modal._message.show(),t._modal._close.show();break;case"finish":t._modal._title.html(e.title),t._modal._title.addClass("ai1wm-title-green"),t._modal._title.show(),t._modal._message.html(e.message),t._modal._message.show(),t._modal._close.show();break;default:t._modal._loader.show(),t._modal._message.html(e.message),t._modal._message.show(),t._modal._stop.show()}},o.prototype.stop=function(){var e=this;this._export.stop().progress(function(t){e.display(t)}).done(function(){e._modal.remove()}).fail(function(e){alert(e)})},t.exports=o,a.window.Ai1wmExportController=o}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./export":5,"./export_modal":7}],7:[function(e,t){var a=jQuery,i=function(){this._overlay=a('<div class="ai1wm-overlay"></div>'),this._modal=a('<div class="ai1wm-modal-container"></div>'),this._section=a("<section></section>"),this._header=a("<h1></h1>"),this._message=a("<p></p>").hide(),this._action=a("<div></div>"),this._title=a("<span></span>").hide(),this._loader=a('<span class="ai1wm-loader"></span>').hide(),this._warning=a('<span class="ai1wm-icon-notification"></span>').hide(),this._progressBar=a('<span class="ai1wm-progress-bar"></span>').hide(),this._progressBarMeter=a('<span class="ai1wm-progress-bar-meter"></span>'),this._progressBarPercent=a('<span class="ai1wm-progress-bar-percent">0%</span>'),this._stop=a('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop export</button>').hide(),this._close=a('<button class="ai1wm-button-red">Close</button>').hide(),this._confirm=a('<button class="ai1wm-button-green">Continue</button>').hide(),this._progressBar.append(this._progressBarMeter).append(this._progressBarPercent),this._action.append(this._stop).append(this._close).append(this._confirm),this._header.append(this._title).append(this._loader).append(this._warning).append(this._progressBar),this._section.append(this._header).append(this._message),this._modal.append(this._section).append(this._action),a("body").append(this._overlay).append(this._modal)};i.prototype.show=function(){return this._overlay.show(),this._modal.show(),this},i.prototype.hide=function(){return this._modal.hide(),this._overlay.hide(),this},i.prototype.remove=function(){return this.hide(),this._modal.remove(),this._overlay.remove(),this},i.prototype.reset=function(){return this._title.hide(),this._loader.hide(),this._warning.hide(),this._progressBar.hide(),this._message.hide(),this._stop.hide(),this._close.hide(),this._confirm.hide(),this},t.exports=i},{}],8:[function(){jQuery(document).ready(function(e){"use strict";e(".ai1wm-feedback-type").attr("checked",!1),e("#ai1wm-feedback-type-link-1").click(function(t){var a=e("#ai1wm-feedback-type-1");a.is(":checked")?(a.attr("checked",!1),t.preventDefault()):a.attr("checked",!0)}),e("#ai1wm-feedback-type-2").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-3").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","Leave plugin developers any feedback here"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-type-3").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-2").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","How may we help you?"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-cancel").click(function(t){e(".ai1wm-feedback-form").fadeOut(function(){e(".ai1wm-feedback-type").attr("checked",!1).closest("li").show()}),t.preventDefault()}),e("#ai1wm-feedback-submit").click(function(){var t=ai1wm_feedback.ajax.url,a=e(".ai1wm-feedback-type:checked").val(),i=e(".ai1wm-feedback-email").val(),s=e(".ai1wm-feedback-message").val(),r=e(".ai1wm-feedback-terms").is(":checked");e.ajax({type:"POST",url:t,data:{type:a,email:i,message:s,terms:+r},success:function(t){var a=t.errors;if(a.length>0){e(".ai1wm-feedback .ai1wm-message").remove();var i=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(a,function(e,t){i.append("<p>"+t+"</p>")}),e(".ai1wm-feedback").prepend(i)}else{var s=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your feedback!</p>");e(".ai1wm-feedback").html(s)}},dataType:"json",async:!1})})})},{}],9:[function(){jQuery(document).ready(function(e){"use strict";e("#ai1wm-maintenance-off").click(function(t){var a=ai1wm_maintenance.ajax.url,i=e(this);e.ajax({type:"POST",url:a,success:function(){i.closest(".ai1wm-message-warning").remove()}}),t.preventDefault()})})},{}],10:[function(){jQuery(document).ready(function(e){"use strict";e("#ai1wm-report-problem-button").click(function(t){e(this).next(".ai1wm-report-problem-dialog").toggleClass("ai1wm-report-active"),t.preventDefault()}),e("#ai1wm-report-cancel").click(function(t){e(this).closest(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active"),t.preventDefault()}),e("#ai1wm-report-submit").click(function(){var t=ai1wm_report.ajax.url,a=e(".ai1wm-report-email").val(),i=e(".ai1wm-report-message").val(),s=e(".ai1wm-report-terms").is(":checked");e.ajax({type:"POST",url:t,data:{email:a,message:i,terms:+s},success:function(t){var a=t.errors;if(a.length>0){e(".ai1wm-report-problem-dialog .ai1wm-message").remove();var i=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(a,function(e,t){i.append("<p>"+t+"</p>")}),e(".ai1wm-report-problem-dialog").prepend(i)}else{var s=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your request!</p>");e(".ai1wm-report-problem-dialog").html(s),setTimeout(function(){e(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active")},2e3)}},dataType:"json",async:!1})})})},{}]},{},[1]);
|
1 |
+
!function e(t,a,i){function o(r,s){if(!a[r]){if(!t[r]){var p="function"==typeof require&&require;if(!s&&p)return p(r,!0);if(n)return n(r,!0);throw new Error("Cannot find module '"+r+"'")}var c=a[r]={exports:{}};t[r][0].call(c.exports,function(e){var a=t[r][1][e];return o(a?a:e)},c,c.exports,e,t,a,i)}return a[r].exports}for(var n="function"==typeof require&&require,r=0;r<i.length;r++)o(i[r]);return o}({1:[function(e,t){var a=e("./modal"),i=jQuery,o=function(){var e=this;this.modal=new a,this.modal.onStop=function(){e.onStop()}};o.prototype.start=function(e){var t=this;i(window).bind("beforeunload",function(){return"You are about to stop exporting your website, are you sure?"}),this.stop=!1,this.setStatus({type:"info",message:"Preparing to export..."}),i.post(ai1wm_export.ajax.url,e.concat({name:"secret_key",value:ai1wm_export.secret_key})).done(function(){t.getStatus(ai1wm_export.status.php)}).fail(function(){t.setStatus({type:"error",message:"Unable to start the export. Refresh the page and try again"})})},o.prototype.clean=function(e){var t=this;this.stop=!0,i.post(ai1wm_export.ajax.url,e.concat({name:"secret_key",value:ai1wm_export.secret_key})).done(function(){i(window).unbind("beforeunload")}).fail(function(){t.setStatus({type:"error",message:"Unable to clean the export. Refresh the page and try again"})})},o.prototype.getStatus=function(e,t){var a=this,t=t||0;this.stop||i.ajax({cache:!1,url:e,dataType:"json"}).done(function(o){if(o)switch(a.setStatus(o),o.type){case"done":case"error":case"download":return i(window).unbind("beforeunload"),void 0}setTimeout(function(){a.getStatus(e,t)},3e3)}).fail(function(){t++,t>=6?a.setStatus({type:"error",message:"Unable to retrieve status of the export. Is your server running?"}):t>=3?a.getStatus(ai1wm_export.status.js,t):a.getStatus(ai1wm_export.status.php,t)})},o.prototype.setStatus=function(e){this.modal.render(e)},o.prototype.onStop=function(){throw"onStop event is not implemented"},t.exports=o},{"./modal":2}],2:[function(e,t){var a=jQuery,i=function(){var e=this;this.error=function(t){var i=a("<div></div>"),o=a("<section></section>"),n=a("<h1></h1>"),r=a("<p></p>").html(t.message),s=a("<div></div>"),p=a("<span></span>").addClass("ai1wm-title-red").text("Unable to export"),c=a('<button class="ai1wm-button-red">Close</button>').on("click",function(){e.modal.hide(),e.overlay.hide()});s.append(c),n.append(p),o.append(n).append(r),i.append(o).append(s),e.modal.html(i).show(),e.overlay.show()},this.info=function(t){var i=a("<div></div>"),o=a("<section></section>"),n=a("<h1></h1>"),r=a("<p></p>").html(t.message),s=a("<div></div>"),p=a('<span class="ai1wm-loader"></span>'),c=a('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop export</button>').on("click",function(){a(this).attr("disabled","disabled"),e.onStop(),e.modal.hide(),e.overlay.hide()});s.append(c),n.append(p),o.append(n).append(r),i.append(o).append(s),e.modal.html(i).show(),e.overlay.show()},this.done=function(t){var i=a("<div></div>"),o=a("<section></section>"),n=a("<h1></h1>"),r=a("<p></p>").html(t.message),s=a("<div></div>"),p=a("<span></span>").addClass("ai1wm-title-green").text(t.title),c=a('<button class="ai1wm-button-red">Close</button>').on("click",function(){e.modal.hide(),e.overlay.hide()});s.append(c),n.append(p),o.append(n).append(r),i.append(o).append(s),e.modal.html(i).show(),e.overlay.show()},this.download=function(t){var i=a("<div></div>"),o=a("<section></section>"),n=(a("<h1></h1>"),a("<p></p>").html(t.message)),r=a("<div></div>"),s=a('<button class="ai1wm-button-red">Close</button>').on("click",function(){e.modal.hide(),e.overlay.hide()});r.append(s),o.append(n),i.append(o).append(r),e.modal.html(i).show(),e.overlay.show()},this.overlay=a('<div class="ai1wm-overlay"></div>'),this.modal=a('<div class="ai1wm-modal-container"></div>'),a("body").append(this.overlay).append(this.modal)};i.prototype.render=function(e){switch(e.type){case"error":this.error(e);break;case"info":this.info(e);break;case"done":this.done(e);break;case"download":this.download(e)}},t.exports=i},{}],3:[function(e){(function(t){var a=(e("./jquery/query"),e("./jquery/find_replace"),e("./servmask/report"),e("./servmask/feedback"),e("./servmask/util")),i=(e("./servmask/deprecated"),e("./export/export"));jQuery(document).ready(function(e){"use strict";var t=new i;e("#ai1wm-export-file").click(function(e){var i=a.random(12),o=a.form("#ai1wm-export-form").concat({name:"storage",value:i});t.start(o),t.onStop=function(){t.clean(o.concat({name:"priority",value:350}))},e.preventDefault()}),e(".ai1wm-accordion > .ai1wm-title").click(function(){e(this).parent().toggleClass("ai1wm-active")}),e("#ai1wm-add-new-replace-button").ai1wm_find_replace(),e(".ai1wm-expandable > p:first, .ai1wm-expandable > h4:first, .ai1wm-expandable > div.ai1wm-button-main").on("click",function(){e(this).parent().toggleClass("ai1wm-open")}),e(".ai1wm-collapsable").ai1wm_query()}),t.Ai1wm={Util:a,Export:i}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./export/export":1,"./jquery/find_replace":4,"./jquery/query":5,"./servmask/deprecated":6,"./servmask/feedback":8,"./servmask/report":9,"./servmask/util":10}],4:[function(){!function(e){e.fn.ai1wm_find_replace=function(){return e(this).click(function(t){t.preventDefault();var a=e("#ai1wm-queries > li:first").clone();a.find("input").val(""),a.find(".ai1wm-query-find-text").html("<text>"),a.find(".ai1wm-query-replace-text").html("<another-text>"),e("#ai1wm-queries > li").removeClass("ai1wm-open"),e(a).addClass("ai1wm-open"),e("#ai1wm-queries").append(a),e(a).ai1wm_query(),e(a).find("p:first").on("click",function(){e(this).parent().toggleClass("ai1wm-open")})}),this}}(jQuery)},{}],5:[function(){!function(e){e.fn.ai1wm_query=function(){var t=e(this).find("input.ai1wm-query-find-input"),a=e(this).find("input.ai1wm-query-replace-input"),i=e(this).find("small.ai1wm-query-find-text"),o=e(this).find("small.ai1wm-query-replace-text");return t.on("change paste input keypress keydown keyup",function(){var t=e(this).val().length>0?e(this).val():"<text>";i.text(t)}),a.on("change paste input keypress keydown keyup",function(){var t=e(this).val().length>0?e(this).val():"<another-text>";o.text(t)}),this}}(jQuery)},{}],6:[function(e){var t=(e("./util"),e("./dialog")),a={s3:"Amazon S3 Extension",url:"URL Extension",ftp:"FTP Extension",gdrive:"Google Drive Extension",dropbox:"Dropbox Extension"};window.Ai1wmExportController=function(e){this._export={},this._provider=e},window.Ai1wmExportController.prototype.start=function(){new t("<strong>All in One WP Migration</strong> is not compatible with current version of <strong>"+a[this._provider]+'</strong>. Please contact <a href="mailto:support@servmask.com">support@servmask.com</a> for more details.')},window.Ai1wmImportController=function(e){this._import={},this._provider=e},window.Ai1wmImportController.prototype.init=function(){},window.Ai1wmImportController.prototype.download=function(){new t("<strong>All in One WP Migration</strong> is not compatible with current version of <strong>"+a[this._provider]+'</strong>. Please contact <a href="mailto:support@servmask.com">support@servmask.com</a> for more details.')}},{"./dialog":7,"./util":10}],7:[function(e,t){var a=jQuery,i=function(e){var t=this;this.overlay=a('<div class="ai1wm-overlay"></div>'),this.container=a("<div></div>"),this.modal=a('<div class="ai1wm-modal-container"></div>'),this.section=a("<section></section>"),this.message=a("<p></p>").addClass("ai1wm-dialog-message").html(e),this.action=a("<div></div>"),this.closeButton=a('<button class="ai1wm-button-red">Close</button>').on("click",function(){t.modal.hide(),t.overlay.hide()}),this.action.append(this.closeButton),this.section.append(this.message),this.container.append(this.section).append(this.action),this.modal.html(this.container).show(),this.overlay.show(),a("body").append(this.overlay).append(this.modal)};t.exports=i},{}],8:[function(){jQuery(document).ready(function(e){"use strict";e(".ai1wm-feedback-type").attr("checked",!1),e("#ai1wm-feedback-type-link-1").click(function(t){var a=e("#ai1wm-feedback-type-1");a.is(":checked")?(a.attr("checked",!1),t.preventDefault()):a.attr("checked",!0)}),e("#ai1wm-feedback-type-2").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-3").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","Leave plugin developers any feedback here"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-type-3").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-2").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","How may we help you?"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-cancel").click(function(t){e(".ai1wm-feedback-form").fadeOut(function(){e(".ai1wm-feedback-type").attr("checked",!1).closest("li").show()}),t.preventDefault()}),e("#ai1wm-feedback-submit").click(function(){var t=e(".ai1wm-feedback-type:checked").val(),a=e(".ai1wm-feedback-email").val(),i=e(".ai1wm-feedback-message").val(),o=e(".ai1wm-feedback-terms").is(":checked");e.ajax({type:"POST",url:ai1wm_feedback.ajax.url,data:{"ai1wm-type":t,"ai1wm-email":a,"ai1wm-message":i,"ai1wm-terms":+o},success:function(t){var a=t.errors;if(a.length>0){e(".ai1wm-feedback .ai1wm-message").remove();var i=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(a,function(e,t){i.append("<p>"+t+"</p>")}),e(".ai1wm-feedback").prepend(i)}else{var o=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your feedback!</p>");e(".ai1wm-feedback").html(o)}},dataType:"json",async:!1})})})},{}],9:[function(){jQuery(document).ready(function(e){"use strict";e("#ai1wm-report-problem-button").click(function(t){e(this).next(".ai1wm-report-problem-dialog").toggleClass("ai1wm-report-active"),t.preventDefault()}),e("#ai1wm-report-cancel").click(function(t){e(this).closest(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active"),t.preventDefault()}),e("#ai1wm-report-submit").click(function(){var t=e(".ai1wm-report-email").val(),a=e(".ai1wm-report-message").val(),i=e(".ai1wm-report-terms").is(":checked");e.ajax({type:"POST",url:ai1wm_report.ajax.url,data:{"ai1wm-email":t,"ai1wm-message":a,"ai1wm-terms":+i},success:function(t){var a=t.errors;if(a.length>0){e(".ai1wm-report-problem-dialog .ai1wm-message").remove();var i=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(a,function(e,t){i.append("<p>"+t+"</p>")}),e(".ai1wm-report-problem-dialog").prepend(i)}else{var o=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your request!</p>");e(".ai1wm-report-problem-dialog").html(o),setTimeout(function(){e(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active")},2e3)}},dataType:"json",async:!1})})})},{}],10:[function(e,t){var a=jQuery;t.exports={random:function(e){for(var t="",a="abcdefghijklmnopqrstuvwxyz0123456789",i=0;e>i;i++)t+=a.charAt(Math.floor(Math.random()*a.length));return t},form:function(e){return a(e).serializeArray()},ucfirst:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}}},{}]},{},[3]);
|
lib/view/assets/javascript/import.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function e(t,i,a){function o(s,n){if(!i[s]){if(!t[s]){var d="function"==typeof require&&require;if(!n&&d)return d(s,!0);if(r)return r(s,!0);throw new Error("Cannot find module '"+s+"'")}var p=i[s]={exports:{}};t[s][0].call(p.exports,function(e){var i=t[s][1][e];return o(i?i:e)},p,p.exports,e,t,i,a)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s<a.length;s++)o(a[s]);return o}({1:[function(e){var t=(e("./servmask/report.js"),e("./servmask/maintenance"),e("./servmask/feedback"),e("./servmask/import_controller"));jQuery(document).ready(function(e){"use strict";var i=function(e){for(var t=window.location.search.substring(1),i=t.split("&"),a=0;a<i.length;a++){var o=i[a].split("=");if(o[0]==e)return o[1]}},a=new t("file");a.init(),a.upload(),i("restore-file")&&a.restore(i("restore-file")),e(".ai1wm-expandable > div.ai1wm-button-main").on("click",function(){e(this).parent().toggleClass("ai1wm-open")})})},{"./servmask/feedback":3,"./servmask/import_controller":6,"./servmask/maintenance":9,"./servmask/report.js":10}],2:[function(e,t){var i=jQuery,a=function(e){this._overlay=i('<div class="ai1wm-overlay"></div>'),this._modal=i('<div class="ai1wm-modal-container"></div>'),this._modal_section=i("<section></section>"),this._modal_content=i('<p style="text-align: left; line-height: 1.5em;">'+e+"</p>"),this._modal_close=i('<button class="ai1wm-button-red">Close</button>'),this._modal_section.append(this._modal_content),this._modal.append(this._modal_section).append(this._modal_close),console.log(this._modal),i("body").append(this._overlay).append(this._modal),this._modal_close.on("click",function(){this.remove()}.bind(this)),this.show()};a.prototype.show=function(){return this._overlay.show(),this._modal.show(),this},a.prototype.hide=function(){return this._modal.hide(),this._overlay.hide(),this},a.prototype.remove=function(){return this.hide(),this._modal.remove(),this._overlay.remove(),this},t.exports=a},{}],3:[function(){jQuery(document).ready(function(e){"use strict";e(".ai1wm-feedback-type").attr("checked",!1),e("#ai1wm-feedback-type-link-1").click(function(t){var i=e("#ai1wm-feedback-type-1");i.is(":checked")?(i.attr("checked",!1),t.preventDefault()):i.attr("checked",!0)}),e("#ai1wm-feedback-type-2").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-3").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","Leave plugin developers any feedback here"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-type-3").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-2").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","How may we help you?"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-cancel").click(function(t){e(".ai1wm-feedback-form").fadeOut(function(){e(".ai1wm-feedback-type").attr("checked",!1).closest("li").show()}),t.preventDefault()}),e("#ai1wm-feedback-submit").click(function(){var t=ai1wm_feedback.ajax.url,i=e(".ai1wm-feedback-type:checked").val(),a=e(".ai1wm-feedback-email").val(),o=e(".ai1wm-feedback-message").val(),r=e(".ai1wm-feedback-terms").is(":checked");e.ajax({type:"POST",url:t,data:{type:i,email:a,message:o,terms:+r},success:function(t){var i=t.errors;if(i.length>0){e(".ai1wm-feedback .ai1wm-message").remove();var a=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(i,function(e,t){a.append("<p>"+t+"</p>")}),e(".ai1wm-feedback").prepend(a)}else{var o=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your feedback!</p>");e(".ai1wm-feedback").html(o)}},dataType:"json",async:!1})})})},{}],4:[function(e,t){var i=jQuery,a=function(){this.FILES_ADDED=1,this.BEFORE_UPLOAD=2,this.UPLOAD_PROGRESS=3,this.CHUNK_UPLOADED=4,this.UPLOAD_FINISHED=5,this.UPLOAD_ERROR=6,this.OVERSIZED_FILE=7,this.INVALID_EXTENSION=8,this._dfd=new i.Deferred,this._chunkUploaded=!1,this._storage=null,this.addFileFilters(),this._uploader=new plupload.Uploader(ai1wm_uploader),this._uploader.bind("Init",this._onInit),this._uploader.init(),this._uploader.bind("FilesAdded",this._onFilesAdded.bind(this)),this._uploader.bind("BeforeUpload",this._onBeforeUpload.bind(this)),this._uploader.bind("UploadProgress",this._onUploadProgress.bind(this)),this._uploader.bind("ChunkUploaded",this._onChunkUploaded.bind(this)),this._uploader.bind("FileUploaded",this._onFileUploaded.bind(this)),this._uploader.bind("Error",this._onError.bind(this))};a.prototype.addFileFilters=function(){var e=this;plupload.addFileFilter("ai1wm_archive_size",function(t,i,a){t=parseInt(t,10),i.size=i.hasOwnProperty("size")?parseInt(i.size,10):0,0===t||i.size<=t?a(!0):(this.trigger("Error",{code:e.OVERSIZED_FILE,message:ai1wm_import.oversize}),a(!1))}),plupload.addFileFilter("ai1wm_archive_extension",function(t,a,o){var r=a.name.substr((~-a.name.lastIndexOf(".")>>>0)+2);i.inArray(r,t)>-1?o(!0):(this.trigger("Error",{code:e.INVALID_EXTENSION,message:ai1wm_import.invalid_extension}),o(!1))})},a.prototype.watch=function(){return this._dfd.promise()},a.prototype.random=function(e){for(var t="",i="abcdefghijklmnopqrstuvwxyz0123456789",a=0;e>a;a++)t+=i.charAt(Math.floor(Math.random()*i.length));return t},a.prototype._onInit=function(e){var t=i("#ai1wm-plupload-upload-ui");e.features.dragdrop&&!i(document.body).hasClass("mobile")?i("#ai1wm-drag-drop-area").bind("dragover.wp-uploader",function(){t.addClass("ai1wm-drag-over")}).bind("dragleave.wp-uploader, drop.wp-uploader",function(){t.removeClass("ai1wm-drag-over")}):i("#ai1wm-drag-drop-area").unbind(".wp-uploader"),"html4"==e.runtime&&i(".upload-flash-bypass").hide()},a.prototype._onFilesAdded=function(e,t){this._storage=this.random(12),this._uploader.settings.multipart_params.storage=this._storage,this._dfd.notify({state:this.FILES_ADDED,up:e,files:t})},a.prototype._onBeforeUpload=function(e,t){this._dfd.notify({state:this.BEFORE_UPLOAD,up:e,files:t})},a.prototype._onUploadProgress=function(e,t){this._dfd.notify({state:this.UPLOAD_PROGRESS,up:e,files:t})},a.prototype._onChunkUploaded=function(){this._dfd.notify({state:this.CHUNK_UPLOADED})},a.prototype._onFileUploaded=function(e,t){this._dfd.notify({state:this.UPLOAD_FINISHED,up:e,files:t})},a.prototype._onError=function(e,t){this._dfd.notify({state:this.UPLOAD_ERROR,up:e,error:t})},t.exports=a},{}],5:[function(e,t){var i=jQuery,a=function(e){this._stop=!1,this._archive=null,this._storage=null,this._provider=e};a.prototype.start=function(){var e=this,t=new jQuery.Deferred;return i.post(ai1wm_import.ajax.url,{method:"start",secret_key:ai1wm_import.secret_key,provider:e._provider,storage:e._storage,archive:e._archive}).done(function(){e.getStatus(ai1wm_import.status.php).progress(function(e){t.notify(e)}).done(function(){t.resolve()}).fail(function(e){t.reject(e)})}).fail(function(){t.reject({message:"Unable to start the import. Refresh the page and try again"})}),t.promise()},a.prototype.getStatus=function(e,t,a){var o=this;return t=t||new jQuery.Deferred,a=a||0,o._stop?t.resolve():(i.ajax({cache:!1,url:e,dataType:"json"}).done(function(a){if(a)switch(t.notify(a),a.type){case"finish":t.resolve(),i.post(ai1wm_import.ajax.url,{method:"clean",secret_key:ai1wm_import.secret_key,provider:o._provider,storage:o._storage});break;case"confirm":t.resolve();break;default:setTimeout(function(){o.getStatus(e,t)},3e3)}}).fail(function(){a++,a>=6?t.reject({message:"Unable to retrieve status of the import. Is your server running?"}):a>=3?o.getStatus(ai1wm_import.status.js,t,a):o.getStatus(ai1wm_import.status.php,t,a)}),t.promise())},a.prototype.stop=function(e,t){var e=new jQuery.Deferred,a=this;return e=e||new jQuery.Deferred,t=t||0,t>0?e.notify({message:"Please wait, stopping the import... Retry "+t}):(e.notify({message:"Please wait, stopping the import..."}),a._stop=!0),i.post(ai1wm_import.ajax.url,{method:"stop",secret_key:ai1wm_import.secret_key,provider:a._provider,storage:a._storage}).done(function(){e.resolve()}).fail(function(){t++,t>3?e.reject({message:"Unable to retrieve status of the import. Is your server running?"}):a.stop(e,t)}),e.promise()},a.prototype.confirm=function(){var e=new jQuery.Deferred,t=this;return i.post(ai1wm_import.ajax.url,{method:"enumerate",secret_key:ai1wm_import.secret_key,provider:t._provider,storage:t._storage,archive:t._archive}).done(function(){t.getStatus(ai1wm_import.status.php).progress(function(t){e.notify(t)}).done(function(){e.resolve()}).fail(function(t){e.reject(t)})}).fail(function(){e.reject({message:"Unable to start the import. Refresh the page and try again"})}),e.promise()},a.prototype.download=function(e){var t=new jQuery.Deferred,a=this;return i.post(ai1wm_import.ajax.url,i.extend({method:"import",secret_key:ai1wm_import.secret_key,provider:a._provider,storage:a._storage,archive:a._archive},e)).done(function(){a.getStatus(ai1wm_import.status.php).progress(function(e){t.notify(e)}).done(function(){t.resolve()}).fail(function(e){t.reject(e)})}).fail(function(){t.reject({message:"Unable to start the import. Refresh the page and try again"})}),t.promise()},t.exports=a},{}],6:[function(e,t){(function(i){var a=e("./import_modal"),o=e("./file_uploader"),r=e("./import"),s=e("./info"),n=e("./dialog"),d=jQuery,p=function(e){this._import=new r(e),this._modal=new a};p.prototype.init=function(){var e=this;this._modal._stop.on("click",function(t){t.preventDefault(),d(this).attr("disabled","disabled"),e.stop()}),this._modal._confirm.on("click",function(t){t.preventDefault(),d(this).attr("disabled","disabled"),e.confirm()}),this._modal._close.on("click",function(t){t.preventDefault(),e._modal.remove()})},p.prototype.stop=function(){var e=this;this._import.stop().progress(function(t){e.display(t)}).done(function(){e._modal.remove()}).fail(function(e){alert(e.message)})},p.prototype.confirm=function(){var e=this;this._import.confirm().progress(function(t){e.display(t)}).fail(function(e){alert(e.message)})},p.prototype.download=function(e){var t=this;t.display({type:"info",message:"Preparing to import..."}),this._import.download(e).progress(function(e){t.display(e)}).fail(function(e){alert(e.message)})},p.prototype.display=function(e){var t=this;switch(t._modal.reset(),t._modal.show(),e.type){case"error":t._modal._title.html(e.title),t._modal._title.addClass("ai1wm-title-red"),t._modal._title.show(),t._modal._message.html(e.message),t._modal._message.css("text-align","left"),t._modal._message.show(),t._modal._close.show();break;case"confirm":t._modal._warning.show(),t._modal._message.html(e.message),t._modal._message.show(),t._modal._confirm.show();break;case"progress":t._modal._progressBar.show(),t._modal._progressBarPercent.text(e.percent+"%"),t._modal._progressBarMeter.width(e.meter+"%"),t._modal._stop.show();break;case"finish":t._modal._title.html(e.title),t._modal._title.addClass("ai1wm-title-green"),t._modal._title.show(),t._modal._message.html(e.message),t._modal._message.show(),t._modal._close.show();break;default:t._modal._loader.show(),t._modal._message.html(e.message),t._modal._message.show(),t._modal._stop.show(),t._modal._stop.attr("disabled","disabled")}},p.prototype.upload=function(){var e=this;this._uploadFinished=!1,this._uploadProgress=0,this._fileUploader=new o,this._fileUploader.watch().progress(function(t){e._handleUploadState(t)}).done(function(){e.display({type:"info",message:"Preparing to import..."}),e._import.start().progress(function(t){e.display(t)}).done(function(){}).fail(function(e){alert(e.message)})}).fail(function(e){alert(e.message)})},p.prototype.restore=function(e){var t=this;this._import._archive=e,this._import._storage=this.random(12),t.display({type:"info",message:"Preparing to import..."}),this._import.start().progress(function(e){t.display(e)}).done(function(){}).fail(function(e){alert(e.message)})},p.prototype._handleUploadState=function(e){var t=this;switch(e.state){case t._fileUploader.FILES_ADDED:t.display({type:"progress",percent:1,meter:7}),t._fileUploader._uploader.refresh(),t._fileUploader._uploader.start();break;case t._fileUploader.BEFORE_UPLOAD:break;case t._fileUploader.UPLOAD_PROGRESS:if(e.files.size>e.up.settings.chunk_size&&t._fileUploader._chunkUploaded){var i=e.files.percent>7?e.files.percent:7;t.display({type:"progress",percent:i,meter:i})}else t._uploadFinished?(t._uploadProgress++,2==t._uploadProgress&&t.display({type:"progress",percent:100,meter:100})):t.display({type:"progress",percent:1,meter:7});break;case t._fileUploader.CHUNK_UPLOADED:t._fileUploader._chunkUploaded===!1&&(t._fileUploader._uploader.settings.max_retries=100),t._fileUploader._chunkUploaded=!0;break;case t._fileUploader.UPLOAD_FINISHED:t._uploadFinished=!0,t._import._archive=e.files.target_name,t._import._storage=this._fileUploader._storage,t._fileUploader._dfd.resolve();break;case t._fileUploader.UPLOAD_ERROR:switch(e.error.code){case t._fileUploader.OVERSIZED_FILE:new n(e.error.message);break;case t._fileUploader.INVALID_EXTENSION:new n(e.error.message);break;default:if(t._fileUploader._chunkUploaded)return alert("Unable to upload the file. Is your server running? Please refresh and try again."),void 0;if(t._uploadProgress=0,t._uploadFinished=!1,e.up.settings.chunk_size/=2,e.up.settings.chunk_size<102400)return alert("Unable to upload the file. Is your server running? Please refresh and try again."),void 0;new s("Trying new chunk size: "+(e.up.settings.chunk_size/1048576).toFixed(2)+"MB"),e.up.files[0].status=plupload.QUEUED,e.up.files[0].loaded=0,e.up.refresh(),e.up.start()}break;default:alert("Unknown state: "+state)}},p.prototype.random=function(e){for(var t="",i="abcdefghijklmnopqrstuvwxyz0123456789",a=0;e>a;a++)t+=i.charAt(Math.floor(Math.random()*i.length));return t},t.exports=p,i.window.Ai1wmImportController=p}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./dialog":2,"./file_uploader":4,"./import":5,"./import_modal":7,"./info":8}],7:[function(e,t){var i=jQuery,a=function(){this._overlay=i('<div class="ai1wm-overlay"></div>'),this._modal=i('<div class="ai1wm-modal-container"></div>'),this._section=i("<section></section>"),this._header=i("<h1></h1>"),this._message=i("<p></p>").hide(),this._action=i("<div></div>"),this._title=i("<span></span>").hide(),this._loader=i('<span class="ai1wm-loader"></span>').hide(),this._warning=i('<span class="ai1wm-icon-notification"></span>').hide(),this._progressBar=i('<span class="ai1wm-progress-bar"></span>').hide(),this._progressBarMeter=i('<span class="ai1wm-progress-bar-meter"></span>'),this._progressBarPercent=i('<span class="ai1wm-progress-bar-percent">0%</span>'),this._stop=i('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').hide(),this._close=i('<button class="ai1wm-button-red">Close</button>').hide(),this._confirm=i('<button class="ai1wm-button-green">Continue</button>').hide(),this._progressBar.append(this._progressBarMeter).append(this._progressBarPercent),this._action.append(this._stop).append(this._close).append(this._confirm),this._header.append(this._title).append(this._loader).append(this._warning).append(this._progressBar),this._section.append(this._header).append(this._message),this._modal.append(this._section).append(this._action),i("body").append(this._overlay).append(this._modal)};a.prototype.show=function(){return this._overlay.show(),this._modal.show(),this},a.prototype.hide=function(){return this._modal.hide(),this._overlay.hide(),this},a.prototype.remove=function(){return this.hide(),this._modal.remove(),this._overlay.remove(),this},a.prototype.reset=function(){return this._title.hide(),this._loader.hide(),this._warning.hide(),this._progressBar.hide(),this._message.hide(),this._stop.hide(),this._stop.removeAttr("disabled"),this._close.hide(),this._confirm.hide(),this},t.exports=a},{}],8:[function(e,t){var i=jQuery,a=function(e){var t=i('<div class="ai1wm-growl-info">'+e+"</div>");t.hide(),i("body").append(t),t.show("normal",function(){setTimeout(function(){t.hide(),t.remove()},3e3)})};t.exports=a},{}],9:[function(){jQuery(document).ready(function(e){"use strict";e("#ai1wm-maintenance-off").click(function(t){var i=ai1wm_maintenance.ajax.url,a=e(this);e.ajax({type:"POST",url:i,success:function(){a.closest(".ai1wm-message-warning").remove()}}),t.preventDefault()})})},{}],10:[function(){jQuery(document).ready(function(e){"use strict";e("#ai1wm-report-problem-button").click(function(t){e(this).next(".ai1wm-report-problem-dialog").toggleClass("ai1wm-report-active"),t.preventDefault()}),e("#ai1wm-report-cancel").click(function(t){e(this).closest(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active"),t.preventDefault()}),e("#ai1wm-report-submit").click(function(){var t=ai1wm_report.ajax.url,i=e(".ai1wm-report-email").val(),a=e(".ai1wm-report-message").val(),o=e(".ai1wm-report-terms").is(":checked");e.ajax({type:"POST",url:t,data:{email:i,message:a,terms:+o},success:function(t){var i=t.errors;if(i.length>0){e(".ai1wm-report-problem-dialog .ai1wm-message").remove();var a=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(i,function(e,t){a.append("<p>"+t+"</p>")}),e(".ai1wm-report-problem-dialog").prepend(a)}else{var o=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your request!</p>");e(".ai1wm-report-problem-dialog").html(o),setTimeout(function(){e(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active")},2e3)}},dataType:"json",async:!1})})})},{}]},{},[1]);
|
1 |
+
!function e(t,o,a){function i(n,s){if(!o[n]){if(!t[n]){var p="function"==typeof require&&require;if(!s&&p)return p(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var d=o[n]={exports:{}};t[n][0].call(d.exports,function(e){var o=t[n][1][e];return i(o?o:e)},d,d.exports,e,t,o,a)}return o[n].exports}for(var r="function"==typeof require&&require,n=0;n<a.length;n++)i(a[n]);return i}({1:[function(e){var t=(e("./servmask/report"),e("./servmask/feedback"),e("./servmask/deprecated"),e("./import/uploader"));jQuery(document).ready(function(e){"use strict";var o=new t;o.init(),e(".ai1wm-expandable > div.ai1wm-button-main").on("click",function(){e(this).parent().toggleClass("ai1wm-open")})})},{"./import/uploader":4,"./servmask/deprecated":5,"./servmask/feedback":7,"./servmask/report":8}],2:[function(e,t){var o=e("./modal"),a=jQuery,i=function(){var e=this;this.modal=new o,this.modal.onConfirm=function(){e.onConfirm()},this.modal.onStop=function(){e.onStop()}};i.prototype.start=function(e){var t=this;a(window).bind("beforeunload",function(){return"You are about to stop importing your website, are you sure?"}),this.stop=!1,this.setStatus({type:"info",message:"Preparing to import..."}),a.post(ai1wm_import.ajax.url,a.extend({secret_key:ai1wm_import.secret_key},e)).done(function(){t.getStatus()}).fail(function(){t.setStatus({type:"error",message:"Unable to start the import. Refresh the page and try again"})})},i.prototype.confirm=function(e){var t=this;a.post(ai1wm_import.ajax.url,a.extend({secret_key:ai1wm_import.secret_key},e)).done(function(){t.getStatus(ai1wm_import.status.php)}).fail(function(){t.setStatus({type:"error",message:"Unable to confirm the import. Refresh the page and try again"})})},i.prototype.clean=function(e){var t=this;this.stop=!0,a.post(ai1wm_import.ajax.url,a.extend({secret_key:ai1wm_import.secret_key},e)).done(function(){a(window).unbind("beforeunload")}).fail(function(){t.setStatus({type:"error",message:"Unable to clean the import. Refresh the page and try again"})})},i.prototype.getStatus=function(e,t){var o=this,t=t||0;this.stop||a.ajax({cache:!1,url:e,dataType:"json"}).done(function(i){if(i)switch(o.setStatus(i),i.type){case"done":case"error":return a(window).unbind("beforeunload"),void 0;case"confirm":return}setTimeout(function(){o.getStatus(e,t)},3e3)}).fail(function(){t++,t>=6?o.setStatus({type:"error",message:"Unable to retrieve status of the export. Is your server running?"}):t>=3?o.getStatus(ai1wm_import.status.js,t):o.getStatus(ai1wm_import.status.php,t)})},i.prototype.setStatus=function(e){this.modal.render(e)},i.prototype.onConfirm=function(){throw"onConfirm event is not implemented"},i.prototype.onStop=function(){throw"onStop event is not implemented"},t.exports=i},{"./modal":3}],3:[function(e,t){var o=jQuery,a=function(){var e=this;this.error=function(t){var a=o("<div></div>"),i=o("<section></section>"),r=o("<h1></h1>"),n=o("<p></p>").html(t.message),s=o("<div></div>"),p=o("<span></span>").addClass("ai1wm-title-red").text("Unable to import"),d=o('<button class="ai1wm-button-red">Close</button>').on("click",function(){e.modal.hide(),e.overlay.hide()});s.append(d),r.append(p),i.append(r).append(n),a.append(i).append(s),e.modal.html(a).show(),e.overlay.show()},this.progress=function(t){var a=o("<div></div>"),i=o("<section></section>"),r=o("<h1></h1>"),n=(o("<p></p>"),o("<div></div>")),s=o('<span class="ai1wm-progress-bar"></span>'),p=o('<span class="ai1wm-progress-bar-meter"></span>').width(t.percent+"%"),d=o('<span class="ai1wm-progress-bar-percent">0%</span>').text(t.percent+"%"),c=o('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').on("click",function(){o(this).attr("disabled","disabled"),e.onStop(),e.modal.hide(),e.overlay.hide()});s.append(p).append(d),n.append(c),r.append(s),i.append(r),a.append(i).append(n),e.modal.html(a).show(),e.overlay.show()},this.confirm=function(t){var a=o("<div></div>"),i=o("<section></section>"),r=o("<h1></h1>"),n=o("<p></p>").html(t.message),s=o("<div></div>"),p=o('<span class="ai1wm-icon-notification"></span>'),d=o('<button class="ai1wm-button-green">Continue</button>').on("click",function(){o(this).attr("disabled","disabled"),e.onConfirm()});s.append(d),r.append(p),i.append(r).append(n),a.append(i).append(s),e.modal.html(a).show(),e.overlay.show()},this.info=function(t){var a=o("<div></div>"),i=o("<section></section>"),r=o("<h1></h1>"),n=o("<p></p>").html(t.message),s=o("<div></div>"),p=o('<span class="ai1wm-loader"></span>'),d=o('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').attr("disabled","disabled");s.append(d),r.append(p),i.append(r).append(n),a.append(i).append(s),e.modal.html(a).show(),e.overlay.show()},this.done=function(t){var a=o("<div></div>"),i=o("<section></section>"),r=o("<h1></h1>"),n=o("<p></p>").html(t.message),s=o("<div></div>"),p=o("<span></span>").addClass("ai1wm-title-green").text(t.title),d=o('<button class="ai1wm-button-red">Close</button>').on("click",function(){e.modal.hide(),e.overlay.hide()});s.append(d),r.append(p),i.append(r).append(n),a.append(i).append(s),e.modal.html(a).show(),e.overlay.show()},this.overlay=o('<div class="ai1wm-overlay"></div>'),this.modal=o('<div class="ai1wm-modal-container"></div>'),o("body").append(this.overlay).append(this.modal)};a.prototype.render=function(e){switch(e.type){case"error":this.error(e);break;case"confirm":this.confirm(e);break;case"progress":this.progress(e);break;case"info":this.info(e);break;case"done":this.done(e)}},t.exports=a},{}],4:[function(e,t){(function(o){var a=e("../servmask/util"),i=e("./import"),r=jQuery,n=function(){this.uploader=new plupload.Uploader(ai1wm_uploader)};n.prototype.init=function(){this.uploader.init(),this.uploader.bind("Init",this.onInit),this.uploader.bind("FilesAdded",this.onFilesAdded),this.uploader.bind("BeforeUpload",this.onBeforeUpload),this.uploader.bind("UploadProgress",this.onUploadProgress),this.uploader.bind("FileUploaded",this.onFileUploaded),this.uploader.bind("Error",this.onError),plupload.addFileFilter("ai1wm_archive_size",function(e,t,o){e=parseInt(e,10),t.size=t.hasOwnProperty("size")?parseInt(t.size,10):0,0===e||t.size<=e?o(!0):(this.trigger("Error",{code:plupload.FILE_SIZE_ERROR,message:ai1wm_import.oversize}),o(!1))}),plupload.addFileFilter("ai1wm_archive_extension",function(e,t,o){var a=t.name.substr((~-t.name.lastIndexOf(".")>>>0)+2);r.inArray(a,e)>-1?o(!0):(this.trigger("Error",{code:plupload.FILE_EXTENSION_ERROR,message:ai1wm_import.invalid_extension}),o(!1))})},n.prototype.onInit=function(e){var t=r("#ai1wm-plupload-upload-ui");e.features.dragdrop&&!r(document.body).hasClass("mobile")?r("#ai1wm-drag-drop-area").bind("dragover.wp-uploader",function(){t.addClass("ai1wm-drag-over")}).bind("dragleave.wp-uploader, drop.wp-uploader",function(){t.removeClass("ai1wm-drag-over")}):r("#ai1wm-drag-drop-area").unbind(".wp-uploader"),"html4"==e.runtime&&r(".upload-flash-bypass").hide(),this.model=new i},n.prototype.onFilesAdded=function(e){e.refresh(),e.start(),r(window).bind("beforeunload",function(){return"You are about to stop importing your website, are you sure?"})},n.prototype.onBeforeUpload=function(e,t){var o=this;this.storage=a.random(12),this.archive=t.name,r.extend(e.settings.multipart_params,{storage:this.storage,archive:this.archive}),this.model.onConfirm=function(){o.model.confirm({storage:o.storage,archive:o.archive,priority:150})},this.model.onStop=function(){e.stop(),e.splice(),o.model.clean({storage:o.storage,archive:o.archive,priority:400})},this.model.setStatus({type:"progress",percent:1})},n.prototype.onUploadProgress=function(e,t){this.model.setStatus({type:"progress",percent:t.percent})},n.prototype.onFileUploaded=function(){this.model.start({storage:this.storage,archive:this.archive})},n.prototype.onError=function(e,t){this.model.setStatus({type:"error",message:t.message})},t.exports=n,o.Ai1wm={Util:a,Import:i}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../servmask/util":9,"./import":2}],5:[function(e){var t=(e("./util"),e("./dialog")),o={s3:"Amazon S3 Extension",url:"URL Extension",ftp:"FTP Extension",gdrive:"Google Drive Extension",dropbox:"Dropbox Extension"};window.Ai1wmExportController=function(e){this._export={},this._provider=e},window.Ai1wmExportController.prototype.start=function(){new t("<strong>All in One WP Migration</strong> is not compatible with current version of <strong>"+o[this._provider]+'</strong>. Please contact <a href="mailto:support@servmask.com">support@servmask.com</a> for more details.')},window.Ai1wmImportController=function(e){this._import={},this._provider=e},window.Ai1wmImportController.prototype.init=function(){},window.Ai1wmImportController.prototype.download=function(){new t("<strong>All in One WP Migration</strong> is not compatible with current version of <strong>"+o[this._provider]+'</strong>. Please contact <a href="mailto:support@servmask.com">support@servmask.com</a> for more details.')}},{"./dialog":6,"./util":9}],6:[function(e,t){var o=jQuery,a=function(e){var t=this;this.overlay=o('<div class="ai1wm-overlay"></div>'),this.container=o("<div></div>"),this.modal=o('<div class="ai1wm-modal-container"></div>'),this.section=o("<section></section>"),this.message=o("<p></p>").addClass("ai1wm-dialog-message").html(e),this.action=o("<div></div>"),this.closeButton=o('<button class="ai1wm-button-red">Close</button>').on("click",function(){t.modal.hide(),t.overlay.hide()}),this.action.append(this.closeButton),this.section.append(this.message),this.container.append(this.section).append(this.action),this.modal.html(this.container).show(),this.overlay.show(),o("body").append(this.overlay).append(this.modal)};t.exports=a},{}],7:[function(){jQuery(document).ready(function(e){"use strict";e(".ai1wm-feedback-type").attr("checked",!1),e("#ai1wm-feedback-type-link-1").click(function(t){var o=e("#ai1wm-feedback-type-1");o.is(":checked")?(o.attr("checked",!1),t.preventDefault()):o.attr("checked",!0)}),e("#ai1wm-feedback-type-2").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-3").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","Leave plugin developers any feedback here"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-type-3").click(function(){e("#ai1wm-feedback-type-1, #ai1wm-feedback-type-2").closest("li").hide(),e(".ai1wm-feedback-form").find(".ai1wm-feedback-message").attr("placeholder","How may we help you?"),e(".ai1wm-feedback-form").fadeIn()}),e("#ai1wm-feedback-cancel").click(function(t){e(".ai1wm-feedback-form").fadeOut(function(){e(".ai1wm-feedback-type").attr("checked",!1).closest("li").show()}),t.preventDefault()}),e("#ai1wm-feedback-submit").click(function(){var t=e(".ai1wm-feedback-type:checked").val(),o=e(".ai1wm-feedback-email").val(),a=e(".ai1wm-feedback-message").val(),i=e(".ai1wm-feedback-terms").is(":checked");e.ajax({type:"POST",url:ai1wm_feedback.ajax.url,data:{"ai1wm-type":t,"ai1wm-email":o,"ai1wm-message":a,"ai1wm-terms":+i},success:function(t){var o=t.errors;if(o.length>0){e(".ai1wm-feedback .ai1wm-message").remove();var a=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(o,function(e,t){a.append("<p>"+t+"</p>")}),e(".ai1wm-feedback").prepend(a)}else{var i=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your feedback!</p>");e(".ai1wm-feedback").html(i)}},dataType:"json",async:!1})})})},{}],8:[function(){jQuery(document).ready(function(e){"use strict";e("#ai1wm-report-problem-button").click(function(t){e(this).next(".ai1wm-report-problem-dialog").toggleClass("ai1wm-report-active"),t.preventDefault()}),e("#ai1wm-report-cancel").click(function(t){e(this).closest(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active"),t.preventDefault()}),e("#ai1wm-report-submit").click(function(){var t=e(".ai1wm-report-email").val(),o=e(".ai1wm-report-message").val(),a=e(".ai1wm-report-terms").is(":checked");e.ajax({type:"POST",url:ai1wm_report.ajax.url,data:{"ai1wm-email":t,"ai1wm-message":o,"ai1wm-terms":+a},success:function(t){var o=t.errors;if(o.length>0){e(".ai1wm-report-problem-dialog .ai1wm-message").remove();var a=e("<div />").addClass("ai1wm-message ai1wm-error-message");e.each(o,function(e,t){a.append("<p>"+t+"</p>")}),e(".ai1wm-report-problem-dialog").prepend(a)}else{var i=e("<div />").addClass("ai1wm-message ai1wm-success-message").append("<p>Thanks for submitting your request!</p>");e(".ai1wm-report-problem-dialog").html(i),setTimeout(function(){e(".ai1wm-report-problem-dialog").removeClass("ai1wm-report-active")},2e3)}},dataType:"json",async:!1})})})},{}],9:[function(e,t){var o=jQuery;t.exports={random:function(e){for(var t="",o="abcdefghijklmnopqrstuvwxyz0123456789",a=0;e>a;a++)t+=o.charAt(Math.floor(Math.random()*o.length));return t},form:function(e){return o(e).serializeArray()},ucfirst:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}}},{}]},{},[1]);
|
lib/view/{backup → backups}/index.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -27,8 +27,6 @@
|
|
27 |
<div class="ai1wm-container">
|
28 |
<div class="ai1wm-row">
|
29 |
<div class="ai1wm-left">
|
30 |
-
<?php include AI1WM_TEMPLATES_PATH . '/common/maintenance-mode.php'; ?>
|
31 |
-
|
32 |
<div class="ai1wm-holder">
|
33 |
<h1><i class="ai1wm-icon-export"></i> <?php _e( 'Backups', AI1WM_PLUGIN_NAME ); ?></h1>
|
34 |
|
@@ -76,15 +74,15 @@
|
|
76 |
<?php echo size_format( $backup['size'], 2 ); ?>
|
77 |
</td>
|
78 |
<td class="ai1wm-column-actions ai1wm-backup-actions">
|
79 |
-
<a href="<?php echo
|
80 |
<i class="ai1wm-icon-arrow-down ai1wm-icon-alone"></i>
|
81 |
<span><?php _e( 'Download', AI1WM_PLUGIN_NAME ); ?></span>
|
82 |
</a>
|
83 |
-
<a href="<?php echo
|
84 |
<i class="ai1wm-icon-cloud-upload ai1wm-icon-alone"></i>
|
85 |
<span><?php _e( 'Restore', AI1WM_PLUGIN_NAME ); ?></span>
|
86 |
</a>
|
87 |
-
<a href="#" data-
|
88 |
<i class="ai1wm-icon-close ai1wm-icon-alone"></i>
|
89 |
<span><?php _e( 'Delete', AI1WM_PLUGIN_NAME ); ?></span>
|
90 |
</a>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
27 |
<div class="ai1wm-container">
|
28 |
<div class="ai1wm-row">
|
29 |
<div class="ai1wm-left">
|
|
|
|
|
30 |
<div class="ai1wm-holder">
|
31 |
<h1><i class="ai1wm-icon-export"></i> <?php _e( 'Backups', AI1WM_PLUGIN_NAME ); ?></h1>
|
32 |
|
74 |
<?php echo size_format( $backup['size'], 2 ); ?>
|
75 |
</td>
|
76 |
<td class="ai1wm-column-actions ai1wm-backup-actions">
|
77 |
+
<a href="<?php echo ai1wm_backups_url( array( 'archive' => $backup['filename'] ) ); ?>" class="ai1wm-button-green ai1wm-button-alone ai1wm-backup-download">
|
78 |
<i class="ai1wm-icon-arrow-down ai1wm-icon-alone"></i>
|
79 |
<span><?php _e( 'Download', AI1WM_PLUGIN_NAME ); ?></span>
|
80 |
</a>
|
81 |
+
<a href="#" data-archive="<?php echo $backup['filename']; ?>" class="ai1wm-button-gray ai1wm-button-alone ai1wm-backup-restore">
|
82 |
<i class="ai1wm-icon-cloud-upload ai1wm-icon-alone"></i>
|
83 |
<span><?php _e( 'Restore', AI1WM_PLUGIN_NAME ); ?></span>
|
84 |
</a>
|
85 |
+
<a href="#" data-archive="<?php echo $backup['filename']; ?>" class="ai1wm-button-red ai1wm-button-alone ai1wm-backup-delete">
|
86 |
<i class="ai1wm-icon-close ai1wm-icon-alone"></i>
|
87 |
<span><?php _e( 'Delete', AI1WM_PLUGIN_NAME ); ?></span>
|
88 |
</a>
|
lib/view/common/maintenance-mode.php
CHANGED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php if ( Ai1wm_Maintenance::active() ): ?>
|
2 |
-
<div class="ai1wm-message-warning">
|
3 |
-
<?php
|
4 |
-
_e(
|
5 |
-
'Maintenance Mode is <strong>ON</strong>, switch it to ' .
|
6 |
-
'<a href="#" id="ai1wm-maintenance-off">OFF</a>',
|
7 |
-
AI1WM_PLUGIN_NAME
|
8 |
-
);
|
9 |
-
?>
|
10 |
-
</div>
|
11 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/view/export/advanced-settings.php
CHANGED
@@ -30,11 +30,6 @@
|
|
30 |
<input type="checkbox" id="ai1wm-no-database" name="options[no-database]" />
|
31 |
<label for="ai1wm-no-database"><?php _e( 'Do <strong>not</strong> export database (sql)', AI1WM_PLUGIN_NAME ); ?></label>
|
32 |
</li>
|
33 |
-
<li>
|
34 |
-
<input type="checkbox" id="ai1wm-maintenance-mode" name="options[maintenance-mode]" />
|
35 |
-
<label for="ai1wm-maintenance-mode"><?php _e( 'Put the site in <strong>maintenance mode</strong> while exporting', AI1WM_PLUGIN_NAME ); ?></label>
|
36 |
-
</li>
|
37 |
</ul>
|
38 |
</div>
|
39 |
</div>
|
40 |
-
|
30 |
<input type="checkbox" id="ai1wm-no-database" name="options[no-database]" />
|
31 |
<label for="ai1wm-no-database"><?php _e( 'Do <strong>not</strong> export database (sql)', AI1WM_PLUGIN_NAME ); ?></label>
|
32 |
</li>
|
|
|
|
|
|
|
|
|
33 |
</ul>
|
34 |
</div>
|
35 |
</div>
|
|
lib/view/export/button-onedrive.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<a href="https://servmask.com/products/onedrive-extension" target="_blank"><?php _e( 'OneDrive', AI1WM_PLUGIN_NAME ); ?></a>
|
lib/view/export/export-buttons.php
CHANGED
@@ -1,36 +1,21 @@
|
|
1 |
<div class="ai1wm-field-set">
|
2 |
-
|
3 |
-
<div class="ai1wm-
|
4 |
-
<div class="ai1wm-button-
|
5 |
-
<
|
6 |
-
|
7 |
-
<span class="
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
</span>
|
12 |
-
</div>
|
13 |
-
<ul class="ai1wm-dropdown-menu ai1wm-export-providers">
|
14 |
-
<?php foreach ( apply_filters( 'ai1wm_export_buttons', array() ) as $button ): ?>
|
15 |
-
<li>
|
16 |
-
<?php echo $button; ?>
|
17 |
-
</li>
|
18 |
-
<?php endforeach; ?>
|
19 |
-
</ul>
|
20 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
</div>
|
22 |
-
|
23 |
-
<div class="ai1wm-message ai1wm-red-message">
|
24 |
-
<?php
|
25 |
-
printf(
|
26 |
-
__(
|
27 |
-
'<h3>Site could not be exported!</h3>' .
|
28 |
-
'<p>Please make sure that storage directory <strong>%s</strong> has read and write permissions.</p>',
|
29 |
-
AI1WM_PLUGIN_NAME
|
30 |
-
),
|
31 |
-
AI1WM_STORAGE_PATH
|
32 |
-
);
|
33 |
-
?>
|
34 |
-
</div>
|
35 |
-
<?php endif; ?>
|
36 |
</div>
|
1 |
<div class="ai1wm-field-set">
|
2 |
+
<div class="ai1wm-buttons">
|
3 |
+
<div class="ai1wm-button-group ai1wm-button-export ai1wm-expandable">
|
4 |
+
<div class="ai1wm-button-main">
|
5 |
+
<span><?php _e( 'Export To', AI1WM_PLUGIN_NAME ); ?></span>
|
6 |
+
<span class="ai1mw-lines">
|
7 |
+
<span class="ai1wm-line ai1wm-line-first"></span>
|
8 |
+
<span class="ai1wm-line ai1wm-line-second"></span>
|
9 |
+
<span class="ai1wm-line ai1wm-line-third"></span>
|
10 |
+
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
</div>
|
12 |
+
<ul class="ai1wm-dropdown-menu ai1wm-export-providers">
|
13 |
+
<?php foreach ( apply_filters( 'ai1wm_export_buttons', array() ) as $button ): ?>
|
14 |
+
<li>
|
15 |
+
<?php echo $button; ?>
|
16 |
+
</li>
|
17 |
+
<?php endforeach; ?>
|
18 |
+
</ul>
|
19 |
</div>
|
20 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
</div>
|
lib/view/export/index.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -27,30 +27,13 @@
|
|
27 |
<div class="ai1wm-container">
|
28 |
<div class="ai1wm-row">
|
29 |
<div class="ai1wm-left">
|
30 |
-
<?php include AI1WM_TEMPLATES_PATH . '/common/maintenance-mode.php'; ?>
|
31 |
-
|
32 |
<div class="ai1wm-holder">
|
33 |
-
<?php foreach ( apply_filters( 'ai1wm-messages', array() ) as $type => $message ): ?>
|
34 |
-
<div class="ai1wm-message ai1wm-<?php echo $type; ?>-message">
|
35 |
-
<?php echo $message; ?>
|
36 |
-
</div>
|
37 |
-
<?php endforeach; ?>
|
38 |
-
|
39 |
<h1><i class="ai1wm-icon-export"></i> <?php _e( 'Export Site', AI1WM_PLUGIN_NAME ); ?></h1>
|
40 |
|
41 |
<?php include AI1WM_TEMPLATES_PATH . '/common/report-problem.php'; ?>
|
42 |
|
43 |
<form action="" method="post" id="ai1wm-export-form" class="ai1wm-clear">
|
44 |
|
45 |
-
<?php foreach ( $messages as $key => $text ): ?>
|
46 |
-
<div class="ai1wm-message ai1wm-info-message">
|
47 |
-
<a href="#" class="ai1wm-message-close-button" data-key="<?php echo $key; ?>">
|
48 |
-
<i class="ai1wm-icon-close"></i>
|
49 |
-
</a>
|
50 |
-
<?php echo $text; ?>
|
51 |
-
</div>
|
52 |
-
<?php endforeach; ?>
|
53 |
-
|
54 |
<?php include AI1WM_TEMPLATES_PATH . '/export/find-replace.php'; ?>
|
55 |
|
56 |
<?php do_action( 'ai1wm_export_left_options' ); ?>
|
@@ -60,6 +43,7 @@
|
|
60 |
<?php include AI1WM_TEMPLATES_PATH . '/export/export-buttons.php'; ?>
|
61 |
|
62 |
<?php do_action( 'ai1wm_export_left_end' ); ?>
|
|
|
63 |
</form>
|
64 |
</div>
|
65 |
</div>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
27 |
<div class="ai1wm-container">
|
28 |
<div class="ai1wm-row">
|
29 |
<div class="ai1wm-left">
|
|
|
|
|
30 |
<div class="ai1wm-holder">
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
<h1><i class="ai1wm-icon-export"></i> <?php _e( 'Export Site', AI1WM_PLUGIN_NAME ); ?></h1>
|
32 |
|
33 |
<?php include AI1WM_TEMPLATES_PATH . '/common/report-problem.php'; ?>
|
34 |
|
35 |
<form action="" method="post" id="ai1wm-export-form" class="ai1wm-clear">
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
<?php include AI1WM_TEMPLATES_PATH . '/export/find-replace.php'; ?>
|
38 |
|
39 |
<?php do_action( 'ai1wm_export_left_options' ); ?>
|
43 |
<?php include AI1WM_TEMPLATES_PATH . '/export/export-buttons.php'; ?>
|
44 |
|
45 |
<?php do_action( 'ai1wm_export_left_end' ); ?>
|
46 |
+
|
47 |
</form>
|
48 |
</div>
|
49 |
</div>
|
lib/view/import/button-onedrive.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<a href="https://servmask.com/products/onedrive-extension" target="_blank"><?php _e( 'OneDrive', AI1WM_PLUGIN_NAME ); ?></a>
|
lib/view/import/index.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -27,8 +27,6 @@
|
|
27 |
<div class="ai1wm-container">
|
28 |
<div class="ai1wm-row">
|
29 |
<div class="ai1wm-left">
|
30 |
-
<?php include AI1WM_TEMPLATES_PATH . '/common/maintenance-mode.php'; ?>
|
31 |
-
|
32 |
<div class="ai1wm-holder">
|
33 |
<h1><i class="ai1wm-icon-publish"></i> <?php _e( 'Import Site', AI1WM_PLUGIN_NAME ); ?></h1>
|
34 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
27 |
<div class="ai1wm-container">
|
28 |
<div class="ai1wm-row">
|
29 |
<div class="ai1wm-left">
|
|
|
|
|
30 |
<div class="ai1wm-holder">
|
31 |
<h1><i class="ai1wm-icon-publish"></i> <?php _e( 'Import Site', AI1WM_PLUGIN_NAME ); ?></h1>
|
32 |
|
lib/view/main/admin-head.php
CHANGED
@@ -48,7 +48,7 @@
|
|
48 |
color: #fff;
|
49 |
}
|
50 |
|
51 |
-
<?php if ( version_compare( $version, '3.8', '<' ) ): ?>
|
52 |
.toplevel_page_site-migration-export > div.wp-menu-image {
|
53 |
background: none !important;
|
54 |
}
|
@@ -68,7 +68,7 @@
|
|
68 |
-moz-osx-font-smoothing: grayscale !important;
|
69 |
}
|
70 |
|
71 |
-
<?php else: ?>
|
72 |
.toplevel_page_site-migration-export > div.wp-menu-image:before {
|
73 |
position: relative;
|
74 |
display: inline-block;
|
@@ -89,6 +89,5 @@
|
|
89 |
.wp-menu-open.toplevel_page_site-migration-export > a {
|
90 |
background-color: #111 !important;
|
91 |
}
|
92 |
-
|
93 |
<?php endif; ?>
|
94 |
</style>
|
48 |
color: #fff;
|
49 |
}
|
50 |
|
51 |
+
<?php if ( version_compare( $version, '3.8', '<' ) ) : ?>
|
52 |
.toplevel_page_site-migration-export > div.wp-menu-image {
|
53 |
background: none !important;
|
54 |
}
|
68 |
-moz-osx-font-smoothing: grayscale !important;
|
69 |
}
|
70 |
|
71 |
+
<?php else : ?>
|
72 |
.toplevel_page_site-migration-export > div.wp-menu-image:before {
|
73 |
position: relative;
|
74 |
display: inline-block;
|
89 |
.wp-menu-open.toplevel_page_site-migration-export > a {
|
90 |
background-color: #111 !important;
|
91 |
}
|
|
|
92 |
<?php endif; ?>
|
93 |
</style>
|
lib/view/main/backups-notice.php
CHANGED
@@ -12,4 +12,4 @@
|
|
12 |
)
|
13 |
?>
|
14 |
</p>
|
15 |
-
</div>
|
12 |
)
|
13 |
?>
|
14 |
</p>
|
15 |
+
</div>
|
loader.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
@@ -24,16 +24,6 @@
|
|
24 |
*/
|
25 |
|
26 |
// include all the files that you want to load in here
|
27 |
-
require_once AI1WM_VENDOR_PATH .
|
28 |
-
DIRECTORY_SEPARATOR .
|
29 |
-
'mysqldump-factory' .
|
30 |
-
DIRECTORY_SEPARATOR .
|
31 |
-
'mysqldump-factory' .
|
32 |
-
DIRECTORY_SEPARATOR .
|
33 |
-
'lib' .
|
34 |
-
DIRECTORY_SEPARATOR .
|
35 |
-
'MysqlDumpFactory.php';
|
36 |
-
|
37 |
require_once AI1WM_VENDOR_PATH .
|
38 |
DIRECTORY_SEPARATOR .
|
39 |
'bandar' .
|
@@ -108,17 +98,49 @@ require_once AI1WM_VENDOR_PATH .
|
|
108 |
DIRECTORY_SEPARATOR .
|
109 |
'class-ai1wm-extractor.php';
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
require_once AI1WM_CONTROLLER_PATH .
|
112 |
DIRECTORY_SEPARATOR .
|
113 |
'class-ai1wm-main-controller.php';
|
114 |
|
115 |
require_once AI1WM_CONTROLLER_PATH .
|
116 |
DIRECTORY_SEPARATOR .
|
117 |
-
'class-ai1wm-
|
118 |
|
119 |
require_once AI1WM_CONTROLLER_PATH .
|
120 |
DIRECTORY_SEPARATOR .
|
121 |
-
'class-ai1wm-
|
122 |
|
123 |
require_once AI1WM_CONTROLLER_PATH .
|
124 |
DIRECTORY_SEPARATOR .
|
@@ -126,7 +148,11 @@ require_once AI1WM_CONTROLLER_PATH .
|
|
126 |
|
127 |
require_once AI1WM_CONTROLLER_PATH .
|
128 |
DIRECTORY_SEPARATOR .
|
129 |
-
'class-ai1wm-
|
|
|
|
|
|
|
|
|
130 |
|
131 |
require_once AI1WM_CONTROLLER_PATH .
|
132 |
DIRECTORY_SEPARATOR .
|
@@ -136,57 +162,85 @@ require_once AI1WM_CONTROLLER_PATH .
|
|
136 |
DIRECTORY_SEPARATOR .
|
137 |
'class-ai1wm-report-controller.php';
|
138 |
|
139 |
-
require_once
|
140 |
DIRECTORY_SEPARATOR .
|
141 |
-
'class-ai1wm-
|
142 |
|
143 |
-
require_once
|
144 |
DIRECTORY_SEPARATOR .
|
145 |
-
'class-ai1wm-
|
146 |
|
147 |
-
require_once
|
148 |
DIRECTORY_SEPARATOR .
|
149 |
-
'class-ai1wm-
|
150 |
|
151 |
-
require_once
|
152 |
DIRECTORY_SEPARATOR .
|
153 |
-
'class-ai1wm-
|
154 |
|
155 |
-
require_once
|
156 |
DIRECTORY_SEPARATOR .
|
157 |
-
'class-ai1wm-
|
158 |
|
159 |
-
require_once
|
160 |
DIRECTORY_SEPARATOR .
|
161 |
-
'class-ai1wm-
|
162 |
|
163 |
-
require_once
|
164 |
DIRECTORY_SEPARATOR .
|
165 |
-
'class-ai1wm-export-
|
166 |
|
167 |
-
require_once
|
168 |
DIRECTORY_SEPARATOR .
|
169 |
-
'class-ai1wm-export-
|
170 |
|
171 |
-
require_once
|
172 |
DIRECTORY_SEPARATOR .
|
173 |
-
'class-ai1wm-
|
174 |
|
175 |
-
require_once
|
176 |
DIRECTORY_SEPARATOR .
|
177 |
-
'class-ai1wm-import-
|
178 |
|
179 |
-
require_once
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
DIRECTORY_SEPARATOR .
|
181 |
-
'class-ai1wm-import-
|
|
|
|
|
|
|
|
|
182 |
|
183 |
require_once AI1WM_MODEL_PATH .
|
184 |
DIRECTORY_SEPARATOR .
|
185 |
-
'class-ai1wm-
|
186 |
|
187 |
require_once AI1WM_MODEL_PATH .
|
188 |
DIRECTORY_SEPARATOR .
|
189 |
-
'class-ai1wm-
|
190 |
|
191 |
require_once AI1WM_MODEL_PATH .
|
192 |
DIRECTORY_SEPARATOR .
|
@@ -194,47 +248,47 @@ require_once AI1WM_MODEL_PATH .
|
|
194 |
|
195 |
require_once AI1WM_MODEL_PATH .
|
196 |
DIRECTORY_SEPARATOR .
|
197 |
-
'class-ai1wm-
|
198 |
|
199 |
require_once AI1WM_MODEL_PATH .
|
200 |
DIRECTORY_SEPARATOR .
|
201 |
-
'class-ai1wm-
|
202 |
|
203 |
require_once AI1WM_MODEL_PATH .
|
204 |
DIRECTORY_SEPARATOR .
|
205 |
-
'class-ai1wm-
|
206 |
|
207 |
require_once AI1WM_MODEL_PATH .
|
208 |
DIRECTORY_SEPARATOR .
|
209 |
-
'class-ai1wm-
|
210 |
|
211 |
require_once AI1WM_MODEL_PATH .
|
212 |
DIRECTORY_SEPARATOR .
|
213 |
-
'class-ai1wm-
|
214 |
|
215 |
require_once AI1WM_MODEL_PATH .
|
216 |
DIRECTORY_SEPARATOR .
|
217 |
-
'class-ai1wm-
|
218 |
|
219 |
-
require_once
|
220 |
DIRECTORY_SEPARATOR .
|
221 |
-
'class-ai1wm-
|
222 |
|
223 |
-
require_once
|
224 |
DIRECTORY_SEPARATOR .
|
225 |
-
'class-ai1wm-
|
226 |
|
227 |
-
require_once
|
228 |
DIRECTORY_SEPARATOR .
|
229 |
-
'class-ai1wm-
|
230 |
|
231 |
require_once AI1WM_EXCEPTION_PATH .
|
232 |
DIRECTORY_SEPARATOR .
|
233 |
-
'class-ai1wm-
|
234 |
|
235 |
require_once AI1WM_EXCEPTION_PATH .
|
236 |
DIRECTORY_SEPARATOR .
|
237 |
-
'class-ai1wm-
|
238 |
|
239 |
require_once AI1WM_EXCEPTION_PATH .
|
240 |
DIRECTORY_SEPARATOR .
|
@@ -244,6 +298,10 @@ require_once AI1WM_EXCEPTION_PATH .
|
|
244 |
DIRECTORY_SEPARATOR .
|
245 |
'class-ai1wm-import-exception.php';
|
246 |
|
|
|
|
|
|
|
|
|
247 |
require_once AI1WM_EXCEPTION_PATH .
|
248 |
DIRECTORY_SEPARATOR .
|
249 |
'class-ai1wm-not-accessible-exception.php';
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
24 |
*/
|
25 |
|
26 |
// include all the files that you want to load in here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
require_once AI1WM_VENDOR_PATH .
|
28 |
DIRECTORY_SEPARATOR .
|
29 |
'bandar' .
|
98 |
DIRECTORY_SEPARATOR .
|
99 |
'class-ai1wm-extractor.php';
|
100 |
|
101 |
+
require_once AI1WM_VENDOR_PATH .
|
102 |
+
DIRECTORY_SEPARATOR .
|
103 |
+
'servmask' .
|
104 |
+
DIRECTORY_SEPARATOR .
|
105 |
+
'database' .
|
106 |
+
DIRECTORY_SEPARATOR .
|
107 |
+
'class-ai1wm-database.php';
|
108 |
+
|
109 |
+
require_once AI1WM_VENDOR_PATH .
|
110 |
+
DIRECTORY_SEPARATOR .
|
111 |
+
'servmask' .
|
112 |
+
DIRECTORY_SEPARATOR .
|
113 |
+
'database' .
|
114 |
+
DIRECTORY_SEPARATOR .
|
115 |
+
'class-ai1wm-database-mysql.php';
|
116 |
+
|
117 |
+
require_once AI1WM_VENDOR_PATH .
|
118 |
+
DIRECTORY_SEPARATOR .
|
119 |
+
'servmask' .
|
120 |
+
DIRECTORY_SEPARATOR .
|
121 |
+
'database' .
|
122 |
+
DIRECTORY_SEPARATOR .
|
123 |
+
'class-ai1wm-database-mysqli.php';
|
124 |
+
|
125 |
+
require_once AI1WM_VENDOR_PATH .
|
126 |
+
DIRECTORY_SEPARATOR .
|
127 |
+
'servmask' .
|
128 |
+
DIRECTORY_SEPARATOR .
|
129 |
+
'database' .
|
130 |
+
DIRECTORY_SEPARATOR .
|
131 |
+
'class-ai1wm-database-utility.php';
|
132 |
+
|
133 |
require_once AI1WM_CONTROLLER_PATH .
|
134 |
DIRECTORY_SEPARATOR .
|
135 |
'class-ai1wm-main-controller.php';
|
136 |
|
137 |
require_once AI1WM_CONTROLLER_PATH .
|
138 |
DIRECTORY_SEPARATOR .
|
139 |
+
'class-ai1wm-export-controller.php';
|
140 |
|
141 |
require_once AI1WM_CONTROLLER_PATH .
|
142 |
DIRECTORY_SEPARATOR .
|
143 |
+
'class-ai1wm-import-controller.php';
|
144 |
|
145 |
require_once AI1WM_CONTROLLER_PATH .
|
146 |
DIRECTORY_SEPARATOR .
|
148 |
|
149 |
require_once AI1WM_CONTROLLER_PATH .
|
150 |
DIRECTORY_SEPARATOR .
|
151 |
+
'class-ai1wm-backups-controller.php';
|
152 |
+
|
153 |
+
require_once AI1WM_CONTROLLER_PATH .
|
154 |
+
DIRECTORY_SEPARATOR .
|
155 |
+
'class-ai1wm-updater-controller.php';
|
156 |
|
157 |
require_once AI1WM_CONTROLLER_PATH .
|
158 |
DIRECTORY_SEPARATOR .
|
162 |
DIRECTORY_SEPARATOR .
|
163 |
'class-ai1wm-report-controller.php';
|
164 |
|
165 |
+
require_once AI1WM_EXPORT_PATH .
|
166 |
DIRECTORY_SEPARATOR .
|
167 |
+
'class-ai1wm-export-resolve.php';
|
168 |
|
169 |
+
require_once AI1WM_EXPORT_PATH .
|
170 |
DIRECTORY_SEPARATOR .
|
171 |
+
'class-ai1wm-export-archive.php';
|
172 |
|
173 |
+
require_once AI1WM_EXPORT_PATH .
|
174 |
DIRECTORY_SEPARATOR .
|
175 |
+
'class-ai1wm-export-config.php';
|
176 |
|
177 |
+
require_once AI1WM_EXPORT_PATH .
|
178 |
DIRECTORY_SEPARATOR .
|
179 |
+
'class-ai1wm-export-enumerate.php';
|
180 |
|
181 |
+
require_once AI1WM_EXPORT_PATH .
|
182 |
DIRECTORY_SEPARATOR .
|
183 |
+
'class-ai1wm-export-content.php';
|
184 |
|
185 |
+
require_once AI1WM_EXPORT_PATH .
|
186 |
DIRECTORY_SEPARATOR .
|
187 |
+
'class-ai1wm-export-database.php';
|
188 |
|
189 |
+
require_once AI1WM_EXPORT_PATH .
|
190 |
DIRECTORY_SEPARATOR .
|
191 |
+
'class-ai1wm-export-download.php';
|
192 |
|
193 |
+
require_once AI1WM_EXPORT_PATH .
|
194 |
DIRECTORY_SEPARATOR .
|
195 |
+
'class-ai1wm-export-clean.php';
|
196 |
|
197 |
+
require_once AI1WM_IMPORT_PATH .
|
198 |
DIRECTORY_SEPARATOR .
|
199 |
+
'class-ai1wm-import-upload.php';
|
200 |
|
201 |
+
require_once AI1WM_IMPORT_PATH .
|
202 |
DIRECTORY_SEPARATOR .
|
203 |
+
'class-ai1wm-import-resolve.php';
|
204 |
|
205 |
+
require_once AI1WM_IMPORT_PATH .
|
206 |
+
DIRECTORY_SEPARATOR .
|
207 |
+
'class-ai1wm-import-validate.php';
|
208 |
+
|
209 |
+
require_once AI1WM_IMPORT_PATH .
|
210 |
+
DIRECTORY_SEPARATOR .
|
211 |
+
'class-ai1wm-import-blogs.php';
|
212 |
+
|
213 |
+
require_once AI1WM_IMPORT_PATH .
|
214 |
+
DIRECTORY_SEPARATOR .
|
215 |
+
'class-ai1wm-import-confirm.php';
|
216 |
+
|
217 |
+
require_once AI1WM_IMPORT_PATH .
|
218 |
+
DIRECTORY_SEPARATOR .
|
219 |
+
'class-ai1wm-import-enumerate.php';
|
220 |
+
|
221 |
+
require_once AI1WM_IMPORT_PATH .
|
222 |
+
DIRECTORY_SEPARATOR .
|
223 |
+
'class-ai1wm-import-content.php';
|
224 |
+
|
225 |
+
require_once AI1WM_IMPORT_PATH .
|
226 |
+
DIRECTORY_SEPARATOR .
|
227 |
+
'class-ai1wm-import-database.php';
|
228 |
+
|
229 |
+
require_once AI1WM_IMPORT_PATH .
|
230 |
DIRECTORY_SEPARATOR .
|
231 |
+
'class-ai1wm-import-done.php';
|
232 |
+
|
233 |
+
require_once AI1WM_IMPORT_PATH .
|
234 |
+
DIRECTORY_SEPARATOR .
|
235 |
+
'class-ai1wm-import-clean.php';
|
236 |
|
237 |
require_once AI1WM_MODEL_PATH .
|
238 |
DIRECTORY_SEPARATOR .
|
239 |
+
'class-ai1wm-deprecated.php';
|
240 |
|
241 |
require_once AI1WM_MODEL_PATH .
|
242 |
DIRECTORY_SEPARATOR .
|
243 |
+
'class-ai1wm-backups.php';
|
244 |
|
245 |
require_once AI1WM_MODEL_PATH .
|
246 |
DIRECTORY_SEPARATOR .
|
248 |
|
249 |
require_once AI1WM_MODEL_PATH .
|
250 |
DIRECTORY_SEPARATOR .
|
251 |
+
'class-ai1wm-feedback.php';
|
252 |
|
253 |
require_once AI1WM_MODEL_PATH .
|
254 |
DIRECTORY_SEPARATOR .
|
255 |
+
'class-ai1wm-report.php';
|
256 |
|
257 |
require_once AI1WM_MODEL_PATH .
|
258 |
DIRECTORY_SEPARATOR .
|
259 |
+
'class-ai1wm-template.php';
|
260 |
|
261 |
require_once AI1WM_MODEL_PATH .
|
262 |
DIRECTORY_SEPARATOR .
|
263 |
+
'class-ai1wm-config.php';
|
264 |
|
265 |
require_once AI1WM_MODEL_PATH .
|
266 |
DIRECTORY_SEPARATOR .
|
267 |
+
'class-ai1wm-status.php';
|
268 |
|
269 |
require_once AI1WM_MODEL_PATH .
|
270 |
DIRECTORY_SEPARATOR .
|
271 |
+
'class-ai1wm-http.php';
|
272 |
|
273 |
+
require_once AI1WM_MODEL_PATH .
|
274 |
DIRECTORY_SEPARATOR .
|
275 |
+
'class-ai1wm-handler.php';
|
276 |
|
277 |
+
require_once AI1WM_MODEL_PATH .
|
278 |
DIRECTORY_SEPARATOR .
|
279 |
+
'class-ai1wm-streams.php';
|
280 |
|
281 |
+
require_once AI1WM_MODEL_PATH .
|
282 |
DIRECTORY_SEPARATOR .
|
283 |
+
'class-ai1wm-log.php';
|
284 |
|
285 |
require_once AI1WM_EXCEPTION_PATH .
|
286 |
DIRECTORY_SEPARATOR .
|
287 |
+
'class-ai1wm-archive-exception.php';
|
288 |
|
289 |
require_once AI1WM_EXCEPTION_PATH .
|
290 |
DIRECTORY_SEPARATOR .
|
291 |
+
'class-ai1wm-backups-exception.php';
|
292 |
|
293 |
require_once AI1WM_EXCEPTION_PATH .
|
294 |
DIRECTORY_SEPARATOR .
|
298 |
DIRECTORY_SEPARATOR .
|
299 |
'class-ai1wm-import-exception.php';
|
300 |
|
301 |
+
require_once AI1WM_EXCEPTION_PATH .
|
302 |
+
DIRECTORY_SEPARATOR .
|
303 |
+
'class-ai1wm-http-exception.php';
|
304 |
+
|
305 |
require_once AI1WM_EXCEPTION_PATH .
|
306 |
DIRECTORY_SEPARATOR .
|
307 |
'class-ai1wm-not-accessible-exception.php';
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: yani.iliev, bangelov, pimjitsawang
|
|
3 |
Tags: db migration, migration, wordpress migration, db backup, db restore, website backup, website restore, website migration, website deploy, wordpress deploy, db backup, database export, database serialization, database find replace
|
4 |
Requires at least: 3.3
|
5 |
Tested up to: 4.4
|
6 |
-
Stable tag:
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
All-in-One WP Migration is the only tool that you will ever need to migrate a WordPress site.
|
@@ -25,7 +25,7 @@ All in One WP Plugin is the first plugin to offer true mobile experience on Word
|
|
25 |
= 0 Dependencies =
|
26 |
* The plugin does not require any php extensions and can work with PHP v5.2.
|
27 |
|
28 |
-
= Support for MySQL
|
29 |
* No matter what php mysql driver your webserver ships with, we support it.
|
30 |
|
31 |
= Support WordPress v3.3 up to v4.x =
|
@@ -62,7 +62,6 @@ All in One WP Plugin is the first plugin to offer true mobile experience on Word
|
|
62 |
* [Find out more about us](https://servmask.com)
|
63 |
|
64 |
[youtube http://www.youtube.com/watch?v=BpWxCeUWBOk]
|
65 |
-
[youtube http://www.youtube.com/watch?v=mRp7qTFYKgs]
|
66 |
|
67 |
== Installation ==
|
68 |
1. Upload the `all-in-one-wp-migration` folder to the `/wp-content/plugins/` directory
|
@@ -75,6 +74,12 @@ All in One WP Plugin is the first plugin to offer true mobile experience on Word
|
|
75 |
3. Plugin Menu
|
76 |
|
77 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
= 4.19 =
|
79 |
* Fixed an issue with options cache
|
80 |
|
3 |
Tags: db migration, migration, wordpress migration, db backup, db restore, website backup, website restore, website migration, website deploy, wordpress deploy, db backup, database export, database serialization, database find replace
|
4 |
Requires at least: 3.3
|
5 |
Tested up to: 4.4
|
6 |
+
Stable tag: 5.35
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
All-in-One WP Migration is the only tool that you will ever need to migrate a WordPress site.
|
25 |
= 0 Dependencies =
|
26 |
* The plugin does not require any php extensions and can work with PHP v5.2.
|
27 |
|
28 |
+
= Support for MySQL and MySQLi =
|
29 |
* No matter what php mysql driver your webserver ships with, we support it.
|
30 |
|
31 |
= Support WordPress v3.3 up to v4.x =
|
62 |
* [Find out more about us](https://servmask.com)
|
63 |
|
64 |
[youtube http://www.youtube.com/watch?v=BpWxCeUWBOk]
|
|
|
65 |
|
66 |
== Installation ==
|
67 |
1. Upload the `all-in-one-wp-migration` folder to the `/wp-content/plugins/` directory
|
74 |
3. Plugin Menu
|
75 |
|
76 |
== Changelog ==
|
77 |
+
= 5.35 =
|
78 |
+
* Add OneDrive to export/import pages
|
79 |
+
* Fix a bug when WordPress was used without a db prefix
|
80 |
+
* Fix a problem when downloading wpress files
|
81 |
+
* Improve the log system
|
82 |
+
|
83 |
= 4.19 =
|
84 |
* Fixed an issue with options cache
|
85 |
|
uninstall.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright (C) 2014 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright (C) 2014-2016 ServMask Inc.
|
4 |
*
|
5 |
* This program is free software: you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|