Development

Changeset 33405

You must first sign up to be able to contribute.

Changeset 33405

Show
Ignore:
Timestamp:
04/13/12 19:35:54 (1 year ago)
Author:
boutell
Message:

New --gzip option speeds up sync-content task in some cases, thanks to Benjamin Padgett

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfSyncContentPlugin/trunk/lib/task/synccontentTask.class.php

    r33312 r33405  
    4343      new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'frontend'), 
    4444      new sfCommandOption('file', null, sfCommandOption::PARAMETER_REQUIRED, 'Your XML file of page data', null), 
    45       new sfCommandOption('pages', null, sfCommandOption::PARAMETER_REQUIRED, 'Directory of page xml files', null) 
     45      new sfCommandOption('pages', null, sfCommandOption::PARAMETER_REQUIRED, 'Directory of page xml files', null), 
     46      new sfCommandOption('gzip', null, sfCommandOption::PARAMETER_NONE, 'Use gzip', null) 
    4647      // add your own options here 
    4748    )); 
     
    9293    $envRemote = $matches[1]; 
    9394    $site = $matches[2]; 
    94      
     95  
     96    $gzip = ""; 
     97    $gunzip = ""; 
     98    if ($this->setOptions['gzip']) 
     99    { 
     100      $gzip = " | gzip "; 
     101      $gunzip = " | gunzip "; 
     102    } 
     103 
    95104    $found = false; 
    96105    foreach ($settings as $section => $data) 
     
    126135    if ($direction == 'to') 
    127136    { 
    128       $cmd = "$binary project:mysql-dump --application=$application --env=$env | " . $this->_content_sync_build_remote_cmd($pathRemote, "./symfony project:mysql-load --application=$application --env=$envRemote"); 
     137      $cmd = "$binary project:mysql-dump --application=$application --env=$env " . $gzip . " | " . $this->_content_sync_build_remote_cmd($pathRemote, " " . $gunzip . "| ./symfony project:mysql-load --application=$application --env=$envRemote"); 
    129138      $this->_content_sync_system($cmd); 
    130139    } 
    131140    else 
    132141    { 
    133       $cmd = $this->_content_sync_build_remote_cmd($pathRemote, "./symfony project:mysql-dump --application=$application --env=$envRemote") . " | $binary project:mysql-load --application=$application --env=$env"; 
     142      $cmd = $this->_content_sync_build_remote_cmd($pathRemote, "./symfony project:mysql-dump --application=$application --env=$envRemote " . $gzip) . " " . $gunzip . " | $binary project:mysql-load --application=$application --env=$env"; 
    134143      $this->_content_sync_system($cmd); 
    135144    }