SiteGround Migrator - Version 2.0.5

Version Description

Download this release

Release Info

Developer elenachavdarova
Plugin Icon 128x128 SiteGround Migrator
Version 2.0.5
Comparing to
See all releases

Code changes from version 2.0.4 to 2.0.5

README.txt CHANGED
@@ -46,6 +46,11 @@ In version 1.0.13 we've added WP-CLI command for migrations.
46
 
47
  == Changelog ==
48
 
 
 
 
 
 
49
  = Version 2.0.4 =
50
  Release Date: Nov 8th, 2022
51
 
46
 
47
  == Changelog ==
48
 
49
+ = Version 2.0.5 =
50
+ Release Date: Dec 8th, 2022
51
+
52
+ * Improved error handling
53
+
54
  = Version 2.0.4 =
55
  Release Date: Nov 8th, 2022
56
 
core/Files_Service/Files_Service.php CHANGED
@@ -189,7 +189,7 @@ class Files_Service {
189
  $wp_filesystem->mkdir( $source_path . '-transfer' );
190
 
191
  // Copy the directory, so that we can manipulate the files without hurting performance.
192
- copy_dir( $source_path, $source_path . '-transfer' );
193
 
194
  // SGS Encrypt file include.
195
  if ( preg_match( '~plugins\/sg-security$~', $source_path ) ) {
189
  $wp_filesystem->mkdir( $source_path . '-transfer' );
190
 
191
  // Copy the directory, so that we can manipulate the files without hurting performance.
192
+ \copy_dir( $source_path, $source_path . '-transfer' );
193
 
194
  // SGS Encrypt file include.
195
  if ( preg_match( '~plugins\/sg-security$~', $source_path ) ) {
core/Helper/Helper.php CHANGED
@@ -26,6 +26,8 @@ class Helper {
26
  'https://www.siteground.com/kb/wordpress-migrator-following-path-invalid-doesnt-exist',
27
  'https://www.siteground.com/kb/wordpress-migrator-memory-tried-allocate-bytes/',
28
  'https://www.siteground.com/kb/wordpress-migrator-maximum-execution-time-seconds-exceeded',
 
 
29
  );
30
 
31
  /**
@@ -45,6 +47,8 @@ class Helper {
45
  'the following path is invalid or doesn\'t exist',
46
  'out of memory',
47
  'maximum execution time of',
 
 
48
  );
49
 
50
  /**
@@ -79,6 +83,10 @@ class Helper {
79
  return $message;
80
  }
81
 
 
 
 
 
82
  return $message . '<br><br> For more information on how to solve this problem, please read <a href="' . $article . '" target="_blank">this article</a>';
83
  }
84
 
26
  'https://www.siteground.com/kb/wordpress-migrator-following-path-invalid-doesnt-exist',
27
  'https://www.siteground.com/kb/wordpress-migrator-memory-tried-allocate-bytes/',
28
  'https://www.siteground.com/kb/wordpress-migrator-maximum-execution-time-seconds-exceeded',
29
+ 'https://www.siteground.com/kb/wordpress-migrator-permissions-error/',
30
+ 'https://www.siteground.com/kb/wordpress-migrator-permissions-error/'
31
  );
32
 
33
  /**
47
  'the following path is invalid or doesn\'t exist',
48
  'out of memory',
49
  'maximum execution time of',
50
+ 'failed to open dir',
51
+ 'returned a file that could not be opened',
52
  );
53
 
54
  /**
83
  return $message;
84
  }
85
 
86
+ if ( $article === 'https://www.siteground.com/kb/wordpress-migrator-permissions-error/' ) {
87
+ $message = esc_html__( 'We’ve encountered a critical error in your current hosting environment that prevents our plugin to complete the transfer. Please check your current hosting permissions and error logs and initiate new transfer ', 'siteground-migrator' );
88
+ }
89
+
90
  return $message . '<br><br> For more information on how to solve this problem, please read <a href="' . $article . '" target="_blank">this article</a>';
91
  }
92
 
siteground-migrator.php CHANGED
@@ -24,7 +24,7 @@ use ShuttleExport\Exporter;
24
  * Plugin Name: SiteGround Migrator
25
  * Plugin URI: http://siteground.com
26
  * Description: This plugin is designed to migrate your WordPress site to SiteGround
27
- * Version: 2.0.4
28
  * Author: SiteGround
29
  * Author URI: https://www.siteground.com
30
  * License: GPL-2.0+
@@ -40,7 +40,7 @@ if ( ! defined( 'WPINC' ) ) {
40
 
41
  // Define version constant.
42
  if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
43
- define( __NAMESPACE__ . '\VERSION', '2.0.4' );
44
  }
45
 
46
  // Define slug constant.
24
  * Plugin Name: SiteGround Migrator
25
  * Plugin URI: http://siteground.com
26
  * Description: This plugin is designed to migrate your WordPress site to SiteGround
27
+ * Version: 2.0.5
28
  * Author: SiteGround
29
  * Author URI: https://www.siteground.com
30
  * License: GPL-2.0+
40
 
41
  // Define version constant.
42
  if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
43
+ define( __NAMESPACE__ . '\VERSION', '2.0.5' );
44
  }
45
 
46
  // Define slug constant.
vendor/autoload.php CHANGED
@@ -3,8 +3,21 @@
3
  // autoload.php @generated by Composer
4
 
5
  if (PHP_VERSION_ID < 50600) {
6
- echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
7
- exit(1);
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
3
  // autoload.php @generated by Composer
4
 
5
  if (PHP_VERSION_ID < 50600) {
6
+ if (!headers_sent()) {
7
+ header('HTTP/1.1 500 Internal Server Error');
8
+ }
9
+ $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
10
+ if (!ini_get('display_errors')) {
11
+ if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
12
+ fwrite(STDERR, $err);
13
+ } elseif (!headers_sent()) {
14
+ echo $err;
15
+ }
16
+ }
17
+ trigger_error(
18
+ $err,
19
+ E_USER_ERROR
20
+ );
21
  }
22
 
23
  require_once __DIR__ . '/composer/autoload_real.php';
vendor/composer/InstalledVersions.php CHANGED
@@ -28,7 +28,7 @@ class InstalledVersions
28
  {
29
  /**
30
  * @var mixed[]|null
31
- * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
32
  */
33
  private static $installed;
34
 
@@ -39,7 +39,7 @@ class InstalledVersions
39
 
40
  /**
41
  * @var array[]
42
- * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
43
  */
44
  private static $installedByVendor = array();
45
 
@@ -243,7 +243,7 @@ class InstalledVersions
243
 
244
  /**
245
  * @return array
246
- * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
247
  */
248
  public static function getRootPackage()
249
  {
@@ -257,7 +257,7 @@ class InstalledVersions
257
  *
258
  * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
259
  * @return array[]
260
- * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
261
  */
262
  public static function getRawData()
263
  {
@@ -280,7 +280,7 @@ class InstalledVersions
280
  * Returns the raw data of all installed.php which are currently loaded for custom implementations
281
  *
282
  * @return array[]
283
- * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
284
  */
285
  public static function getAllRawData()
286
  {
@@ -303,7 +303,7 @@ class InstalledVersions
303
  * @param array[] $data A vendor/composer/installed.php data set
304
  * @return void
305
  *
306
- * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
307
  */
308
  public static function reload($data)
309
  {
@@ -313,7 +313,7 @@ class InstalledVersions
313
 
314
  /**
315
  * @return array[]
316
- * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
317
  */
318
  private static function getInstalled()
319
  {
28
  {
29
  /**
30
  * @var mixed[]|null
31
+ * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
32
  */
33
  private static $installed;
34
 
39
 
40
  /**
41
  * @var array[]
42
+ * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
43
  */
44
  private static $installedByVendor = array();
45
 
243
 
244
  /**
245
  * @return array
246
+ * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
247
  */
248
  public static function getRootPackage()
249
  {
257
  *
258
  * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
259
  * @return array[]
260
+ * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
261
  */
262
  public static function getRawData()
263
  {
280
  * Returns the raw data of all installed.php which are currently loaded for custom implementations
281
  *
282
  * @return array[]
283
+ * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
284
  */
285
  public static function getAllRawData()
286
  {
303
  * @param array[] $data A vendor/composer/installed.php data set
304
  * @return void
305
  *
306
+ * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
307
  */
308
  public static function reload($data)
309
  {
313
 
314
  /**
315
  * @return array[]
316
+ * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
317
  */
318
  private static function getInstalled()
319
  {
vendor/composer/installed.json CHANGED
@@ -74,9 +74,9 @@
74
  "source": {
75
  "type": "git",
76
  "url": "https://gitlab.siteground.com/wordpress/siteground-i18n.git",
77
- "reference": "b242d643714a172f4d000e3b6a05a6069c8dd30b"
78
  },
79
- "time": "2022-01-31T13:14:49+00:00",
80
  "default-branch": true,
81
  "type": "library",
82
  "installation-source": "source",
74
  "source": {
75
  "type": "git",
76
  "url": "https://gitlab.siteground.com/wordpress/siteground-i18n.git",
77
+ "reference": "714db79a69f373acd8f8023aededc27e94463041"
78
  },
79
+ "time": "2022-11-22T15:52:04+00:00",
80
  "default-branch": true,
81
  "type": "library",
82
  "installation-source": "source",
vendor/composer/installed.php CHANGED
@@ -1,62 +1,62 @@
1
  <?php return array(
2
  'root' => array(
 
3
  'pretty_version' => 'dev-master',
4
  'version' => 'dev-master',
 
5
  'type' => 'library',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => 'cbe2f7a78fe35514bfd1a74ed060941a85dc4003',
9
- 'name' => 'siteground/siteground-migrator',
10
  'dev' => true,
11
  ),
12
  'versions' => array(
13
  '2createstudio/shuttleexport' => array(
14
  'pretty_version' => 'dev-namespaced',
15
  'version' => 'dev-namespaced',
 
16
  'type' => 'library',
17
  'install_path' => __DIR__ . '/../2createStudio/ShuttleExport',
18
  'aliases' => array(),
19
- 'reference' => 'ecd4087b20ad034d410b1dda0416b1467fd1cebe',
20
  'dev_requirement' => false,
21
  ),
22
  'siteground/siteground-helper' => array(
23
  'pretty_version' => 'dev-master',
24
  'version' => 'dev-master',
 
25
  'type' => 'library',
26
  'install_path' => __DIR__ . '/../siteground/siteground-helper',
27
  'aliases' => array(
28
  0 => '9999999-dev',
29
  ),
30
- 'reference' => 'b735bf5df36006a0e8435a6ba79b5b5cfa0e66dc',
31
  'dev_requirement' => false,
32
  ),
33
  'siteground/siteground-i18n' => array(
34
  'pretty_version' => 'dev-master',
35
  'version' => 'dev-master',
 
36
  'type' => 'library',
37
  'install_path' => __DIR__ . '/../siteground/siteground-i18n',
38
  'aliases' => array(
39
  0 => '9999999-dev',
40
  ),
41
- 'reference' => 'b242d643714a172f4d000e3b6a05a6069c8dd30b',
42
  'dev_requirement' => false,
43
  ),
44
  'siteground/siteground-migrator' => array(
45
  'pretty_version' => 'dev-master',
46
  'version' => 'dev-master',
 
47
  'type' => 'library',
48
  'install_path' => __DIR__ . '/../../',
49
  'aliases' => array(),
50
- 'reference' => 'cbe2f7a78fe35514bfd1a74ed060941a85dc4003',
51
  'dev_requirement' => false,
52
  ),
53
  'symfony/process' => array(
54
  'pretty_version' => 'v2.0.25',
55
  'version' => '2.0.25.0',
 
56
  'type' => 'library',
57
  'install_path' => __DIR__ . '/../symfony/process/Symfony/Component/Process',
58
  'aliases' => array(),
59
- 'reference' => '7d92786475f2b7d4a4f4be4f0076732ace155df2',
60
  'dev_requirement' => false,
61
  ),
62
  ),
1
  <?php return array(
2
  'root' => array(
3
+ 'name' => 'siteground/siteground-migrator',
4
  'pretty_version' => 'dev-master',
5
  'version' => 'dev-master',
6
+ 'reference' => 'fb9c18707406edc8828837ffc6f1a9ea1bc94dc0',
7
  'type' => 'library',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
 
 
10
  'dev' => true,
11
  ),
12
  'versions' => array(
13
  '2createstudio/shuttleexport' => array(
14
  'pretty_version' => 'dev-namespaced',
15
  'version' => 'dev-namespaced',
16
+ 'reference' => 'ecd4087b20ad034d410b1dda0416b1467fd1cebe',
17
  'type' => 'library',
18
  'install_path' => __DIR__ . '/../2createStudio/ShuttleExport',
19
  'aliases' => array(),
 
20
  'dev_requirement' => false,
21
  ),
22
  'siteground/siteground-helper' => array(
23
  'pretty_version' => 'dev-master',
24
  'version' => 'dev-master',
25
+ 'reference' => 'b735bf5df36006a0e8435a6ba79b5b5cfa0e66dc',
26
  'type' => 'library',
27
  'install_path' => __DIR__ . '/../siteground/siteground-helper',
28
  'aliases' => array(
29
  0 => '9999999-dev',
30
  ),
 
31
  'dev_requirement' => false,
32
  ),
33
  'siteground/siteground-i18n' => array(
34
  'pretty_version' => 'dev-master',
35
  'version' => 'dev-master',
36
+ 'reference' => '714db79a69f373acd8f8023aededc27e94463041',
37
  'type' => 'library',
38
  'install_path' => __DIR__ . '/../siteground/siteground-i18n',
39
  'aliases' => array(
40
  0 => '9999999-dev',
41
  ),
 
42
  'dev_requirement' => false,
43
  ),
44
  'siteground/siteground-migrator' => array(
45
  'pretty_version' => 'dev-master',
46
  'version' => 'dev-master',
47
+ 'reference' => 'fb9c18707406edc8828837ffc6f1a9ea1bc94dc0',
48
  'type' => 'library',
49
  'install_path' => __DIR__ . '/../../',
50
  'aliases' => array(),
 
51
  'dev_requirement' => false,
52
  ),
53
  'symfony/process' => array(
54
  'pretty_version' => 'v2.0.25',
55
  'version' => '2.0.25.0',
56
+ 'reference' => '7d92786475f2b7d4a4f4be4f0076732ace155df2',
57
  'type' => 'library',
58
  'install_path' => __DIR__ . '/../symfony/process/Symfony/Component/Process',
59
  'aliases' => array(),
 
60
  'dev_requirement' => false,
61
  ),
62
  ),
vendor/siteground/siteground-helper/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- /vendor/
2
- .DS_Store
3
- /.DS_Store
 
 
 
vendor/siteground/siteground-i18n/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- /vendor/
2
- .DS_Store
3
- /.DS_Store
 
 
 
vendor/siteground/siteground-i18n/src/i18n_Service.php CHANGED
@@ -20,15 +20,24 @@ class i18n_Service {
20
  */
21
  public $sg_textdomain;
22
 
 
 
 
 
 
 
 
23
  /**
24
  * Class construct.
25
  *
26
  * @since 1.0.0
27
  *
28
  * @param string $textdomain The text domain that will be used for the instance.
 
29
  */
30
- public function __construct( $textdomain ) {
31
  $this->sg_textdomain = $textdomain;
 
32
  }
33
 
34
  /**
@@ -40,7 +49,7 @@ class i18n_Service {
40
  load_plugin_textdomain(
41
  $this->sg_textdomain,
42
  false,
43
- $this->sg_textdomain . '/languages'
44
  );
45
  }
46
 
@@ -83,14 +92,14 @@ class i18n_Service {
83
  foreach ( $keys as $key ) {
84
  // Convert a PO file to Jed-compatible JSON.
85
  $json = $po_to_json
86
- ->withPoFile( WP_CONTENT_DIR . '/languages/plugins/' . $this->sg_textdomain . '-' . $extra['translations'][ $key ]['language'] . '.po' )
87
  ->toJedJson( false, $this->sg_textdomain );
88
 
89
  // Convert and get the json content.
90
  $content = json_decode( $json, true );
91
 
92
  // Build the json filepath.
93
- $json_filepath = WP_CONTENT_DIR . '/languages/plugins/' . $this->sg_textdomain . '-' . $extra['translations'][ $key ]['language'] . '.json';
94
 
95
  // Create the file if donesn't exists.
96
  if ( ! is_file( $json_filepath ) ) {
@@ -120,7 +129,7 @@ class i18n_Service {
120
  // Possible langugaes paths.
121
  $dirs = array(
122
  'wp-content/languages/plugins/',
123
- 'wp-content/plugins/' . $this->sg_textdomain . '/languages/json/',
124
  );
125
 
126
  foreach ( $dirs as $dir ) {
20
  */
21
  public $sg_textdomain;
22
 
23
+ /**
24
+ * Variable holding the plugin folder.
25
+ *
26
+ * @var string
27
+ */
28
+ public $folder;
29
+
30
  /**
31
  * Class construct.
32
  *
33
  * @since 1.0.0
34
  *
35
  * @param string $textdomain The text domain that will be used for the instance.
36
+ * @param string $folder The folder that will be used for the instance.
37
  */
38
+ public function __construct( $textdomain, $folder = '' ) {
39
  $this->sg_textdomain = $textdomain;
40
+ $this->folder = empty( $folder ) ? $textdomain : $folder;
41
  }
42
 
43
  /**
49
  load_plugin_textdomain(
50
  $this->sg_textdomain,
51
  false,
52
+ $this->folder . '/languages'
53
  );
54
  }
55
 
92
  foreach ( $keys as $key ) {
93
  // Convert a PO file to Jed-compatible JSON.
94
  $json = $po_to_json
95
+ ->withPoFile( WP_CONTENT_DIR . '/languages/plugins/' . $this->folder . '-' . $extra['translations'][ $key ]['language'] . '.po' )
96
  ->toJedJson( false, $this->sg_textdomain );
97
 
98
  // Convert and get the json content.
99
  $content = json_decode( $json, true );
100
 
101
  // Build the json filepath.
102
+ $json_filepath = WP_CONTENT_DIR . '/languages/plugins/' . $this->folder . '-' . $extra['translations'][ $key ]['language'] . '.json';
103
 
104
  // Create the file if donesn't exists.
105
  if ( ! is_file( $json_filepath ) ) {
129
  // Possible langugaes paths.
130
  $dirs = array(
131
  'wp-content/languages/plugins/',
132
+ 'wp-content/plugins/' . $this->folder . '/languages/json/',
133
  );
134
 
135
  foreach ( $dirs as $dir ) {