@@ -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