Skip to content

Commit 383a426

Browse files
committed
Release 2.2.2
1 parent 3bd7357 commit 383a426

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mage-db-sync",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"description": "Database synchronizer for Magento, based on Magerun",
55
"license": "MIT",
66
"author": {

src/tasks/DownloadTask.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ class DownloadTask {
3636
if (!projectStripTables) {
3737
return '';
3838
}
39-
39+
4040
if (typeof projectStripTables === 'string') {
4141
return projectStripTables;
4242
}
43-
43+
4444
// Object format: combine default and custom arrays
4545
const defaultTables = projectStripTables.default || [];
4646
const customTables = projectStripTables.custom || [];
@@ -235,15 +235,27 @@ class DownloadTask {
235235
});
236236

237237
if (!magerunExists) {
238-
task.output = 'Uploading Magerun (0%)...';
239-
logger.info('Uploading Magerun', { file: config.serverVariables.magerunFile });
238+
task.output = 'Downloading Magerun from GitHub...';
239+
logger.info('Downloading Magerun from GitHub', { file: config.serverVariables.magerunFile });
240240

241-
await ssh.putFile(
242-
`${__dirname}/../../files/${config.serverVariables.magerunFile}`,
243-
`${config.serverVariables.magentoRoot}/${config.serverVariables.magerunFile}`
241+
const githubUrl = `https://github.com/jellesiderius/mage-db-sync/raw/refs/heads/master/files/${config.serverVariables.magerunFile}`;
242+
const downloadCommand = sshNavigateToMagentoRootCommand(
243+
`curl -fsSL -o ${shellEscape(config.serverVariables.magerunFile)} ${shellEscape(githubUrl)} || wget -q -O ${shellEscape(config.serverVariables.magerunFile)} ${shellEscape(githubUrl)}`,
244+
config
244245
);
245246

246-
task.output = '✓ Magerun uploaded (100%)';
247+
const downloadResult = await ssh.execCommand(downloadCommand);
248+
249+
if (downloadResult.code !== 0) {
250+
throw UI.createError(
251+
`Failed to download Magerun from GitHub\n` +
252+
`URL: ${githubUrl}\n` +
253+
`[TIP] Check internet connectivity on the server and that the file exists on GitHub\n` +
254+
`Error: ${downloadResult.stderr || downloadResult.stdout}`
255+
);
256+
}
257+
258+
task.output = '✓ Magerun downloaded from GitHub (100%)';
247259
} else {
248260
logger.info('Magerun already exists', { file: config.serverVariables.magerunFile });
249261
task.skip('Magerun already exists on server');
@@ -412,7 +424,7 @@ class DownloadTask {
412424
} else if (config.settings.strip === 'keep customer data') {
413425
const staticSettings = this.services.getConfig().getStaticSettings();
414426
const keepCustomerSettings = staticSettings.settings?.databaseStripKeepCustomerData;
415-
427+
416428
// Combine default and custom arrays
417429
const defaultTables = keepCustomerSettings?.default || [];
418430
const customTables = keepCustomerSettings?.custom || [];
@@ -435,7 +447,7 @@ class DownloadTask {
435447
projectTables: projectStripTables
436448
});
437449
}
438-
450+
439451
if (customTables.length > 0) {
440452
logger.info('Using custom strip tables for keep customer data mode', {
441453
customTables: customTables
@@ -454,7 +466,7 @@ class DownloadTask {
454466
// Default: apply development strip options
455467
const staticSettings = this.services.getConfig().getStaticSettings();
456468
const developmentSettings = staticSettings.settings?.databaseStripDevelopment;
457-
469+
458470
// Combine default and custom arrays
459471
const defaultTables = developmentSettings?.default || [];
460472
const customTables = developmentSettings?.custom || [];
@@ -477,7 +489,7 @@ class DownloadTask {
477489
projectTables: projectStripTables
478490
});
479491
}
480-
492+
481493
if (customTables.length > 0) {
482494
logger.info('Using custom strip tables for development mode', {
483495
customTables: customTables

0 commit comments

Comments
 (0)