wp-studio 1.7.10 → 1.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{_events-BcapW3eh.mjs → _events-B8xQ_baD.mjs} +4 -5
- package/dist/cli/appdata-D-luHxJU.mjs +19 -0
- package/dist/cli/{certificate-manager-SVYcCL_i.mjs → certificate-manager-v-yNLDFJ.mjs} +134 -15
- package/dist/cli/{delete-D1924O3o.mjs → delete-BG-E-HsW.mjs} +3 -3
- package/dist/cli/{helpers-oQuItT8n.mjs → helpers-CIAgfdq8.mjs} +2 -2
- package/dist/cli/{index-4lan3TI_.mjs → index-Bej4fL6n.mjs} +31 -4
- package/dist/cli/{index-BjzOJKPi.mjs → index-Dhun0W1n.mjs} +90 -52
- package/dist/cli/{index-DRQnCQvM.mjs → index-ul3DeWvy.mjs} +1308 -1109
- package/dist/cli/{list-DOFyyV1f.mjs → list-ck0oK4vb.mjs} +3 -3
- package/dist/cli/{login-BtPZeZ4G.mjs → login-Dz63Zdfn.mjs} +3 -3
- package/dist/cli/{logout-Cr631QzG.mjs → logout-CLUKQeZh.mjs} +2 -3
- package/dist/cli/main.mjs +2 -2
- package/dist/cli/{paths-CqXGLB7R.mjs → paths-D7DniT1Q.mjs} +7 -6
- package/dist/cli/plugin/skills/rank-me-up/SKILL.md +166 -0
- package/dist/cli/plugin/skills/site-spec/SKILL.md +4 -0
- package/dist/cli/process-manager-daemon.mjs +29 -5
- package/dist/cli/{process-manager-ipc-BisO0qtU.mjs → process-manager-ipc-GCdebuBH.mjs} +4 -1
- package/dist/cli/proxy-daemon.mjs +1 -1
- package/dist/cli/{prune-pm-logs-COryxqeo.mjs → prune-pm-logs-Dm_Bwi7l.mjs} +1 -1
- package/dist/cli/{resume-BwDwdJtq.mjs → resume-BSIOJnyM.mjs} +4 -15
- package/dist/cli/{rewrite-wp-cli-post-content-2zlfFnKT.mjs → rewrite-wp-cli-post-content-Beo5_Ojo.mjs} +32 -531
- package/dist/cli/{set-D5eeqHbp.mjs → set-CtDZnARG.mjs} +2 -3
- package/dist/cli/{set-DYnzUz_G.mjs → set-PJvs-Yw5.mjs} +4 -5
- package/dist/cli/{status-DNvMZBqD.mjs → status-DU07aAtD.mjs} +2 -2
- package/dist/cli/well-known-paths-QcSJNi_l.mjs +95 -0
- package/dist/cli/wordpress-server-child.mjs +5 -3
- package/dist/cli/{wp-DD2-QiiP.mjs → wp-_X-h-yuW.mjs} +2 -2
- package/dist/cli/wp-files/latest/available-site-translations.json +1 -1
- package/dist/cli/wp-files/sqlite-database-integration/admin-page.php +1 -2
- package/dist/cli/wp-files/sqlite-database-integration/constants.php +0 -5
- package/dist/cli/wp-files/sqlite-database-integration/load.php +1 -1
- package/dist/cli/wp-files/sqlite-database-integration/readme.txt +6 -3
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/database/sqlite/class-wp-pdo-mysql-on-sqlite.php +22 -3
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/database/version.php +1 -1
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php +41 -89
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/db.php +2 -24
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/install-functions.php +7 -16
- package/package.json +2 -1
- package/dist/cli/well-known-paths-BYA1Bw5o.mjs +0 -214
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-lexer.php +0 -2575
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-pdo-user-defined-functions.php +0 -899
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-query-rewriter.php +0 -343
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-token.php +0 -327
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-translator.php +0 -4543
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/php-polyfills.php +0 -68
package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php
CHANGED
|
@@ -16,7 +16,7 @@ class WP_SQLite_DB extends wpdb {
|
|
|
16
16
|
/**
|
|
17
17
|
* Database Handle
|
|
18
18
|
*
|
|
19
|
-
* @var
|
|
19
|
+
* @var WP_SQLite_Driver
|
|
20
20
|
*/
|
|
21
21
|
protected $dbh;
|
|
22
22
|
|
|
@@ -94,10 +94,6 @@ class WP_SQLite_DB extends wpdb {
|
|
|
94
94
|
* @param array $modes Optional. A list of SQL modes to set. Default empty array.
|
|
95
95
|
*/
|
|
96
96
|
public function set_sql_mode( $modes = array() ) {
|
|
97
|
-
if ( ! $this->dbh instanceof WP_SQLite_Driver ) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
97
|
if ( empty( $modes ) ) {
|
|
102
98
|
$result = $this->dbh->query( 'SELECT @@SESSION.sql_mode' );
|
|
103
99
|
if ( ! isset( $result[0] ) ) {
|
|
@@ -175,28 +171,6 @@ class WP_SQLite_DB extends wpdb {
|
|
|
175
171
|
return $this->add_placeholder_escape( $escaped );
|
|
176
172
|
}
|
|
177
173
|
|
|
178
|
-
/**
|
|
179
|
-
* Method to dummy out wpdb::esc_like() function.
|
|
180
|
-
*
|
|
181
|
-
* WordPress 4.0.0 introduced esc_like() function that adds backslashes to %,
|
|
182
|
-
* underscore and backslash, which is not interpreted as escape character
|
|
183
|
-
* by SQLite. So we override it and dummy out this function.
|
|
184
|
-
*
|
|
185
|
-
* @param string $text The raw text to be escaped. The input typed by the user should have no
|
|
186
|
-
* extra or deleted slashes.
|
|
187
|
-
*
|
|
188
|
-
* @return string Text in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare()
|
|
189
|
-
* or real_escape next.
|
|
190
|
-
*/
|
|
191
|
-
public function esc_like( $text ) {
|
|
192
|
-
// The new driver adds "ESCAPE '\\'" to every LIKE expression by default.
|
|
193
|
-
// We only need to overload this function to a no-op for the old driver.
|
|
194
|
-
if ( $this->dbh instanceof WP_SQLite_Driver ) {
|
|
195
|
-
return parent::esc_like( $text );
|
|
196
|
-
}
|
|
197
|
-
return $text;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
174
|
/**
|
|
201
175
|
* Prints SQL/DB error.
|
|
202
176
|
*
|
|
@@ -326,34 +300,28 @@ class WP_SQLite_DB extends wpdb {
|
|
|
326
300
|
}
|
|
327
301
|
}
|
|
328
302
|
|
|
329
|
-
if (
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
303
|
+
if ( null === $this->dbname || '' === $this->dbname ) {
|
|
304
|
+
$this->bail(
|
|
305
|
+
'The database name was not set. The SQLite driver requires a database name to be set to emulate MySQL information schema tables.',
|
|
306
|
+
'db_connect_fail'
|
|
307
|
+
);
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
337
310
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
} else {
|
|
354
|
-
$this->dbh = new WP_SQLite_Translator( $pdo );
|
|
355
|
-
$this->last_error = $this->dbh->get_error_message();
|
|
356
|
-
$GLOBALS['@pdo'] = $this->dbh->get_pdo();
|
|
311
|
+
$this->ensure_database_directory( FQDB );
|
|
312
|
+
|
|
313
|
+
try {
|
|
314
|
+
$connection = new WP_SQLite_Connection(
|
|
315
|
+
array(
|
|
316
|
+
'pdo' => $pdo,
|
|
317
|
+
'path' => FQDB,
|
|
318
|
+
'journal_mode' => defined( 'SQLITE_JOURNAL_MODE' ) ? SQLITE_JOURNAL_MODE : null,
|
|
319
|
+
)
|
|
320
|
+
);
|
|
321
|
+
$this->dbh = new WP_SQLite_Driver( $connection, $this->dbname );
|
|
322
|
+
$GLOBALS['@pdo'] = $this->dbh->get_connection()->get_pdo();
|
|
323
|
+
} catch ( Throwable $e ) {
|
|
324
|
+
$this->last_error = $this->format_error_message( $e );
|
|
357
325
|
}
|
|
358
326
|
if ( $this->last_error ) {
|
|
359
327
|
return false;
|
|
@@ -467,11 +435,7 @@ class WP_SQLite_DB extends wpdb {
|
|
|
467
435
|
if ( preg_match( '/^\s*(create|alter|truncate|drop)\s/i', $query ) ) {
|
|
468
436
|
$return_val = true;
|
|
469
437
|
} elseif ( preg_match( '/^\s*(insert|delete|update|replace)\s/i', $query ) ) {
|
|
470
|
-
|
|
471
|
-
$this->rows_affected = $this->dbh->get_last_return_value();
|
|
472
|
-
} else {
|
|
473
|
-
$this->rows_affected = $this->dbh->get_affected_rows();
|
|
474
|
-
}
|
|
438
|
+
$this->rows_affected = $this->dbh->get_last_return_value();
|
|
475
439
|
|
|
476
440
|
// Take note of the insert_id.
|
|
477
441
|
if ( preg_match( '/^\s*(insert|replace)\s/i', $query ) ) {
|
|
@@ -516,11 +480,7 @@ class WP_SQLite_DB extends wpdb {
|
|
|
516
480
|
}
|
|
517
481
|
|
|
518
482
|
// Add SQLite query data.
|
|
519
|
-
|
|
520
|
-
$this->queries[ $i ]['sqlite_queries'] = $this->dbh->get_last_sqlite_queries();
|
|
521
|
-
} else {
|
|
522
|
-
$this->queries[ $i ]['sqlite_queries'] = $this->dbh->executed_sqlite_queries;
|
|
523
|
-
}
|
|
483
|
+
$this->queries[ $i ]['sqlite_queries'] = $this->dbh->get_last_sqlite_queries();
|
|
524
484
|
}
|
|
525
485
|
return $return_val;
|
|
526
486
|
}
|
|
@@ -545,10 +505,6 @@ class WP_SQLite_DB extends wpdb {
|
|
|
545
505
|
$this->last_error = $this->format_error_message( $e );
|
|
546
506
|
}
|
|
547
507
|
|
|
548
|
-
if ( $this->dbh instanceof WP_SQLite_Translator ) {
|
|
549
|
-
$this->last_error = $this->dbh->get_error_message();
|
|
550
|
-
}
|
|
551
|
-
|
|
552
508
|
++$this->num_queries;
|
|
553
509
|
|
|
554
510
|
if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
|
|
@@ -573,27 +529,23 @@ class WP_SQLite_DB extends wpdb {
|
|
|
573
529
|
if ( $this->col_info ) {
|
|
574
530
|
return;
|
|
575
531
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
$
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
);
|
|
594
|
-
}
|
|
595
|
-
} else {
|
|
596
|
-
$this->col_info = $this->dbh->get_columns();
|
|
532
|
+
$this->col_info = array();
|
|
533
|
+
foreach ( $this->dbh->get_last_column_meta() as $column ) {
|
|
534
|
+
$this->col_info[] = (object) array(
|
|
535
|
+
'name' => $column['name'],
|
|
536
|
+
'orgname' => $column['mysqli:orgname'],
|
|
537
|
+
'table' => $column['table'],
|
|
538
|
+
'orgtable' => $column['mysqli:orgtable'],
|
|
539
|
+
'def' => '', // Unused, always ''.
|
|
540
|
+
'db' => $column['mysqli:db'],
|
|
541
|
+
'catalog' => 'def', // Unused, always 'def'.
|
|
542
|
+
'max_length' => 0, // As of PHP 8.1, this is always 0.
|
|
543
|
+
'length' => $column['len'],
|
|
544
|
+
'charsetnr' => $column['mysqli:charsetnr'],
|
|
545
|
+
'flags' => $column['mysqli:flags'],
|
|
546
|
+
'type' => $column['mysqli:type'],
|
|
547
|
+
'decimals' => $column['precision'],
|
|
548
|
+
);
|
|
597
549
|
}
|
|
598
550
|
}
|
|
599
551
|
|
|
@@ -47,33 +47,11 @@ if ( ! extension_loaded( 'pdo_sqlite' ) ) {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
require_once __DIR__ . '/../database/load.php';
|
|
52
|
-
} else {
|
|
53
|
-
require_once __DIR__ . '/php-polyfills.php';
|
|
54
|
-
require_once __DIR__ . '/class-wp-sqlite-lexer.php';
|
|
55
|
-
require_once __DIR__ . '/class-wp-sqlite-query-rewriter.php';
|
|
56
|
-
require_once __DIR__ . '/class-wp-sqlite-translator.php';
|
|
57
|
-
require_once __DIR__ . '/class-wp-sqlite-token.php';
|
|
58
|
-
require_once __DIR__ . '/class-wp-sqlite-pdo-user-defined-functions.php';
|
|
59
|
-
}
|
|
50
|
+
require_once __DIR__ . '/../database/load.php';
|
|
60
51
|
require_once __DIR__ . '/class-wp-sqlite-db.php';
|
|
61
52
|
require_once __DIR__ . '/install-functions.php';
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
* The DB_NAME constant is required by the new SQLite driver.
|
|
65
|
-
*
|
|
66
|
-
* There are some existing projects in which the DB_NAME constant is missing in
|
|
67
|
-
* wp-config.php. To enable easier early adoption and testing of the new SQLite
|
|
68
|
-
* driver, let's allow using a default database name when DB_NAME is not set.
|
|
69
|
-
*
|
|
70
|
-
* TODO: For version 3.0, enforce the DB_NAME constant and remove the fallback.
|
|
71
|
-
*/
|
|
72
|
-
if ( defined( 'DB_NAME' ) && '' !== DB_NAME ) {
|
|
73
|
-
$db_name = DB_NAME;
|
|
74
|
-
} else {
|
|
75
|
-
$db_name = apply_filters( 'wp_sqlite_default_db_name', 'database_name_here' );
|
|
76
|
-
}
|
|
54
|
+
$db_name = defined( 'DB_NAME' ) ? DB_NAME : '';
|
|
77
55
|
|
|
78
56
|
/*
|
|
79
57
|
* Debug: Cross-check with MySQL.
|
package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/install-functions.php
CHANGED
|
@@ -34,15 +34,11 @@ function sqlite_make_db_sqlite() {
|
|
|
34
34
|
wp_die( $message, 'Database Error!' );
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
$
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} else {
|
|
43
|
-
$translator = new WP_SQLite_Translator( $pdo );
|
|
44
|
-
}
|
|
45
|
-
$query = null;
|
|
37
|
+
$translator = new WP_SQLite_Driver(
|
|
38
|
+
new WP_SQLite_Connection( array( 'pdo' => $pdo ) ),
|
|
39
|
+
$wpdb->dbname
|
|
40
|
+
);
|
|
41
|
+
$query = null;
|
|
46
42
|
|
|
47
43
|
try {
|
|
48
44
|
$translator->begin_transaction();
|
|
@@ -52,21 +48,16 @@ function sqlite_make_db_sqlite() {
|
|
|
52
48
|
continue;
|
|
53
49
|
}
|
|
54
50
|
|
|
55
|
-
$
|
|
56
|
-
if ( false === $result ) {
|
|
57
|
-
throw new PDOException( $translator->get_error_message() );
|
|
58
|
-
}
|
|
51
|
+
$translator->query( $query );
|
|
59
52
|
}
|
|
60
53
|
$translator->commit();
|
|
61
54
|
} catch ( PDOException $err ) {
|
|
62
|
-
$err_data = $err->errorInfo; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
|
63
|
-
$err_code = $err_data[1];
|
|
64
55
|
$translator->rollback();
|
|
65
56
|
$message = sprintf(
|
|
66
57
|
'Error occurred while creating tables or indexes...<br />Query was: %s<br />',
|
|
67
58
|
var_export( $query, true )
|
|
68
59
|
);
|
|
69
|
-
$message .= sprintf( 'Error message is: %s', $
|
|
60
|
+
$message .= sprintf( 'Error message is: %s', $err->getMessage() );
|
|
70
61
|
wp_die( $message, 'Database Error!' );
|
|
71
62
|
}
|
|
72
63
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wp-studio",
|
|
3
3
|
"author": "Automattic Inc.",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.11",
|
|
5
5
|
"productName": "Studio CLI",
|
|
6
6
|
"description": "WordPress Studio CLI",
|
|
7
7
|
"license": "GPL-2.0-or-later",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"cli-table3": "^0.6.5",
|
|
44
44
|
"fs-extra": "^11.3.4",
|
|
45
45
|
"http-proxy": "^1.18.1",
|
|
46
|
+
"ignore": "^7.0.5",
|
|
46
47
|
"node-forge": "^1.3.3",
|
|
47
48
|
"patch-package": "^8.0.1",
|
|
48
49
|
"picospinner": "^3.0.0",
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { Spinner } from "picospinner";
|
|
2
|
-
import os from "os";
|
|
3
|
-
import path__default from "path";
|
|
4
|
-
const SupportedPHPVersions = ["8.5", "8.4", "8.3", "8.2", "8.1", "8.0", "7.4"];
|
|
5
|
-
const LatestSupportedPHPVersion = "8.5";
|
|
6
|
-
const SupportedPHPVersionsList = [...SupportedPHPVersions];
|
|
7
|
-
const RecommendedPHPVersion = "8.4";
|
|
8
|
-
const HOUR_MS = 1e3 * 60 * 60;
|
|
9
|
-
const DAY_MS = HOUR_MS * 24;
|
|
10
|
-
const DEMO_SITE_SIZE_LIMIT_GB = 2;
|
|
11
|
-
const DEMO_SITE_SIZE_LIMIT_BYTES = DEMO_SITE_SIZE_LIMIT_GB * 1024 * 1024 * 1024;
|
|
12
|
-
const DEMO_SITE_EXPIRATION_DAYS = 7;
|
|
13
|
-
const CLIENT_ID = "95109";
|
|
14
|
-
const PROTOCOL_PREFIX = "wp-studio";
|
|
15
|
-
const DEFAULT_TOKEN_LIFETIME_MS = DAY_MS * 14;
|
|
16
|
-
const CLI_CONFIG_LOCKFILE_NAME = "cli.json.lock";
|
|
17
|
-
const SHARED_CONFIG_LOCKFILE_NAME = "shared.json.lock";
|
|
18
|
-
const LOCKFILE_STALE_TIME = 5e3;
|
|
19
|
-
const LOCKFILE_WAIT_TIME = 5e3;
|
|
20
|
-
const PLAYGROUND_CLI_INACTIVITY_TIMEOUT = 2 * 60 * 1e3;
|
|
21
|
-
const PLAYGROUND_CLI_MAX_TIMEOUT = 10 * 60 * 1e3;
|
|
22
|
-
const PLAYGROUND_CLI_ACTIVITY_CHECK_INTERVAL = 5 * 1e3;
|
|
23
|
-
const SERVER_AUTH_OID = "1.3.6.1.5.5.7.3.1";
|
|
24
|
-
const CERT_UNTRUSTED_ROOT = "CERT_TRUST_IS_UNTRUSTED_ROOT";
|
|
25
|
-
const MINIMUM_WORDPRESS_VERSION = "6.2.1";
|
|
26
|
-
const DEFAULT_WORDPRESS_VERSION = "latest";
|
|
27
|
-
const DEFAULT_PHP_VERSION = RecommendedPHPVersion;
|
|
28
|
-
const ARCHIVER_OPTIONS = {
|
|
29
|
-
zip: {
|
|
30
|
-
zlib: { level: 9 },
|
|
31
|
-
followSymlinks: true
|
|
32
|
-
},
|
|
33
|
-
tar: {
|
|
34
|
-
gzip: true,
|
|
35
|
-
gzipOptions: { level: 9 },
|
|
36
|
-
followSymlinks: true
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
40
|
-
function getDefaultExportFromCjs(x) {
|
|
41
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
42
|
-
}
|
|
43
|
-
const isIpcMode = Boolean(process.send);
|
|
44
|
-
let progressCallback = null;
|
|
45
|
-
function setProgressCallback(callback) {
|
|
46
|
-
progressCallback = callback;
|
|
47
|
-
}
|
|
48
|
-
function getProgressCallback() {
|
|
49
|
-
return progressCallback;
|
|
50
|
-
}
|
|
51
|
-
function emitProgress(message) {
|
|
52
|
-
progressCallback?.(message);
|
|
53
|
-
}
|
|
54
|
-
function canSend() {
|
|
55
|
-
return isIpcMode && !!process.send && process.connected;
|
|
56
|
-
}
|
|
57
|
-
class LoggerError extends Error {
|
|
58
|
-
constructor(message, previousError) {
|
|
59
|
-
super();
|
|
60
|
-
this.name = "LoggerError";
|
|
61
|
-
this.errorMessage = message;
|
|
62
|
-
if (previousError instanceof Error) {
|
|
63
|
-
this.previousError = previousError;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
get message() {
|
|
67
|
-
if (this.previousError) {
|
|
68
|
-
return `${this.errorMessage}: ${this.previousError.message}`;
|
|
69
|
-
}
|
|
70
|
-
return this.errorMessage;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
class Logger {
|
|
74
|
-
constructor() {
|
|
75
|
-
this.currentAction = null;
|
|
76
|
-
this.spinner = new Spinner();
|
|
77
|
-
}
|
|
78
|
-
reportStart(action, message) {
|
|
79
|
-
this.currentAction = action;
|
|
80
|
-
if (canSend()) {
|
|
81
|
-
process.send({ action, status: "inprogress", message });
|
|
82
|
-
} else if (progressCallback) {
|
|
83
|
-
progressCallback(message);
|
|
84
|
-
} else {
|
|
85
|
-
this.spinner.setText(message);
|
|
86
|
-
if (!this.spinner.running) {
|
|
87
|
-
this.spinner.start();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
reportProgress(message) {
|
|
92
|
-
if (canSend()) {
|
|
93
|
-
process.send({ action: this.currentAction, status: "inprogress", message });
|
|
94
|
-
} else if (progressCallback) {
|
|
95
|
-
progressCallback(message, true);
|
|
96
|
-
} else {
|
|
97
|
-
if (!this.spinner.running) {
|
|
98
|
-
this.spinner.start();
|
|
99
|
-
}
|
|
100
|
-
this.spinner.setText(message);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
reportSuccess(message) {
|
|
104
|
-
if (canSend()) {
|
|
105
|
-
process.send({ action: this.currentAction, status: "success", message });
|
|
106
|
-
} else if (progressCallback) {
|
|
107
|
-
progressCallback(message);
|
|
108
|
-
} else {
|
|
109
|
-
if (!this.spinner.running) {
|
|
110
|
-
this.spinner.start();
|
|
111
|
-
}
|
|
112
|
-
this.spinner.succeed(message);
|
|
113
|
-
}
|
|
114
|
-
this.currentAction = null;
|
|
115
|
-
}
|
|
116
|
-
reportWarning(message) {
|
|
117
|
-
if (canSend()) {
|
|
118
|
-
process.send({ action: this.currentAction, status: "warning", message });
|
|
119
|
-
} else if (progressCallback) {
|
|
120
|
-
progressCallback(message);
|
|
121
|
-
} else {
|
|
122
|
-
if (!this.spinner.running) {
|
|
123
|
-
this.spinner.start();
|
|
124
|
-
}
|
|
125
|
-
this.spinner.warn(message);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
reportError(error, isFatal = true) {
|
|
129
|
-
if (isFatal) {
|
|
130
|
-
process.exitCode = 1;
|
|
131
|
-
}
|
|
132
|
-
if (canSend()) {
|
|
133
|
-
process.send({ action: this.currentAction, status: "fail", message: error.message });
|
|
134
|
-
} else if (progressCallback) {
|
|
135
|
-
progressCallback(error.message);
|
|
136
|
-
} else {
|
|
137
|
-
if (!this.spinner.running) {
|
|
138
|
-
this.spinner.start();
|
|
139
|
-
}
|
|
140
|
-
this.spinner.fail(error.message);
|
|
141
|
-
}
|
|
142
|
-
this.currentAction = null;
|
|
143
|
-
}
|
|
144
|
-
reportKeyValuePair(key, value) {
|
|
145
|
-
if (canSend()) {
|
|
146
|
-
process.send({ action: "keyValuePair", key, value });
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function getConfigDirectory() {
|
|
151
|
-
if (process.env.DEV_CONFIG_DIR) {
|
|
152
|
-
return process.env.DEV_CONFIG_DIR;
|
|
153
|
-
}
|
|
154
|
-
if (process.env.E2E && process.env.E2E_SHARED_CONFIG_PATH) {
|
|
155
|
-
return process.env.E2E_SHARED_CONFIG_PATH;
|
|
156
|
-
}
|
|
157
|
-
return path__default.join(os.homedir(), ".studio");
|
|
158
|
-
}
|
|
159
|
-
function getSharedConfigPath() {
|
|
160
|
-
return path__default.join(getConfigDirectory(), "shared.json");
|
|
161
|
-
}
|
|
162
|
-
function getAppConfigPath() {
|
|
163
|
-
return path__default.join(getConfigDirectory(), "app.json");
|
|
164
|
-
}
|
|
165
|
-
function getCliConfigPath() {
|
|
166
|
-
if (process.env.E2E && process.env.E2E_CLI_CONFIG_PATH) {
|
|
167
|
-
return path__default.join(process.env.E2E_CLI_CONFIG_PATH, "cli.json");
|
|
168
|
-
}
|
|
169
|
-
return path__default.join(getConfigDirectory(), "cli.json");
|
|
170
|
-
}
|
|
171
|
-
function getCertificatesPath() {
|
|
172
|
-
return path__default.join(getConfigDirectory(), "certificates");
|
|
173
|
-
}
|
|
174
|
-
function getServerFilesPath() {
|
|
175
|
-
return path__default.join(getConfigDirectory(), "server-files");
|
|
176
|
-
}
|
|
177
|
-
export {
|
|
178
|
-
ARCHIVER_OPTIONS as A,
|
|
179
|
-
CLIENT_ID as B,
|
|
180
|
-
CLI_CONFIG_LOCKFILE_NAME as C,
|
|
181
|
-
DEFAULT_PHP_VERSION as D,
|
|
182
|
-
DEFAULT_TOKEN_LIFETIME_MS as E,
|
|
183
|
-
HOUR_MS as H,
|
|
184
|
-
LoggerError as L,
|
|
185
|
-
MINIMUM_WORDPRESS_VERSION as M,
|
|
186
|
-
PLAYGROUND_CLI_MAX_TIMEOUT as P,
|
|
187
|
-
SupportedPHPVersionsList as S,
|
|
188
|
-
LOCKFILE_STALE_TIME as a,
|
|
189
|
-
LOCKFILE_WAIT_TIME as b,
|
|
190
|
-
LatestSupportedPHPVersion as c,
|
|
191
|
-
Logger as d,
|
|
192
|
-
PLAYGROUND_CLI_INACTIVITY_TIMEOUT as e,
|
|
193
|
-
PLAYGROUND_CLI_ACTIVITY_CHECK_INTERVAL as f,
|
|
194
|
-
getDefaultExportFromCjs as g,
|
|
195
|
-
getServerFilesPath as h,
|
|
196
|
-
commonjsGlobal as i,
|
|
197
|
-
getSharedConfigPath as j,
|
|
198
|
-
getConfigDirectory as k,
|
|
199
|
-
SHARED_CONFIG_LOCKFILE_NAME as l,
|
|
200
|
-
DEMO_SITE_EXPIRATION_DAYS as m,
|
|
201
|
-
DAY_MS as n,
|
|
202
|
-
DEMO_SITE_SIZE_LIMIT_BYTES as o,
|
|
203
|
-
DEMO_SITE_SIZE_LIMIT_GB as p,
|
|
204
|
-
DEFAULT_WORDPRESS_VERSION as q,
|
|
205
|
-
emitProgress as r,
|
|
206
|
-
setProgressCallback as s,
|
|
207
|
-
getProgressCallback as t,
|
|
208
|
-
getCliConfigPath as u,
|
|
209
|
-
getCertificatesPath as v,
|
|
210
|
-
CERT_UNTRUSTED_ROOT as w,
|
|
211
|
-
SERVER_AUTH_OID as x,
|
|
212
|
-
getAppConfigPath as y,
|
|
213
|
-
PROTOCOL_PREFIX as z
|
|
214
|
-
};
|