wp-studio 1.7.9-beta1 → 1.7.10
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-B4SgBSK4.mjs → _events-BcapW3eh.mjs} +5 -5
- package/dist/cli/{certificate-manager-Bp1E0km4.mjs → certificate-manager-SVYcCL_i.mjs} +6 -1
- package/dist/cli/{delete-D1lAYFtg.mjs → delete-D1924O3o.mjs} +8 -4
- package/dist/cli/{helpers-Bh-WikQr.mjs → helpers-oQuItT8n.mjs} +4 -153
- package/dist/cli/{index-CyYXE85k.mjs → index-4lan3TI_.mjs} +24 -4
- package/dist/cli/{index-OxXT9432.mjs → index-BjzOJKPi.mjs} +525 -256
- package/dist/cli/{index-DmTRufJL.mjs → index-DRQnCQvM.mjs} +510 -365
- package/dist/cli/{list-COLca0rr.mjs → list-DOFyyV1f.mjs} +4 -3
- package/dist/cli/{login-Bg8Yr4Vj.mjs → login-BtPZeZ4G.mjs} +3 -3
- package/dist/cli/{logout-Bs_IccB6.mjs → logout-Cr631QzG.mjs} +3 -3
- package/dist/cli/main.mjs +2 -2
- package/dist/cli/paths-CqXGLB7R.mjs +195 -0
- package/dist/cli/plugin/.claude-plugin/plugin.json +5 -0
- package/dist/cli/plugin/skills/need-for-speed/SKILL.md +55 -0
- package/dist/cli/plugin/skills/site-spec/SKILL.md +35 -0
- package/dist/cli/plugin/skills/taxonomist/SKILL.md +270 -0
- package/dist/cli/plugin/skills/taxonomist/scripts/apply-changes.php +223 -0
- package/dist/cli/plugin/skills/taxonomist/scripts/backup.php +112 -0
- package/dist/cli/plugin/skills/taxonomist/scripts/export-posts.php +119 -0
- package/dist/cli/plugin/skills/taxonomist/scripts/restore.php +233 -0
- package/dist/cli/process-manager-daemon.mjs +11 -4
- package/dist/cli/{process-manager-ipc-heiF195f.mjs → process-manager-ipc-BisO0qtU.mjs} +1 -1
- package/dist/cli/proxy-daemon.mjs +1 -1
- package/dist/cli/prune-pm-logs-COryxqeo.mjs +41 -0
- package/dist/cli/resume-BwDwdJtq.mjs +113 -0
- package/dist/cli/{rewrite-wp-cli-post-content-DH3hRTU5.mjs → rewrite-wp-cli-post-content-2zlfFnKT.mjs} +1 -1
- package/dist/cli/{set-DxtbeOvA.mjs → set-D5eeqHbp.mjs} +3 -3
- package/dist/cli/{set-y3OaX4fb.mjs → set-DYnzUz_G.mjs} +4 -4
- package/dist/cli/{status-fRRrs5ay.mjs → status-DNvMZBqD.mjs} +2 -2
- package/dist/cli/{well-known-paths-CG_o9mSO.mjs → well-known-paths-BYA1Bw5o.mjs} +1 -1
- package/dist/cli/wordpress-server-child.mjs +2 -2
- package/dist/cli/{wp-D9GM4SP_.mjs → wp-DD2-QiiP.mjs} +2 -2
- package/dist/cli/wp-files/latest/available-site-translations.json +1 -1
- package/dist/cli/wp-files/skills/STUDIO.md +1 -1
- package/dist/cli/wp-files/skills/studio-cli/SKILL.md +1 -1
- package/package.json +9 -10
- package/patches/@mariozechner+pi-tui+0.54.0.patch +12 -0
- package/scripts/postinstall-npm.mjs +1 -0
- package/dist/cli/paths-BPK_RySX.mjs +0 -31
- package/dist/cli/resume-w_27EU23.mjs +0 -62
|
@@ -49,17 +49,17 @@ import semver from "semver";
|
|
|
49
49
|
import yargs from "yargs";
|
|
50
50
|
import * as path from "path";
|
|
51
51
|
import path__default from "path";
|
|
52
|
-
import { L as LoggerError, a as LOCKFILE_STALE_TIME, b as LOCKFILE_WAIT_TIME, g as getDefaultExportFromCjs, c as LatestSupportedPHPVersion, D as DEFAULT_PHP_VERSION, A as ARCHIVER_OPTIONS, d as Logger, S as SupportedPHPVersionsList, P as PLAYGROUND_CLI_MAX_TIMEOUT, e as PLAYGROUND_CLI_INACTIVITY_TIMEOUT, f as PLAYGROUND_CLI_ACTIVITY_CHECK_INTERVAL, h as getServerFilesPath, i as commonjsGlobal, j as getSharedConfigPath, k as getConfigDirectory, l as SHARED_CONFIG_LOCKFILE_NAME, m as DEMO_SITE_EXPIRATION_DAYS, H as HOUR_MS, n as DAY_MS, o as DEMO_SITE_SIZE_LIMIT_BYTES, p as DEMO_SITE_SIZE_LIMIT_GB, M as MINIMUM_WORDPRESS_VERSION, q as DEFAULT_WORDPRESS_VERSION$1, r as emitProgress, s as setProgressCallback, t as getProgressCallback, u as getCliConfigPath } from "./well-known-paths-
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
52
|
+
import { L as LoggerError, a as LOCKFILE_STALE_TIME, b as LOCKFILE_WAIT_TIME, g as getDefaultExportFromCjs, c as LatestSupportedPHPVersion, D as DEFAULT_PHP_VERSION, A as ARCHIVER_OPTIONS, d as Logger, S as SupportedPHPVersionsList, P as PLAYGROUND_CLI_MAX_TIMEOUT, e as PLAYGROUND_CLI_INACTIVITY_TIMEOUT, f as PLAYGROUND_CLI_ACTIVITY_CHECK_INTERVAL, h as getServerFilesPath, i as commonjsGlobal, j as getSharedConfigPath, k as getConfigDirectory, l as SHARED_CONFIG_LOCKFILE_NAME, m as DEMO_SITE_EXPIRATION_DAYS, H as HOUR_MS, n as DAY_MS, o as DEMO_SITE_SIZE_LIMIT_BYTES, p as DEMO_SITE_SIZE_LIMIT_GB, M as MINIMUM_WORDPRESS_VERSION, q as DEFAULT_WORDPRESS_VERSION$1, r as emitProgress, s as setProgressCallback, t as getProgressCallback, u as getCliConfigPath } from "./well-known-paths-BYA1Bw5o.mjs";
|
|
53
|
+
import { z } from "zod";
|
|
54
|
+
import { a as arePathsEqual, i as isWordPressDirectory, g as getWordPressVersionPath, r as recursiveCopyDirectory, b as getWordPressVersionUrl, I as IS_JSPI_AVAILABLE, c as cleanupLegacyMuPlugins, d as getMuPlugins, e as getWpCliPharPath, f as getSqliteCommandPath, k as keepSqliteIntegrationUpdated, h as createDeployIgnoreFilter, j as calculateDirectorySizeForArchive, p as pathExists, l as isWordPressBetaVersion, m as isWordPressDevVersion, n as getWpFilesPath, o as getSqlitePluginPath, q as getLanguagePacksPath, s as getAiInstructionsPath, t as getPhpMyAdminPath, u as getSqliteVersionFromInstallation, v as isEmptyDir, w as decodePassword, x as validateAdminUsername, y as validateAdminEmail, z as encodePassword, A as createPassword, B as isValidWordPressVersion, C as isWordPressVersionAtLeast, D as getUnsupportedWpCliPostContentMessage } from "./rewrite-wp-cli-post-content-2zlfFnKT.mjs";
|
|
55
|
+
import { l as lockCliConfig, r as readCliConfig, s as saveCliConfig, u as unlockCliConfig, a as lockFileAsync, b as unlockFileAsync, c as authTokenSchema, h as hideDirectoryOnWindows, S as SNAPSHOT_EVENTS, d as requireSignalExit, e as StatsMetric, f as StatsGroup, g as updateCliConfigWithPartial, i as generateSiteCertificate, j as SITE_EVENTS, k as deleteSiteCertificate, m as updateCheckSchema } from "./certificate-manager-SVYcCL_i.mjs";
|
|
55
56
|
import require$$0$7, { spawn } from "child_process";
|
|
56
57
|
import crypto$1 from "crypto";
|
|
57
58
|
import { EventEmitter } from "events";
|
|
58
59
|
import * as fs from "fs";
|
|
59
60
|
import fs__default, { constants } from "fs";
|
|
60
61
|
import { i as isErrnoException } from "./wordpress-server-ipc-D-8mLjOF.mjs";
|
|
61
|
-
import {
|
|
62
|
-
import { P as PROCESS_MANAGER_HOME, p as processDescriptionSchema, S as SocketRequestClient, a as PROCESS_MANAGER_EVENTS_SOCKET_PATH, b as PROCESS_MANAGER_CONTROL_SOCKET_PATH, d as daemonResponseSchema, c as SocketMessageDecoder, e as SocketStreamClient, f as daemonEventSchema } from "./process-manager-ipc-heiF195f.mjs";
|
|
62
|
+
import { P as PROCESS_MANAGER_HOME, p as processDescriptionSchema, S as SocketRequestClient, a as PROCESS_MANAGER_EVENTS_SOCKET_PATH, b as PROCESS_MANAGER_CONTROL_SOCKET_PATH, d as daemonResponseSchema, c as SocketMessageDecoder, e as SocketStreamClient, f as daemonEventSchema } from "./process-manager-ipc-BisO0qtU.mjs";
|
|
63
63
|
import fs$1, { readFile as readFile$2, cp } from "fs/promises";
|
|
64
64
|
import os, { tmpdir, platform } from "os";
|
|
65
65
|
import archiver from "archiver";
|
|
@@ -102,10 +102,9 @@ import { readFile as readFile$1, writeFile as writeFile$1 } from "atomically";
|
|
|
102
102
|
import CliTable3 from "cli-table3";
|
|
103
103
|
import { search, confirm, input, select, password } from "@inquirer/prompts";
|
|
104
104
|
import process$2 from "node:process";
|
|
105
|
-
import
|
|
105
|
+
import { styleText, stripVTControlCharacters } from "node:util";
|
|
106
106
|
import * as readline$1 from "node:readline";
|
|
107
107
|
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
108
|
-
import { styleText, stripVTControlCharacters } from "node:util";
|
|
109
108
|
import dns from "dns/promises";
|
|
110
109
|
import { isStepDefinition } from "@wp-playground/blueprints";
|
|
111
110
|
import { domainToASCII } from "node:url";
|
|
@@ -123,6 +122,149 @@ function suppressPunycodeWarning() {
|
|
|
123
122
|
}
|
|
124
123
|
});
|
|
125
124
|
}
|
|
125
|
+
const BackupExtractEvents = {
|
|
126
|
+
BACKUP_EXTRACT_START: "backup_extract_start",
|
|
127
|
+
BACKUP_EXTRACT_PROGRESS: "backup_extract_progress",
|
|
128
|
+
BACKUP_EXTRACT_FILE_START: "backup_extract_file_start",
|
|
129
|
+
BACKUP_EXTRACT_COMPLETE: "backup_extract_complete",
|
|
130
|
+
BACKUP_EXTRACT_WARNING: "backup_extract_warning",
|
|
131
|
+
BACKUP_EXTRACT_ERROR: "backup_extract_error"
|
|
132
|
+
};
|
|
133
|
+
const ValidatorEvents = {
|
|
134
|
+
IMPORT_VALIDATION_START: "import_validation_start",
|
|
135
|
+
IMPORT_VALIDATION_COMPLETE: "import_validation_complete",
|
|
136
|
+
IMPORT_VALIDATION_ERROR: "import_validation_error"
|
|
137
|
+
};
|
|
138
|
+
const ImporterEvents = {
|
|
139
|
+
IMPORT_START: "import_start",
|
|
140
|
+
IMPORT_DATABASE_START: "import_database_start",
|
|
141
|
+
IMPORT_DATABASE_PROGRESS: "import_database_progress",
|
|
142
|
+
IMPORT_DATABASE_COMPLETE: "import_database_complete",
|
|
143
|
+
IMPORT_WP_CONTENT_START: "import_wp_content_start",
|
|
144
|
+
IMPORT_WP_CONTENT_PROGRESS: "import_wp_content_progress",
|
|
145
|
+
IMPORT_WP_CONTENT_COMPLETE: "import_wp_content_complete",
|
|
146
|
+
IMPORT_META_START: "import_meta",
|
|
147
|
+
IMPORT_META_COMPLETE: "import_meta_complete",
|
|
148
|
+
IMPORT_COMPLETE: "import_complete",
|
|
149
|
+
IMPORT_ERROR: "import_error"
|
|
150
|
+
};
|
|
151
|
+
const ImportEvents = {
|
|
152
|
+
...BackupExtractEvents,
|
|
153
|
+
...ValidatorEvents,
|
|
154
|
+
...ImporterEvents
|
|
155
|
+
};
|
|
156
|
+
const backupExtractProgressEventDataSchema = z.object({
|
|
157
|
+
progress: z.number().optional(),
|
|
158
|
+
processedFiles: z.number().optional(),
|
|
159
|
+
totalFiles: z.number().optional(),
|
|
160
|
+
currentFile: z.string().optional(),
|
|
161
|
+
extractedBytes: z.number().optional(),
|
|
162
|
+
totalBytes: z.number().optional()
|
|
163
|
+
});
|
|
164
|
+
const importDatabaseProgressEventDataSchema = z.object({
|
|
165
|
+
currentTable: z.string().optional(),
|
|
166
|
+
processedTables: z.number().optional(),
|
|
167
|
+
totalTables: z.number().optional(),
|
|
168
|
+
currentFile: z.string().optional(),
|
|
169
|
+
processedFiles: z.number().optional(),
|
|
170
|
+
totalFiles: z.number().optional()
|
|
171
|
+
});
|
|
172
|
+
const importWpContentProgressEventDataSchema = z.object({
|
|
173
|
+
type: z.enum(["plugins", "themes", "uploads", "other"]).optional(),
|
|
174
|
+
currentItem: z.string().optional(),
|
|
175
|
+
processedItems: z.number().optional(),
|
|
176
|
+
totalItems: z.number().optional(),
|
|
177
|
+
processedBytes: z.number().optional(),
|
|
178
|
+
totalBytes: z.number().optional()
|
|
179
|
+
});
|
|
180
|
+
z.union([
|
|
181
|
+
z.tuple([
|
|
182
|
+
z.literal(BackupExtractEvents.BACKUP_EXTRACT_START),
|
|
183
|
+
backupExtractProgressEventDataSchema.or(z.undefined())
|
|
184
|
+
]),
|
|
185
|
+
z.tuple([
|
|
186
|
+
z.literal(BackupExtractEvents.BACKUP_EXTRACT_PROGRESS),
|
|
187
|
+
backupExtractProgressEventDataSchema
|
|
188
|
+
]),
|
|
189
|
+
z.tuple([
|
|
190
|
+
z.literal(BackupExtractEvents.BACKUP_EXTRACT_FILE_START),
|
|
191
|
+
backupExtractProgressEventDataSchema
|
|
192
|
+
]),
|
|
193
|
+
z.tuple([
|
|
194
|
+
z.literal(BackupExtractEvents.BACKUP_EXTRACT_COMPLETE),
|
|
195
|
+
backupExtractProgressEventDataSchema.or(z.undefined())
|
|
196
|
+
]),
|
|
197
|
+
z.tuple([z.literal(BackupExtractEvents.BACKUP_EXTRACT_WARNING), z.string()]),
|
|
198
|
+
z.tuple([z.literal(BackupExtractEvents.BACKUP_EXTRACT_ERROR), z.unknown()]),
|
|
199
|
+
z.tuple([z.literal(ValidatorEvents.IMPORT_VALIDATION_START), z.undefined()]),
|
|
200
|
+
z.tuple([z.literal(ValidatorEvents.IMPORT_VALIDATION_COMPLETE), z.undefined()]),
|
|
201
|
+
z.tuple([z.literal(ValidatorEvents.IMPORT_VALIDATION_ERROR), z.unknown()]),
|
|
202
|
+
z.tuple([z.literal(ImporterEvents.IMPORT_START), z.undefined()]),
|
|
203
|
+
z.tuple([z.literal(ImporterEvents.IMPORT_DATABASE_START), z.undefined()]),
|
|
204
|
+
z.tuple([
|
|
205
|
+
z.literal(ImporterEvents.IMPORT_DATABASE_PROGRESS),
|
|
206
|
+
importDatabaseProgressEventDataSchema
|
|
207
|
+
]),
|
|
208
|
+
z.tuple([z.literal(ImporterEvents.IMPORT_DATABASE_COMPLETE), z.undefined()]),
|
|
209
|
+
z.tuple([z.literal(ImporterEvents.IMPORT_WP_CONTENT_START), z.undefined()]),
|
|
210
|
+
z.tuple([
|
|
211
|
+
z.literal(ImporterEvents.IMPORT_WP_CONTENT_PROGRESS),
|
|
212
|
+
importWpContentProgressEventDataSchema
|
|
213
|
+
]),
|
|
214
|
+
z.tuple([z.literal(ImporterEvents.IMPORT_WP_CONTENT_COMPLETE), z.undefined()]),
|
|
215
|
+
z.tuple([z.literal(ImporterEvents.IMPORT_META_START), z.undefined()]),
|
|
216
|
+
z.tuple([z.literal(ImporterEvents.IMPORT_META_COMPLETE), z.undefined()]),
|
|
217
|
+
z.tuple([z.literal(ImporterEvents.IMPORT_COMPLETE), z.undefined()]),
|
|
218
|
+
z.tuple([z.literal(ImporterEvents.IMPORT_ERROR), z.unknown()])
|
|
219
|
+
]);
|
|
220
|
+
const ExportEvents = {
|
|
221
|
+
EXPORT_START: "export_start",
|
|
222
|
+
EXPORT_COMPLETE: "export_complete",
|
|
223
|
+
EXPORT_ERROR: "export_error",
|
|
224
|
+
BACKUP_CREATE_START: "backup_create_start",
|
|
225
|
+
BACKUP_CREATE_PROGRESS: "backup_create_progress",
|
|
226
|
+
BACKUP_CREATE_COMPLETE: "backup_create_complete",
|
|
227
|
+
WP_CONTENT_EXPORT_START: "wp_content_export_start",
|
|
228
|
+
WP_CONTENT_EXPORT_PROGRESS: "wp_content_export_progress",
|
|
229
|
+
WP_CONTENT_EXPORT_COMPLETE: "wp_content_export_complete",
|
|
230
|
+
DATABASE_EXPORT_START: "database_export_start",
|
|
231
|
+
DATABASE_EXPORT_PROGRESS: "database_export_progress",
|
|
232
|
+
DATABASE_EXPORT_COMPLETE: "database_export_complete",
|
|
233
|
+
CONFIG_EXPORT_START: "config_export_start",
|
|
234
|
+
CONFIG_EXPORT_COMPLETE: "config_export_complete"
|
|
235
|
+
};
|
|
236
|
+
const backupCreateProgressEventDataSchema = z.object({
|
|
237
|
+
// This schema is derived from the `archiver.ProgressData` type
|
|
238
|
+
progress: z.object({
|
|
239
|
+
entries: z.object({
|
|
240
|
+
total: z.number(),
|
|
241
|
+
processed: z.number()
|
|
242
|
+
}),
|
|
243
|
+
fs: z.object({
|
|
244
|
+
totalBytes: z.number(),
|
|
245
|
+
processedBytes: z.number()
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
});
|
|
249
|
+
z.union([
|
|
250
|
+
z.tuple([z.literal(ExportEvents.EXPORT_START), z.undefined()]),
|
|
251
|
+
z.tuple([z.literal(ExportEvents.EXPORT_COMPLETE), z.undefined()]),
|
|
252
|
+
z.tuple([z.literal(ExportEvents.EXPORT_ERROR), z.unknown().nullable()]),
|
|
253
|
+
z.tuple([z.literal(ExportEvents.BACKUP_CREATE_START), z.undefined()]),
|
|
254
|
+
z.tuple([
|
|
255
|
+
z.literal(ExportEvents.BACKUP_CREATE_PROGRESS),
|
|
256
|
+
backupCreateProgressEventDataSchema
|
|
257
|
+
]),
|
|
258
|
+
z.tuple([z.literal(ExportEvents.BACKUP_CREATE_COMPLETE), z.undefined()]),
|
|
259
|
+
z.tuple([z.literal(ExportEvents.WP_CONTENT_EXPORT_START), z.undefined()]),
|
|
260
|
+
z.tuple([z.literal(ExportEvents.WP_CONTENT_EXPORT_PROGRESS), z.undefined()]),
|
|
261
|
+
z.tuple([z.literal(ExportEvents.WP_CONTENT_EXPORT_COMPLETE), z.undefined()]),
|
|
262
|
+
z.tuple([z.literal(ExportEvents.DATABASE_EXPORT_START), z.undefined()]),
|
|
263
|
+
z.tuple([z.literal(ExportEvents.DATABASE_EXPORT_PROGRESS), z.undefined()]),
|
|
264
|
+
z.tuple([z.literal(ExportEvents.DATABASE_EXPORT_COMPLETE), z.undefined()]),
|
|
265
|
+
z.tuple([z.literal(ExportEvents.CONFIG_EXPORT_START), z.undefined()]),
|
|
266
|
+
z.tuple([z.literal(ExportEvents.CONFIG_EXPORT_COMPLETE), z.undefined()])
|
|
267
|
+
]);
|
|
126
268
|
var AuthCommandLoggerAction = /* @__PURE__ */ ((AuthCommandLoggerAction2) => {
|
|
127
269
|
AuthCommandLoggerAction2["LOGIN"] = "login";
|
|
128
270
|
AuthCommandLoggerAction2["LOGOUT"] = "logout";
|
|
@@ -272,8 +414,10 @@ const PROXY_PROCESS_NAME = "studio-proxy";
|
|
|
272
414
|
const CONNECTION_TIMEOUT_MS = 1e4;
|
|
273
415
|
const PROCESS_MANAGER_LOCKFILE_PATH = path__default.join(PROCESS_MANAGER_HOME, "pm-connection.lock");
|
|
274
416
|
const SITE_EVENTS_SOCKET_PATH = process.platform === "win32" ? "\\\\.\\pipe\\studio-events.sock" : path__default.join(PROCESS_MANAGER_HOME, "events.sock");
|
|
275
|
-
|
|
276
|
-
fs__default.
|
|
417
|
+
function ensureProcessManagerHome() {
|
|
418
|
+
if (!fs__default.existsSync(PROCESS_MANAGER_HOME)) {
|
|
419
|
+
fs__default.mkdirSync(PROCESS_MANAGER_HOME, { recursive: true });
|
|
420
|
+
}
|
|
277
421
|
}
|
|
278
422
|
class DaemonBusEventEmitter extends EventEmitter {
|
|
279
423
|
on(event, listener) {
|
|
@@ -409,6 +553,7 @@ async function connectToDaemon() {
|
|
|
409
553
|
if (isConnected) {
|
|
410
554
|
return;
|
|
411
555
|
}
|
|
556
|
+
ensureProcessManagerHome();
|
|
412
557
|
await lockFileAsync(PROCESS_MANAGER_LOCKFILE_PATH, {
|
|
413
558
|
wait: LOCKFILE_WAIT_TIME,
|
|
414
559
|
stale: LOCKFILE_STALE_TIME
|
|
@@ -504,38 +649,6 @@ async function emitCliEvent(payload) {
|
|
|
504
649
|
} catch {
|
|
505
650
|
}
|
|
506
651
|
}
|
|
507
|
-
const ExportEvents = {
|
|
508
|
-
EXPORT_START: "export_start",
|
|
509
|
-
EXPORT_COMPLETE: "export_complete",
|
|
510
|
-
EXPORT_ERROR: "export_error",
|
|
511
|
-
BACKUP_CREATE_START: "backup_create_start",
|
|
512
|
-
BACKUP_CREATE_PROGRESS: "backup_create_progress",
|
|
513
|
-
BACKUP_CREATE_COMPLETE: "backup_create_complete",
|
|
514
|
-
WP_CONTENT_EXPORT_START: "wp_content_export_start",
|
|
515
|
-
WP_CONTENT_EXPORT_PROGRESS: "wp_content_export_progress",
|
|
516
|
-
WP_CONTENT_EXPORT_COMPLETE: "wp_content_export_complete",
|
|
517
|
-
DATABASE_EXPORT_START: "database_export_start",
|
|
518
|
-
DATABASE_EXPORT_PROGRESS: "database_export_progress",
|
|
519
|
-
DATABASE_EXPORT_COMPLETE: "database_export_complete",
|
|
520
|
-
CONFIG_EXPORT_START: "config_export_start",
|
|
521
|
-
CONFIG_EXPORT_COMPLETE: "config_export_complete"
|
|
522
|
-
};
|
|
523
|
-
const handleEvents = (emitter2, onEvent, events) => {
|
|
524
|
-
const removeListeners = [];
|
|
525
|
-
Object.values(events).forEach((eventName) => {
|
|
526
|
-
const listener = (data2) => {
|
|
527
|
-
onEvent({
|
|
528
|
-
event: eventName,
|
|
529
|
-
data: data2
|
|
530
|
-
});
|
|
531
|
-
};
|
|
532
|
-
emitter2.on?.(eventName, listener);
|
|
533
|
-
removeListeners.push(() => emitter2.off?.(eventName, listener));
|
|
534
|
-
});
|
|
535
|
-
return () => {
|
|
536
|
-
removeListeners.forEach((remove) => remove());
|
|
537
|
-
};
|
|
538
|
-
};
|
|
539
652
|
function parseJsonFromPhpOutput(output) {
|
|
540
653
|
try {
|
|
541
654
|
return JSON.parse(output);
|
|
@@ -1268,6 +1381,17 @@ async function runGlobalWpCliCommand(args) {
|
|
|
1268
1381
|
throw new Error(__("An error occurred while running the WP-CLI command."));
|
|
1269
1382
|
}
|
|
1270
1383
|
}
|
|
1384
|
+
class ImportExportEventEmitter extends EventEmitter {
|
|
1385
|
+
on(eventName, listener) {
|
|
1386
|
+
return super.on(eventName, listener);
|
|
1387
|
+
}
|
|
1388
|
+
off(eventName, listener) {
|
|
1389
|
+
return super.off(eventName, listener);
|
|
1390
|
+
}
|
|
1391
|
+
emit(eventName, ...args) {
|
|
1392
|
+
return super.emit(eventName, ...args);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1271
1395
|
const LATIN = "a-z";
|
|
1272
1396
|
const CYRILLIC = "а-яё";
|
|
1273
1397
|
const ARABIC = "\\u0600-\\u06FF";
|
|
@@ -3112,7 +3236,7 @@ async function exportDatabaseToMultipleFiles(siteFolder, finalDestinationDir) {
|
|
|
3112
3236
|
_promise2 && await _promise2;
|
|
3113
3237
|
}
|
|
3114
3238
|
}
|
|
3115
|
-
class DefaultExporter extends
|
|
3239
|
+
class DefaultExporter extends ImportExportEventEmitter {
|
|
3116
3240
|
isExactPathExcluded(pathToCheck) {
|
|
3117
3241
|
const PATHS_TO_EXCLUDE = [
|
|
3118
3242
|
"wp-content/mu-plugins/sqlite-database-integration",
|
|
@@ -3420,7 +3544,7 @@ class DefaultExporter extends EventEmitter {
|
|
|
3420
3544
|
}
|
|
3421
3545
|
}
|
|
3422
3546
|
}
|
|
3423
|
-
class SqlExporter extends
|
|
3547
|
+
class SqlExporter extends ImportExportEventEmitter {
|
|
3424
3548
|
constructor(options) {
|
|
3425
3549
|
super();
|
|
3426
3550
|
this.options = options;
|
|
@@ -3442,26 +3566,14 @@ class SqlExporter extends EventEmitter {
|
|
|
3442
3566
|
return this.options.includes.database;
|
|
3443
3567
|
}
|
|
3444
3568
|
}
|
|
3445
|
-
async function
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
foundValidExporter = await exporterInstance.canHandle();
|
|
3451
|
-
if (foundValidExporter) {
|
|
3452
|
-
try {
|
|
3453
|
-
await exporterInstance.export();
|
|
3454
|
-
} finally {
|
|
3455
|
-
removeExportListeners();
|
|
3456
|
-
}
|
|
3457
|
-
break;
|
|
3569
|
+
async function getExporter(exportOptions, exporters = defaultExporterOptions) {
|
|
3570
|
+
for (const Exporter2 of exporters) {
|
|
3571
|
+
const exporterInstance = new Exporter2(exportOptions);
|
|
3572
|
+
if (await exporterInstance.canHandle()) {
|
|
3573
|
+
return exporterInstance;
|
|
3458
3574
|
}
|
|
3459
3575
|
}
|
|
3460
|
-
|
|
3461
|
-
onEvent({ event: ExportEvents.EXPORT_ERROR, data: null });
|
|
3462
|
-
return false;
|
|
3463
|
-
}
|
|
3464
|
-
return true;
|
|
3576
|
+
return null;
|
|
3465
3577
|
}
|
|
3466
3578
|
const defaultExporterOptions = [DefaultExporter, SqlExporter];
|
|
3467
3579
|
function normalizeHostname(hostname) {
|
|
@@ -3495,54 +3607,49 @@ function untildify(path2) {
|
|
|
3495
3607
|
return process.platform === "win32" ? path2 : path2.replace(/^~/, os$1.homedir());
|
|
3496
3608
|
}
|
|
3497
3609
|
const logger$c = new Logger();
|
|
3498
|
-
function
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
logger$c.reportSuccess(__("Site exported successfully"));
|
|
3542
|
-
break;
|
|
3543
|
-
case ExportEvents.EXPORT_ERROR:
|
|
3544
|
-
throw new LoggerError(__("Export failed"), data2 instanceof Error ? data2 : void 0);
|
|
3545
|
-
}
|
|
3610
|
+
function handleExportEvents(emitter2) {
|
|
3611
|
+
emitter2.on(ExportEvents.EXPORT_START, () => {
|
|
3612
|
+
logger$c.reportStart(SiteCommandLoggerAction.EXPORT_SITE, __("Starting export…"));
|
|
3613
|
+
});
|
|
3614
|
+
emitter2.on(ExportEvents.BACKUP_CREATE_START, () => {
|
|
3615
|
+
logger$c.reportStart(SiteCommandLoggerAction.CREATE_BACKUP, __("Creating backup file…"));
|
|
3616
|
+
});
|
|
3617
|
+
emitter2.on(ExportEvents.WP_CONTENT_EXPORT_START, () => {
|
|
3618
|
+
logger$c.reportStart(SiteCommandLoggerAction.EXPORT_WP_CONTENT, __("Traversing WordPress content…"));
|
|
3619
|
+
});
|
|
3620
|
+
emitter2.on(ExportEvents.WP_CONTENT_EXPORT_COMPLETE, () => {
|
|
3621
|
+
logger$c.reportSuccess(__("WordPress content traversed"));
|
|
3622
|
+
});
|
|
3623
|
+
emitter2.on(ExportEvents.DATABASE_EXPORT_START, () => {
|
|
3624
|
+
logger$c.reportStart(SiteCommandLoggerAction.EXPORT_DATABASE, __("Exporting database…"));
|
|
3625
|
+
});
|
|
3626
|
+
emitter2.on(ExportEvents.DATABASE_EXPORT_COMPLETE, () => {
|
|
3627
|
+
logger$c.reportSuccess(__("Database exported"));
|
|
3628
|
+
});
|
|
3629
|
+
emitter2.on(ExportEvents.BACKUP_CREATE_PROGRESS, (progressData) => {
|
|
3630
|
+
const processed = progressData.progress.entries.processed;
|
|
3631
|
+
logger$c.reportProgress(
|
|
3632
|
+
sprintf(
|
|
3633
|
+
_n("Backing up file… (%d processed)", "Backing up files… (%d processed)", processed),
|
|
3634
|
+
processed
|
|
3635
|
+
)
|
|
3636
|
+
);
|
|
3637
|
+
});
|
|
3638
|
+
emitter2.on(ExportEvents.BACKUP_CREATE_COMPLETE, () => {
|
|
3639
|
+
logger$c.reportSuccess(__("Backup file created"));
|
|
3640
|
+
});
|
|
3641
|
+
emitter2.on(ExportEvents.CONFIG_EXPORT_START, () => {
|
|
3642
|
+
logger$c.reportStart(SiteCommandLoggerAction.EXPORT_CONFIG, __("Exporting configuration…"));
|
|
3643
|
+
});
|
|
3644
|
+
emitter2.on(ExportEvents.CONFIG_EXPORT_COMPLETE, () => {
|
|
3645
|
+
logger$c.reportSuccess(__("Configuration exported"));
|
|
3646
|
+
});
|
|
3647
|
+
emitter2.on(ExportEvents.EXPORT_COMPLETE, () => {
|
|
3648
|
+
logger$c.reportSuccess(__("Site exported successfully"));
|
|
3649
|
+
});
|
|
3650
|
+
emitter2.on(ExportEvents.EXPORT_ERROR, (error2) => {
|
|
3651
|
+
throw new LoggerError(__("Export failed"), error2 instanceof Error ? error2 : void 0);
|
|
3652
|
+
});
|
|
3546
3653
|
}
|
|
3547
3654
|
async function runCommand$e(siteFolder, exportPath, mode) {
|
|
3548
3655
|
try {
|
|
@@ -3562,19 +3669,18 @@ async function runCommand$e(siteFolder, exportPath, mode) {
|
|
|
3562
3669
|
if (mode === "db") {
|
|
3563
3670
|
includes.wpContent = false;
|
|
3564
3671
|
}
|
|
3565
|
-
const
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
exportEventHandler
|
|
3573
|
-
);
|
|
3574
|
-
logger$c.reportSuccess(sprintf(__("%s successfully exported"), exportPath));
|
|
3575
|
-
if (!isExported) {
|
|
3672
|
+
const exporter = await getExporter({
|
|
3673
|
+
site,
|
|
3674
|
+
backupFile: exportPath,
|
|
3675
|
+
phpVersion: DEFAULT_PHP_VERSION,
|
|
3676
|
+
includes
|
|
3677
|
+
});
|
|
3678
|
+
if (!exporter) {
|
|
3576
3679
|
throw new LoggerError(__("No suitable exporter found for the provided backup file"));
|
|
3577
3680
|
}
|
|
3681
|
+
handleExportEvents(exporter);
|
|
3682
|
+
await exporter.export();
|
|
3683
|
+
logger$c.reportSuccess(sprintf(__("%s successfully exported"), exportPath));
|
|
3578
3684
|
} finally {
|
|
3579
3685
|
await disconnectFromDaemon();
|
|
3580
3686
|
}
|
|
@@ -3648,41 +3754,7 @@ const registerCommand$e = (yargs2) => {
|
|
|
3648
3754
|
}
|
|
3649
3755
|
});
|
|
3650
3756
|
};
|
|
3651
|
-
|
|
3652
|
-
BACKUP_EXTRACT_START: "backup_extract_start",
|
|
3653
|
-
BACKUP_EXTRACT_PROGRESS: "backup_extract_progress",
|
|
3654
|
-
BACKUP_EXTRACT_FILE_START: "backup_extract_file_start",
|
|
3655
|
-
BACKUP_EXTRACT_COMPLETE: "backup_extract_complete",
|
|
3656
|
-
BACKUP_EXTRACT_WARNING: "backup_extract_warning",
|
|
3657
|
-
BACKUP_EXTRACT_ERROR: "backup_extract_error"
|
|
3658
|
-
};
|
|
3659
|
-
const ValidatorEvents = {
|
|
3660
|
-
IMPORT_VALIDATION_START: "import_validation_start",
|
|
3661
|
-
IMPORT_VALIDATION_COMPLETE: "import_validation_complete",
|
|
3662
|
-
IMPORT_VALIDATION_ERROR: "import_validation_error"
|
|
3663
|
-
};
|
|
3664
|
-
const ImporterEvents = {
|
|
3665
|
-
IMPORT_START: "import_start",
|
|
3666
|
-
IMPORT_DATABASE_START: "import_database_start",
|
|
3667
|
-
IMPORT_DATABASE_PROGRESS: "import_database_progress",
|
|
3668
|
-
IMPORT_DATABASE_COMPLETE: "import_database_complete",
|
|
3669
|
-
IMPORT_WP_CONTENT_START: "import_wp_content_start",
|
|
3670
|
-
IMPORT_WP_CONTENT_PROGRESS: "import_wp_content_progress",
|
|
3671
|
-
IMPORT_WP_CONTENT_COMPLETE: "import_wp_content_complete",
|
|
3672
|
-
IMPORT_META_START: "import_meta",
|
|
3673
|
-
IMPORT_META_COMPLETE: "import_meta_complete",
|
|
3674
|
-
IMPORT_COMPLETE: "import_complete",
|
|
3675
|
-
IMPORT_ERROR: "import_error"
|
|
3676
|
-
};
|
|
3677
|
-
const ImportEvents = {
|
|
3678
|
-
...BackupExtractEvents,
|
|
3679
|
-
...ValidatorEvents,
|
|
3680
|
-
...ImporterEvents
|
|
3681
|
-
};
|
|
3682
|
-
class BackupHandlerSql extends EventEmitter {
|
|
3683
|
-
constructor() {
|
|
3684
|
-
super();
|
|
3685
|
-
}
|
|
3757
|
+
class BackupHandlerSql extends ImportExportEventEmitter {
|
|
3686
3758
|
async listFiles(backup) {
|
|
3687
3759
|
return [path__default.basename(backup.path)];
|
|
3688
3760
|
}
|
|
@@ -3714,7 +3786,7 @@ class BackupHandlerSql extends EventEmitter {
|
|
|
3714
3786
|
});
|
|
3715
3787
|
}
|
|
3716
3788
|
}
|
|
3717
|
-
class BackupHandlerTarGz extends
|
|
3789
|
+
class BackupHandlerTarGz extends ImportExportEventEmitter {
|
|
3718
3790
|
async listFiles(backup) {
|
|
3719
3791
|
const filesSet = /* @__PURE__ */ new Set();
|
|
3720
3792
|
await tar.t({
|
|
@@ -3808,8 +3880,17 @@ async function readHeader(fd) {
|
|
|
3808
3880
|
prefix
|
|
3809
3881
|
};
|
|
3810
3882
|
}
|
|
3883
|
+
function isPathWithinDirectory(filePath, directory) {
|
|
3884
|
+
const resolvedFile = path.resolve(filePath);
|
|
3885
|
+
const resolvedDir = path.resolve(directory);
|
|
3886
|
+
return resolvedFile.startsWith(resolvedDir + path.sep) || resolvedFile === resolvedDir;
|
|
3887
|
+
}
|
|
3811
3888
|
async function readBlockToFile(fd, header, outputPath) {
|
|
3812
3889
|
const outputFilePath = path.join(outputPath, header.prefix, header.name);
|
|
3890
|
+
if (!isPathWithinDirectory(outputFilePath, outputPath)) {
|
|
3891
|
+
await fd.read(Buffer.alloc(header.size), 0, header.size, null);
|
|
3892
|
+
return;
|
|
3893
|
+
}
|
|
3813
3894
|
await fse.ensureDir(path.dirname(outputFilePath));
|
|
3814
3895
|
const outputStream = fs.createWriteStream(outputFilePath);
|
|
3815
3896
|
let totalBytesToRead = header.size;
|
|
@@ -3848,7 +3929,7 @@ async function readBlockToFile(fd, header, outputPath) {
|
|
|
3848
3929
|
endStream();
|
|
3849
3930
|
}
|
|
3850
3931
|
}
|
|
3851
|
-
class BackupHandlerWpress extends
|
|
3932
|
+
class BackupHandlerWpress extends ImportExportEventEmitter {
|
|
3852
3933
|
constructor() {
|
|
3853
3934
|
super();
|
|
3854
3935
|
this.totalFiles = 0;
|
|
@@ -3883,7 +3964,10 @@ class BackupHandlerWpress extends EventEmitter {
|
|
|
3883
3964
|
do {
|
|
3884
3965
|
header = await readHeader(inputFile);
|
|
3885
3966
|
if (header) {
|
|
3886
|
-
|
|
3967
|
+
const filePath = path.join(header.prefix, header.name);
|
|
3968
|
+
if (!filePath.split(path.sep).includes("..")) {
|
|
3969
|
+
fileNames.push(filePath);
|
|
3970
|
+
}
|
|
3887
3971
|
await inputFile.read(Buffer.alloc(header.size), 0, header.size, null);
|
|
3888
3972
|
}
|
|
3889
3973
|
} while (header);
|
|
@@ -3950,7 +4034,7 @@ class BackupHandlerWpress extends EventEmitter {
|
|
|
3950
4034
|
}
|
|
3951
4035
|
}
|
|
3952
4036
|
const openZip = promisify(yauzl.open);
|
|
3953
|
-
class BackupHandlerZip extends
|
|
4037
|
+
class BackupHandlerZip extends ImportExportEventEmitter {
|
|
3954
4038
|
async listFiles(backup) {
|
|
3955
4039
|
const zipFile = await openZip(backup.path, { lazyEntries: true });
|
|
3956
4040
|
const fileNames = [];
|
|
@@ -4189,7 +4273,7 @@ const updateSiteUrl = async (site) => {
|
|
|
4189
4273
|
_promise2 && await _promise2;
|
|
4190
4274
|
}
|
|
4191
4275
|
};
|
|
4192
|
-
class BaseImporter extends
|
|
4276
|
+
class BaseImporter extends ImportExportEventEmitter {
|
|
4193
4277
|
constructor(backup) {
|
|
4194
4278
|
super();
|
|
4195
4279
|
this.backup = backup;
|
|
@@ -4572,7 +4656,7 @@ class WpressImporter extends BaseBackupImporter {
|
|
|
4572
4656
|
await super.importDatabase(site, sqlFiles);
|
|
4573
4657
|
}
|
|
4574
4658
|
}
|
|
4575
|
-
class JetpackValidator extends
|
|
4659
|
+
class JetpackValidator extends ImportExportEventEmitter {
|
|
4576
4660
|
canHandle(fileList) {
|
|
4577
4661
|
const optionalDirs = [
|
|
4578
4662
|
"sql",
|
|
@@ -4589,7 +4673,6 @@ class JetpackValidator extends EventEmitter {
|
|
|
4589
4673
|
return hasOptionalDir || hasOptionalFile;
|
|
4590
4674
|
}
|
|
4591
4675
|
parseBackupContents(fileList, extractionDirectory) {
|
|
4592
|
-
this.emit(ImportEvents.IMPORT_VALIDATION_START);
|
|
4593
4676
|
const extractedBackup = {
|
|
4594
4677
|
extractionDirectory,
|
|
4595
4678
|
sqlFiles: [],
|
|
@@ -4605,7 +4688,7 @@ class JetpackValidator extends EventEmitter {
|
|
|
4605
4688
|
}
|
|
4606
4689
|
if (file.startsWith("sql/") && file.endsWith(".sql")) {
|
|
4607
4690
|
extractedBackup.sqlFiles.push(fullPath);
|
|
4608
|
-
} else if (file.startsWith("wp-content/")) {
|
|
4691
|
+
} else if (file.startsWith("wp-content/") && !file.startsWith("wp-content/database/")) {
|
|
4609
4692
|
extractedBackup.wpContentFiles.push(fullPath);
|
|
4610
4693
|
} else if (file === "studio.json" || file === "meta.json") {
|
|
4611
4694
|
extractedBackup.metaFile = fullPath;
|
|
@@ -4614,11 +4697,10 @@ class JetpackValidator extends EventEmitter {
|
|
|
4614
4697
|
extractedBackup.sqlFiles.sort(
|
|
4615
4698
|
(a, b) => path__default.basename(a).localeCompare(path__default.basename(b))
|
|
4616
4699
|
);
|
|
4617
|
-
this.emit(ImportEvents.IMPORT_VALIDATION_COMPLETE);
|
|
4618
4700
|
return extractedBackup;
|
|
4619
4701
|
}
|
|
4620
4702
|
}
|
|
4621
|
-
class LocalValidator extends
|
|
4703
|
+
class LocalValidator extends ImportExportEventEmitter {
|
|
4622
4704
|
canHandle(fileList) {
|
|
4623
4705
|
const requiredDirs = [
|
|
4624
4706
|
"app/sql",
|
|
@@ -4629,7 +4711,6 @@ class LocalValidator extends EventEmitter {
|
|
|
4629
4711
|
return requiredDirs.some((dir) => fileList.some((file) => file.startsWith(dir + "/"))) && fileList.some((file) => file.startsWith("app/sql/") && file.endsWith(".sql"));
|
|
4630
4712
|
}
|
|
4631
4713
|
parseBackupContents(fileList, extractionDirectory) {
|
|
4632
|
-
this.emit(ImportEvents.IMPORT_VALIDATION_START);
|
|
4633
4714
|
const extractedBackup = {
|
|
4634
4715
|
extractionDirectory,
|
|
4635
4716
|
sqlFiles: [],
|
|
@@ -4654,11 +4735,10 @@ class LocalValidator extends EventEmitter {
|
|
|
4654
4735
|
extractedBackup.sqlFiles.sort(
|
|
4655
4736
|
(a, b) => path__default.basename(a).localeCompare(path__default.basename(b))
|
|
4656
4737
|
);
|
|
4657
|
-
this.emit(ImportEvents.IMPORT_VALIDATION_COMPLETE);
|
|
4658
4738
|
return extractedBackup;
|
|
4659
4739
|
}
|
|
4660
4740
|
}
|
|
4661
|
-
class PlaygroundValidator extends
|
|
4741
|
+
class PlaygroundValidator extends ImportExportEventEmitter {
|
|
4662
4742
|
canHandle(fileList) {
|
|
4663
4743
|
const requiredDirs = [
|
|
4664
4744
|
"wp-content/database",
|
|
@@ -4666,12 +4746,13 @@ class PlaygroundValidator extends EventEmitter {
|
|
|
4666
4746
|
"wp-content/plugins",
|
|
4667
4747
|
"wp-content/themes"
|
|
4668
4748
|
];
|
|
4669
|
-
|
|
4749
|
+
const hasSqliteDatabase = requiredDirs.some((dir) => fileList.some((file) => file.startsWith(dir + "/"))) && fileList.some(
|
|
4670
4750
|
(file) => file.startsWith("wp-content/database") && file.endsWith(".ht.sqlite")
|
|
4671
4751
|
);
|
|
4752
|
+
const hasSqlDumps = fileList.some((file) => file.startsWith("sql/"));
|
|
4753
|
+
return hasSqliteDatabase && !hasSqlDumps;
|
|
4672
4754
|
}
|
|
4673
4755
|
parseBackupContents(fileList, extractionDirectory) {
|
|
4674
|
-
this.emit(ImportEvents.IMPORT_VALIDATION_START);
|
|
4675
4756
|
const extractedBackup = {
|
|
4676
4757
|
extractionDirectory,
|
|
4677
4758
|
sqlFiles: [],
|
|
@@ -4691,16 +4772,14 @@ class PlaygroundValidator extends EventEmitter {
|
|
|
4691
4772
|
extractedBackup.wpContentFiles.push(fullPath);
|
|
4692
4773
|
}
|
|
4693
4774
|
}
|
|
4694
|
-
this.emit(ImportEvents.IMPORT_VALIDATION_COMPLETE);
|
|
4695
4775
|
return extractedBackup;
|
|
4696
4776
|
}
|
|
4697
4777
|
}
|
|
4698
|
-
class SqlValidator extends
|
|
4778
|
+
class SqlValidator extends ImportExportEventEmitter {
|
|
4699
4779
|
canHandle(fileList) {
|
|
4700
4780
|
return fileList.length === 1 && fileList[0].endsWith(".sql");
|
|
4701
4781
|
}
|
|
4702
4782
|
parseBackupContents(fileList, extractionDirectory) {
|
|
4703
|
-
this.emit(ImportEvents.IMPORT_VALIDATION_START);
|
|
4704
4783
|
const extractedBackup = {
|
|
4705
4784
|
extractionDirectory,
|
|
4706
4785
|
sqlFiles: [],
|
|
@@ -4714,18 +4793,16 @@ class SqlValidator extends EventEmitter {
|
|
|
4714
4793
|
extractedBackup.sqlFiles.push(fullPath);
|
|
4715
4794
|
}
|
|
4716
4795
|
}
|
|
4717
|
-
this.emit(ImportEvents.IMPORT_VALIDATION_COMPLETE);
|
|
4718
4796
|
return extractedBackup;
|
|
4719
4797
|
}
|
|
4720
4798
|
}
|
|
4721
|
-
class WpressValidator extends
|
|
4799
|
+
class WpressValidator extends ImportExportEventEmitter {
|
|
4722
4800
|
canHandle(fileList) {
|
|
4723
4801
|
const requiredFiles = ["database.sql", "package.json"];
|
|
4724
4802
|
const optionalDirs = ["uploads", "plugins", "themes", "fonts"];
|
|
4725
4803
|
return requiredFiles.every((file) => fileList.includes(file)) && optionalDirs.some((dir) => fileList.some((file) => file.startsWith(dir + path__default.sep)));
|
|
4726
4804
|
}
|
|
4727
4805
|
parseBackupContents(fileList, extractionDirectory) {
|
|
4728
|
-
this.emit(ImportEvents.IMPORT_VALIDATION_START);
|
|
4729
4806
|
const extractedBackup = {
|
|
4730
4807
|
extractionDirectory,
|
|
4731
4808
|
sqlFiles: [],
|
|
@@ -4746,47 +4823,56 @@ class WpressValidator extends EventEmitter {
|
|
|
4746
4823
|
extractedBackup.sqlFiles.sort(
|
|
4747
4824
|
(a, b) => path__default.basename(a).localeCompare(path__default.basename(b))
|
|
4748
4825
|
);
|
|
4749
|
-
this.emit(ImportEvents.IMPORT_VALIDATION_COMPLETE);
|
|
4750
4826
|
return extractedBackup;
|
|
4751
4827
|
}
|
|
4752
4828
|
}
|
|
4753
|
-
function selectImporter(allFiles, extractionDirectory,
|
|
4829
|
+
function selectImporter(allFiles, extractionDirectory, options) {
|
|
4754
4830
|
for (const { validator, importer } of options) {
|
|
4755
4831
|
if (validator.canHandle(allFiles)) {
|
|
4756
|
-
const removeValidatorListeners = handleEvents(validator, onEvent, ValidatorEvents);
|
|
4757
4832
|
const files = validator.parseBackupContents(allFiles, extractionDirectory);
|
|
4758
|
-
removeValidatorListeners();
|
|
4759
4833
|
return new importer(files);
|
|
4760
4834
|
}
|
|
4761
4835
|
}
|
|
4762
4836
|
return null;
|
|
4763
4837
|
}
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
const extractionDirectory = await fs__default.promises.mkdtemp(
|
|
4770
|
-
path__default.join(os.tmpdir(), "studio_backup")
|
|
4771
|
-
);
|
|
4772
|
-
const fileList = await backupHandler.listFiles(backupFile);
|
|
4773
|
-
const importer = selectImporter(fileList, extractionDirectory, onEvent, options);
|
|
4774
|
-
if (!importer) {
|
|
4775
|
-
throw new Error(__("No suitable importer found for the provided backup contents"));
|
|
4838
|
+
class BackupImporter extends ImportExportEventEmitter {
|
|
4839
|
+
constructor(backupFile, importerOptions) {
|
|
4840
|
+
super();
|
|
4841
|
+
this.backupFile = backupFile;
|
|
4842
|
+
this.importerOptions = importerOptions;
|
|
4776
4843
|
}
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
await
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4844
|
+
async import(site) {
|
|
4845
|
+
const backupHandler = BackupHandlerFactory.create(this.backupFile);
|
|
4846
|
+
if (!backupHandler) {
|
|
4847
|
+
throw new Error(__("No suitable backup handler found for the provided backup file"));
|
|
4848
|
+
}
|
|
4849
|
+
const extractionDirectory = await fs__default.promises.mkdtemp(
|
|
4850
|
+
path__default.join(os.tmpdir(), "studio_backup")
|
|
4851
|
+
);
|
|
4852
|
+
try {
|
|
4853
|
+
const fileList = await backupHandler.listFiles(this.backupFile);
|
|
4854
|
+
this.emit(ValidatorEvents.IMPORT_VALIDATION_START);
|
|
4855
|
+
const importer = selectImporter(fileList, extractionDirectory, this.importerOptions);
|
|
4856
|
+
if (!importer) {
|
|
4857
|
+
throw new Error(__("No suitable importer found for the provided backup contents"));
|
|
4858
|
+
}
|
|
4859
|
+
this.emit(ValidatorEvents.IMPORT_VALIDATION_COMPLETE);
|
|
4860
|
+
for (const eventName of Object.values(BackupExtractEvents)) {
|
|
4861
|
+
backupHandler.on(eventName, (data2) => this.emit(eventName, data2));
|
|
4862
|
+
}
|
|
4863
|
+
for (const eventName of Object.values(ImporterEvents)) {
|
|
4864
|
+
importer.on(eventName, (data2) => this.emit(eventName, data2));
|
|
4865
|
+
}
|
|
4866
|
+
await backupHandler.extractFiles(this.backupFile, extractionDirectory);
|
|
4867
|
+
return await importer.import(site);
|
|
4868
|
+
} finally {
|
|
4869
|
+
await fs__default.promises.rm(extractionDirectory, { recursive: true });
|
|
4870
|
+
}
|
|
4788
4871
|
}
|
|
4789
4872
|
}
|
|
4873
|
+
function getImporter(backupFile, options) {
|
|
4874
|
+
return new BackupImporter(backupFile, options);
|
|
4875
|
+
}
|
|
4790
4876
|
const DEFAULT_IMPORTER_OPTIONS = [
|
|
4791
4877
|
{ validator: new PlaygroundValidator(), importer: PlaygroundImporter },
|
|
4792
4878
|
{ validator: new JetpackValidator(), importer: JetpackImporter },
|
|
@@ -5106,113 +5192,106 @@ async function setupWordPressFilesOnly(sitePath) {
|
|
|
5106
5192
|
}
|
|
5107
5193
|
await recursiveCopyDirectory(bundledWpPath, sitePath);
|
|
5108
5194
|
}
|
|
5109
|
-
function
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
"Extracting backup files… (%1$d/%2$d)",
|
|
5134
|
-
progressData.totalFiles
|
|
5135
|
-
),
|
|
5136
|
-
progressData.processedFiles,
|
|
5195
|
+
function handleImportEvents(emitter2) {
|
|
5196
|
+
emitter2.on(ValidatorEvents.IMPORT_VALIDATION_START, () => {
|
|
5197
|
+
logger$b.reportSuccess(sprintf(__("Started import…")));
|
|
5198
|
+
logger$b.reportStart(SiteCommandLoggerAction.VALIDATE, __("Validating backup…"));
|
|
5199
|
+
});
|
|
5200
|
+
emitter2.on(ValidatorEvents.IMPORT_VALIDATION_COMPLETE, () => {
|
|
5201
|
+
logger$b.reportSuccess(__("Backup validated"));
|
|
5202
|
+
});
|
|
5203
|
+
emitter2.on(ValidatorEvents.IMPORT_VALIDATION_ERROR, (error2) => {
|
|
5204
|
+
throw new LoggerError(
|
|
5205
|
+
__("Backup validation failed"),
|
|
5206
|
+
error2 instanceof Error ? error2 : void 0
|
|
5207
|
+
);
|
|
5208
|
+
});
|
|
5209
|
+
emitter2.on(BackupExtractEvents.BACKUP_EXTRACT_START, () => {
|
|
5210
|
+
logger$b.reportStart(SiteCommandLoggerAction.EXTRACT_BACKUP, __("Extracting backup files…"));
|
|
5211
|
+
});
|
|
5212
|
+
emitter2.on(BackupExtractEvents.BACKUP_EXTRACT_PROGRESS, (progressData) => {
|
|
5213
|
+
if (progressData.processedFiles !== void 0 && progressData.totalFiles !== void 0 && progressData.totalFiles > 0) {
|
|
5214
|
+
logger$b.reportProgress(
|
|
5215
|
+
sprintf(
|
|
5216
|
+
_n(
|
|
5217
|
+
"Extracting backup file… (%1$d/%2$d)",
|
|
5218
|
+
"Extracting backup files… (%1$d/%2$d)",
|
|
5137
5219
|
progressData.totalFiles
|
|
5138
|
-
)
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
}
|
|
5143
|
-
case BackupExtractEvents.BACKUP_EXTRACT_COMPLETE:
|
|
5144
|
-
logger$b.reportSuccess(__("Backup extraction completed"));
|
|
5145
|
-
break;
|
|
5146
|
-
case BackupExtractEvents.BACKUP_EXTRACT_WARNING:
|
|
5147
|
-
logger$b.reportWarning(
|
|
5148
|
-
typeof data2 === "string" ? data2 : __("A warning occurred while extracting backup")
|
|
5149
|
-
);
|
|
5150
|
-
break;
|
|
5151
|
-
case BackupExtractEvents.BACKUP_EXTRACT_ERROR:
|
|
5152
|
-
throw new LoggerError(
|
|
5153
|
-
__("Failed to extract backup"),
|
|
5154
|
-
data2 instanceof Error ? data2 : void 0
|
|
5220
|
+
),
|
|
5221
|
+
progressData.processedFiles,
|
|
5222
|
+
progressData.totalFiles
|
|
5223
|
+
)
|
|
5155
5224
|
);
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5225
|
+
}
|
|
5226
|
+
});
|
|
5227
|
+
emitter2.on(BackupExtractEvents.BACKUP_EXTRACT_COMPLETE, () => {
|
|
5228
|
+
logger$b.reportSuccess(__("Backup extraction completed"));
|
|
5229
|
+
});
|
|
5230
|
+
emitter2.on(BackupExtractEvents.BACKUP_EXTRACT_WARNING, (warningMessage) => {
|
|
5231
|
+
logger$b.reportWarning(warningMessage || __("A warning occurred while extracting backup"));
|
|
5232
|
+
});
|
|
5233
|
+
emitter2.on(BackupExtractEvents.BACKUP_EXTRACT_ERROR, (error2) => {
|
|
5234
|
+
throw new LoggerError(
|
|
5235
|
+
__("Failed to extract backup"),
|
|
5236
|
+
error2 instanceof Error ? error2 : void 0
|
|
5237
|
+
);
|
|
5238
|
+
});
|
|
5239
|
+
emitter2.on(ImporterEvents.IMPORT_START, () => {
|
|
5240
|
+
logger$b.reportStart(SiteCommandLoggerAction.IMPORT_SITE, __("Importing backup…"));
|
|
5241
|
+
});
|
|
5242
|
+
emitter2.on(ImporterEvents.IMPORT_DATABASE_START, () => {
|
|
5243
|
+
logger$b.reportStart(SiteCommandLoggerAction.IMPORT_DATABASE, __("Importing database…"));
|
|
5244
|
+
});
|
|
5245
|
+
emitter2.on(ImporterEvents.IMPORT_DATABASE_PROGRESS, (progressData) => {
|
|
5246
|
+
if (progressData.processedFiles !== void 0 && progressData.totalFiles !== void 0 && progressData.totalFiles > 0) {
|
|
5247
|
+
logger$b.reportProgress(
|
|
5248
|
+
sprintf(
|
|
5249
|
+
_n(
|
|
5250
|
+
"Importing database file… (%1$d/%2$d)",
|
|
5251
|
+
"Importing database files… (%1$d/%2$d)",
|
|
5173
5252
|
progressData.totalFiles
|
|
5174
|
-
)
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5253
|
+
),
|
|
5254
|
+
progressData.processedFiles,
|
|
5255
|
+
progressData.totalFiles
|
|
5256
|
+
)
|
|
5257
|
+
);
|
|
5178
5258
|
}
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
}
|
|
5199
|
-
break;
|
|
5259
|
+
});
|
|
5260
|
+
emitter2.on(ImporterEvents.IMPORT_DATABASE_COMPLETE, () => {
|
|
5261
|
+
logger$b.reportSuccess(__("Database import completed"));
|
|
5262
|
+
});
|
|
5263
|
+
emitter2.on(ImporterEvents.IMPORT_WP_CONTENT_START, () => {
|
|
5264
|
+
logger$b.reportStart(SiteCommandLoggerAction.IMPORT_WP_CONTENT, __("Importing WordPress content…"));
|
|
5265
|
+
});
|
|
5266
|
+
emitter2.on(ImporterEvents.IMPORT_WP_CONTENT_PROGRESS, (progressData) => {
|
|
5267
|
+
if (progressData.processedItems !== void 0 && progressData.totalItems !== void 0 && progressData.totalItems > 0) {
|
|
5268
|
+
const baseMessage = WP_CONTENT_TYPE_LABELS[progressData.type || "other"] || __("Importing WordPress content…");
|
|
5269
|
+
logger$b.reportProgress(
|
|
5270
|
+
sprintf(
|
|
5271
|
+
/* translators: %1$s is a content type label, %2$d is processed items, %3$d is total items */
|
|
5272
|
+
__("%1$s (%2$d/%3$d)"),
|
|
5273
|
+
baseMessage,
|
|
5274
|
+
progressData.processedItems,
|
|
5275
|
+
progressData.totalItems
|
|
5276
|
+
)
|
|
5277
|
+
);
|
|
5200
5278
|
}
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5279
|
+
});
|
|
5280
|
+
emitter2.on(ImporterEvents.IMPORT_WP_CONTENT_COMPLETE, () => {
|
|
5281
|
+
logger$b.reportSuccess(__("WordPress content import completed"));
|
|
5282
|
+
});
|
|
5283
|
+
emitter2.on(ImporterEvents.IMPORT_META_START, () => {
|
|
5284
|
+
logger$b.reportStart(SiteCommandLoggerAction.IMPORT_META, __("Importing metadata…"));
|
|
5285
|
+
});
|
|
5286
|
+
emitter2.on(ImporterEvents.IMPORT_META_COMPLETE, () => {
|
|
5287
|
+
logger$b.reportSuccess(__("Metadata import completed"));
|
|
5288
|
+
});
|
|
5289
|
+
emitter2.on(ImporterEvents.IMPORT_COMPLETE, () => {
|
|
5290
|
+
logger$b.reportSuccess(__("Site imported successfully"));
|
|
5291
|
+
});
|
|
5292
|
+
emitter2.on(ImporterEvents.IMPORT_ERROR, (error2) => {
|
|
5293
|
+
throw new LoggerError(__("Import failed"), error2 instanceof Error ? error2 : void 0);
|
|
5294
|
+
});
|
|
5216
5295
|
}
|
|
5217
5296
|
async function runCommand$d(siteFolder, importFile) {
|
|
5218
5297
|
let site;
|
|
@@ -5242,12 +5321,12 @@ async function runCommand$d(siteFolder, importFile) {
|
|
|
5242
5321
|
logger$b.reportSuccess(__("WordPress files copied"));
|
|
5243
5322
|
}
|
|
5244
5323
|
logger$b.reportStart(SiteCommandLoggerAction.IMPORT_SITE, __("Starting import…"));
|
|
5245
|
-
|
|
5324
|
+
const importer = getImporter(
|
|
5246
5325
|
{ path: importFile, type: getBackupFileType(importFile) },
|
|
5247
|
-
site,
|
|
5248
|
-
importEventHandler,
|
|
5249
5326
|
DEFAULT_IMPORTER_OPTIONS
|
|
5250
5327
|
);
|
|
5328
|
+
handleImportEvents(importer);
|
|
5329
|
+
await importer.import(site);
|
|
5251
5330
|
const siteUrl = getSiteUrl(site);
|
|
5252
5331
|
await fetch(siteUrl).catch(() => {
|
|
5253
5332
|
});
|
|
@@ -28634,6 +28713,63 @@ function createPrompt(view) {
|
|
|
28634
28713
|
};
|
|
28635
28714
|
return prompt;
|
|
28636
28715
|
}
|
|
28716
|
+
function supportsTrueColor() {
|
|
28717
|
+
if (process.env.NO_COLOR) {
|
|
28718
|
+
return false;
|
|
28719
|
+
}
|
|
28720
|
+
const force = process.env.FORCE_COLOR;
|
|
28721
|
+
if (force === "3" || force === "true") {
|
|
28722
|
+
return true;
|
|
28723
|
+
}
|
|
28724
|
+
if (force !== void 0) {
|
|
28725
|
+
return false;
|
|
28726
|
+
}
|
|
28727
|
+
return (process.stdout.getColorDepth?.() ?? 1) >= 24;
|
|
28728
|
+
}
|
|
28729
|
+
function hexToRgb(hex) {
|
|
28730
|
+
const h = hex.replace(/^#/, "");
|
|
28731
|
+
return [
|
|
28732
|
+
parseInt(h.slice(0, 2), 16),
|
|
28733
|
+
parseInt(h.slice(2, 4), 16),
|
|
28734
|
+
parseInt(h.slice(4, 6), 16)
|
|
28735
|
+
];
|
|
28736
|
+
}
|
|
28737
|
+
function wrapHex(hex, bg, text2) {
|
|
28738
|
+
if (!supportsTrueColor()) {
|
|
28739
|
+
return text2;
|
|
28740
|
+
}
|
|
28741
|
+
const [r, g, b] = hexToRgb(hex);
|
|
28742
|
+
const open = bg ? 48 : 38;
|
|
28743
|
+
const close = bg ? 49 : 39;
|
|
28744
|
+
return `\x1B[${open};2;${r};${g};${b}m${text2}\x1B[${close}m`;
|
|
28745
|
+
}
|
|
28746
|
+
function createChalk(formats2, hexFg, hexBg) {
|
|
28747
|
+
const fn = ((text2) => {
|
|
28748
|
+
let out = formats2.length > 0 ? styleText(formats2, text2) : text2;
|
|
28749
|
+
if (hexFg) {
|
|
28750
|
+
out = wrapHex(hexFg, false, out);
|
|
28751
|
+
}
|
|
28752
|
+
if (hexBg) {
|
|
28753
|
+
out = wrapHex(hexBg, true, out);
|
|
28754
|
+
}
|
|
28755
|
+
return out;
|
|
28756
|
+
});
|
|
28757
|
+
return new Proxy(fn, {
|
|
28758
|
+
get(target, prop) {
|
|
28759
|
+
if (typeof prop !== "string") {
|
|
28760
|
+
return Reflect.get(target, prop);
|
|
28761
|
+
}
|
|
28762
|
+
if (prop === "hex") {
|
|
28763
|
+
return (color) => createChalk(formats2, color, hexBg);
|
|
28764
|
+
}
|
|
28765
|
+
if (prop === "bgHex") {
|
|
28766
|
+
return (color) => createChalk(formats2, hexFg, color);
|
|
28767
|
+
}
|
|
28768
|
+
return createChalk([...formats2, prop], hexFg, hexBg);
|
|
28769
|
+
}
|
|
28770
|
+
});
|
|
28771
|
+
}
|
|
28772
|
+
const chalk = createChalk([]);
|
|
28637
28773
|
function flattenTree(nodes, path2 = []) {
|
|
28638
28774
|
const result = [];
|
|
28639
28775
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -29287,12 +29423,12 @@ async function runCommand$8(siteFolder, syncOptions, siteIdentifier) {
|
|
|
29287
29423
|
await clearSiteLatestCliPid(site.id);
|
|
29288
29424
|
logger$9.reportSuccess(__("WordPress server stopped"));
|
|
29289
29425
|
}
|
|
29290
|
-
|
|
29426
|
+
const importer = getImporter(
|
|
29291
29427
|
{ path: destPath, type: "application/gzip" },
|
|
29292
|
-
site,
|
|
29293
|
-
importEventHandler,
|
|
29294
29428
|
DEFAULT_IMPORTER_OPTIONS
|
|
29295
29429
|
);
|
|
29430
|
+
handleImportEvents(importer);
|
|
29431
|
+
await importer.import(site);
|
|
29296
29432
|
const siteUrl = getSiteUrl(site);
|
|
29297
29433
|
await fetch(siteUrl).catch(() => {
|
|
29298
29434
|
});
|
|
@@ -33933,20 +34069,19 @@ async function runCommand$7(siteFolder, syncOptions, remoteSiteIdentifier) {
|
|
|
33933
34069
|
wpContent: optionsToSync.includes("uploads") || optionsToSync.includes("plugins") || optionsToSync.includes("themes") || optionsToSync.includes("contents")
|
|
33934
34070
|
};
|
|
33935
34071
|
}
|
|
33936
|
-
const
|
|
33937
|
-
|
|
33938
|
-
|
|
33939
|
-
|
|
33940
|
-
|
|
33941
|
-
|
|
33942
|
-
|
|
33943
|
-
|
|
33944
|
-
|
|
33945
|
-
exportEventHandler
|
|
33946
|
-
);
|
|
33947
|
-
if (!isExported) {
|
|
34072
|
+
const exporter = await getExporter({
|
|
34073
|
+
site,
|
|
34074
|
+
backupFile: archivePath,
|
|
34075
|
+
includes,
|
|
34076
|
+
phpVersion: DEFAULT_PHP_VERSION,
|
|
34077
|
+
splitDatabaseDumpByTable: true,
|
|
34078
|
+
specificSelectionPaths
|
|
34079
|
+
});
|
|
34080
|
+
if (!exporter) {
|
|
33948
34081
|
throw new LoggerError(__("No suitable exporter found for the provided backup file"));
|
|
33949
34082
|
}
|
|
34083
|
+
handleExportEvents(exporter);
|
|
34084
|
+
await exporter.export();
|
|
33950
34085
|
const archiveSize = fs__default.statSync(archivePath).size;
|
|
33951
34086
|
if (archiveSize > SYNC_PUSH_SIZE_LIMIT_BYTES) {
|
|
33952
34087
|
throw new LoggerError(
|
|
@@ -76031,6 +76166,13 @@ async function resolveSite(nameOrPath) {
|
|
|
76031
76166
|
if (siteByName) {
|
|
76032
76167
|
return siteByName;
|
|
76033
76168
|
}
|
|
76169
|
+
if (!path__default.isAbsolute(nameOrPath)) {
|
|
76170
|
+
const config = await readCliConfig();
|
|
76171
|
+
const siteByFolder = config.sites.find((site) => path__default.basename(site.path) === nameOrPath);
|
|
76172
|
+
if (siteByFolder) {
|
|
76173
|
+
return siteByFolder;
|
|
76174
|
+
}
|
|
76175
|
+
}
|
|
76034
76176
|
return getSiteByFolder(nameOrPath);
|
|
76035
76177
|
}
|
|
76036
76178
|
function errorResult(message2) {
|
|
@@ -76903,7 +77045,7 @@ function formatUpdateBanner(currentVersion, latestVersion) {
|
|
|
76903
77045
|
});
|
|
76904
77046
|
return ["", top, ...paddedLines, bottom, ""].join("\n");
|
|
76905
77047
|
}
|
|
76906
|
-
const version = "1.7.
|
|
77048
|
+
const version = "1.7.10";
|
|
76907
77049
|
suppressPunycodeWarning();
|
|
76908
77050
|
async function main() {
|
|
76909
77051
|
await setupUpdateNotifier(version);
|
|
@@ -76934,8 +77076,10 @@ async function main() {
|
|
|
76934
77076
|
}
|
|
76935
77077
|
}).middleware(async () => {
|
|
76936
77078
|
const { runMigrations } = await import("./migration-B2m6ZEJz.mjs");
|
|
76937
|
-
const { migrations } = await import("./index-
|
|
77079
|
+
const { migrations } = await import("./index-4lan3TI_.mjs");
|
|
76938
77080
|
await runMigrations(migrations);
|
|
77081
|
+
const { prunePmLogs } = await import("./prune-pm-logs-COryxqeo.mjs");
|
|
77082
|
+
await prunePmLogs();
|
|
76939
77083
|
}).middleware(async (argv) => {
|
|
76940
77084
|
if (!argv.avoidTelemetry) {
|
|
76941
77085
|
const platformMetric = getPlatformMetric();
|
|
@@ -76966,9 +77110,9 @@ async function main() {
|
|
|
76966
77110
|
{ registerCommand: registerAuthLogoutCommand },
|
|
76967
77111
|
{ registerCommand: registerAuthStatusCommand }
|
|
76968
77112
|
] = await Promise.all([
|
|
76969
|
-
import("./login-
|
|
76970
|
-
import("./logout-
|
|
76971
|
-
import("./status-
|
|
77113
|
+
import("./login-BtPZeZ4G.mjs"),
|
|
77114
|
+
import("./logout-Cr631QzG.mjs"),
|
|
77115
|
+
import("./status-DNvMZBqD.mjs")
|
|
76972
77116
|
]);
|
|
76973
77117
|
registerAuthLoginCommand(authYargs);
|
|
76974
77118
|
registerAuthLogoutCommand(authYargs);
|
|
@@ -76976,7 +77120,7 @@ async function main() {
|
|
|
76976
77120
|
authYargs.version(false).demandCommand(1, __("You must provide a valid auth command"));
|
|
76977
77121
|
});
|
|
76978
77122
|
const studioCodeCommandBuilder = async (aiYargs) => {
|
|
76979
|
-
const { registerCommand: registerAiCommand } = await import("./index-
|
|
77123
|
+
const { registerCommand: registerAiCommand } = await import("./index-BjzOJKPi.mjs").then((n) => n.i);
|
|
76980
77124
|
registerAiCommand(aiYargs);
|
|
76981
77125
|
aiYargs.command("sessions", __("Manage code sessions"), async (sessionsYargs) => {
|
|
76982
77126
|
const [
|
|
@@ -76984,9 +77128,9 @@ async function main() {
|
|
|
76984
77128
|
{ registerCommand: registerAiSessionsListCommand },
|
|
76985
77129
|
{ registerCommand: registerAiSessionsResumeCommand }
|
|
76986
77130
|
] = await Promise.all([
|
|
76987
|
-
import("./delete-
|
|
76988
|
-
import("./list-
|
|
76989
|
-
import("./resume-
|
|
77131
|
+
import("./delete-D1924O3o.mjs"),
|
|
77132
|
+
import("./list-DOFyyV1f.mjs"),
|
|
77133
|
+
import("./resume-BwDwdJtq.mjs")
|
|
76990
77134
|
]);
|
|
76991
77135
|
sessionsYargs.option("path", {
|
|
76992
77136
|
hidden: true
|
|
@@ -77023,7 +77167,7 @@ async function main() {
|
|
|
77023
77167
|
Promise.resolve().then(() => list$2),
|
|
77024
77168
|
Promise.resolve().then(() => _delete$1),
|
|
77025
77169
|
Promise.resolve().then(() => update),
|
|
77026
|
-
import("./set-
|
|
77170
|
+
import("./set-D5eeqHbp.mjs")
|
|
77027
77171
|
]);
|
|
77028
77172
|
registerPreviewCreateCommand(previewYargs);
|
|
77029
77173
|
registerPreviewListCommand(previewYargs);
|
|
@@ -77050,7 +77194,7 @@ async function main() {
|
|
|
77050
77194
|
Promise.resolve().then(() => start),
|
|
77051
77195
|
Promise.resolve().then(() => stop),
|
|
77052
77196
|
Promise.resolve().then(() => _delete),
|
|
77053
|
-
import("./set-
|
|
77197
|
+
import("./set-DYnzUz_G.mjs")
|
|
77054
77198
|
]);
|
|
77055
77199
|
registerSiteStatusCommand(sitesYargs);
|
|
77056
77200
|
registerSiteCreateCommand(sitesYargs);
|
|
@@ -77072,7 +77216,7 @@ async function main() {
|
|
|
77072
77216
|
});
|
|
77073
77217
|
},
|
|
77074
77218
|
handler: async (argv) => {
|
|
77075
|
-
const { commandHandler: wpCliCommandHandler } = await import("./wp-
|
|
77219
|
+
const { commandHandler: wpCliCommandHandler } = await import("./wp-DD2-QiiP.mjs");
|
|
77076
77220
|
return wpCliCommandHandler(argv);
|
|
77077
77221
|
}
|
|
77078
77222
|
}).command({
|
|
@@ -77080,7 +77224,7 @@ async function main() {
|
|
|
77080
77224
|
describe: false,
|
|
77081
77225
|
// Hidden command
|
|
77082
77226
|
handler: async () => {
|
|
77083
|
-
const { commandHandler: eventsCommandHandler } = await import("./_events-
|
|
77227
|
+
const { commandHandler: eventsCommandHandler } = await import("./_events-BcapW3eh.mjs");
|
|
77084
77228
|
return eventsCommandHandler();
|
|
77085
77229
|
}
|
|
77086
77230
|
}).demandCommand(1, __("You must provide a valid command")).strict();
|
|
@@ -77089,21 +77233,22 @@ async function main() {
|
|
|
77089
77233
|
void main();
|
|
77090
77234
|
export {
|
|
77091
77235
|
AuthCommandLoggerAction as A,
|
|
77092
|
-
|
|
77093
|
-
|
|
77094
|
-
|
|
77095
|
-
|
|
77096
|
-
|
|
77097
|
-
|
|
77098
|
-
|
|
77099
|
-
|
|
77100
|
-
|
|
77101
|
-
|
|
77102
|
-
|
|
77103
|
-
|
|
77104
|
-
|
|
77105
|
-
|
|
77236
|
+
connectToDaemon as B,
|
|
77237
|
+
isServerRunning as C,
|
|
77238
|
+
stopWordPressServer as D,
|
|
77239
|
+
validatePhpVersion as E,
|
|
77240
|
+
runWpCliCommand as F,
|
|
77241
|
+
setupCustomDomain as G,
|
|
77242
|
+
startWordPressServer as H,
|
|
77243
|
+
updateSiteLatestCliPid as I,
|
|
77244
|
+
disconnectFromDaemon as J,
|
|
77245
|
+
runGlobalWpCliCommand as K,
|
|
77246
|
+
sendWpCliCommand as L,
|
|
77247
|
+
SITE_EVENTS_SOCKET_PATH as M,
|
|
77248
|
+
getDaemonBus as N,
|
|
77249
|
+
SITE_PROCESS_PREFIX as O,
|
|
77106
77250
|
PreviewCommandLoggerAction as P,
|
|
77251
|
+
removeSiteFromConfig as Q,
|
|
77107
77252
|
STUDIO_SITES_ROOT as S,
|
|
77108
77253
|
ValidationError2 as V,
|
|
77109
77254
|
createStudioTools as a,
|
|
@@ -77113,23 +77258,23 @@ export {
|
|
|
77113
77258
|
runCommand$9 as e,
|
|
77114
77259
|
runCommand$c as f,
|
|
77115
77260
|
getUserInfo as g,
|
|
77116
|
-
|
|
77261
|
+
chalk as h,
|
|
77117
77262
|
isSnapshotExpired as i,
|
|
77118
|
-
|
|
77119
|
-
|
|
77120
|
-
|
|
77121
|
-
|
|
77122
|
-
|
|
77263
|
+
getSitesRunningStatus as j,
|
|
77264
|
+
getWpComSites as k,
|
|
77265
|
+
isSiteRunning as l,
|
|
77266
|
+
getSiteUrl as m,
|
|
77267
|
+
closeSharedBrowser as n,
|
|
77123
77268
|
openBrowser as o,
|
|
77124
|
-
|
|
77125
|
-
|
|
77269
|
+
getAppLocale as p,
|
|
77270
|
+
emitCliEvent as q,
|
|
77126
77271
|
readAuthToken as r,
|
|
77127
|
-
|
|
77128
|
-
|
|
77272
|
+
revokeAuthToken as s,
|
|
77273
|
+
normalizeHostname as t,
|
|
77129
77274
|
updateSharedConfig as u,
|
|
77130
|
-
|
|
77131
|
-
|
|
77132
|
-
|
|
77133
|
-
|
|
77134
|
-
|
|
77275
|
+
setSnapshotInConfig as v,
|
|
77276
|
+
SiteCommandLoggerAction as w,
|
|
77277
|
+
getSiteByFolder as x,
|
|
77278
|
+
getDomainNameValidationError as y,
|
|
77279
|
+
updateDomainInHosts as z
|
|
77135
77280
|
};
|