Changeset 22882
- Timestamp:
- 10/08/09 19:44:39 (4 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfSyncContentPlugin/trunk/README
r22583 r22882 83 83 == Changelog == 84 84 85 * Version 0.9 (still not yet packaged) has been rewritten to use 85 * Version 0.9.1 corrects a bug in version 0.9 which caused the default environment to be used 86 rather than the specified environment on the local end of the connection. The correct environment 87 was used on the remote end. This is a significant bug fix and you should upgrade immediately if you 88 are using version 0.9. 89 90 Also, the code has been refactored to reuse the mysql-load and mysql-dump tasks locally as well as 91 remotely, removing redundant code and the potential for problems like the bug fix mentioned above. 92 93 * Version 0.9 has been rewritten to use 86 94 sfDatabaseManager and remote dumping and loading tasks to eliminate 87 95 extra ssh connections and allow the use of any databases.yml file plugins/sfSyncContentPlugin/trunk/lib/task/synccontentTask.class.php
r22583 r22882 22 22 sfCommandArgument::REQUIRED, 23 23 'The application name ("frontend")'), 24 new sfCommandArgument(' localenv',24 new sfCommandArgument('env', 25 25 sfCommandArgument::REQUIRED, 26 26 'The local environment ("dev")'), … … 90 90 } 91 91 92 if (!preg_match('/^(\w+)(:(\w+))?$/', $args[' localenv'], $matches))92 if (!preg_match('/^(\w+)(:(\w+))?$/', $args['env'], $matches)) 93 93 { 94 94 throw new sfException("Second argument must be an environment name. Example #1: dev Example #2: prod"); … … 103 103 } 104 104 105 // Drastic simplification due to the new sfDatabaseManager-based approach and 106 // the remote dump and load tasks 107 108 $params = sfSyncContentTools::shellDatabaseParams(sfSyncContentTools::getDatabaseParams($this->configuration)); 109 105 $binary = $_SERVER['SCRIPT_FILENAME']; 106 // A further simplification: use the subsidiary tasks locally too. This resolves issues with the 107 // correct environment not being loaded and removes duplicate code 110 108 if ($direction == 'to') 111 109 { 112 $cmd = "mysqldump --skip-opt --add-drop-table --create-options " . 113 "--disable-keys --extended-insert --set-charset $params | " . $this->_content_sync_build_remote_cmd($pathRemote, "./symfony project:mysql-load --application=$application --env=$envRemote"); 110 $cmd = "$binary project:mysql-dump --application=$application --env=$env | " . $this->_content_sync_build_remote_cmd($pathRemote, "./symfony project:mysql-load --application=$application --env=$envRemote"); 114 111 $this->_content_sync_system($cmd); 115 112 } 116 113 else 117 114 { 118 $cmd = $this->_content_sync_build_remote_cmd($pathRemote, "./symfony project:mysql-dump --application=$application --env=$envRemote") . " | mysql $params ";115 $cmd = $this->_content_sync_build_remote_cmd($pathRemote, "./symfony project:mysql-dump --application=$application --env=$envRemote") . " | $binary project:mysql-load --application=$application --env=$env"; 119 116 $this->_content_sync_system($cmd); 120 117 } … … 146 143 $port = $this->sshPort; 147 144 $this->_content_sync_system("rsync -e 'ssh -p $port' -azC --no-o --no-t --no-p --force --delete --progress " . escapeshellarg($path1) . " " . escapeshellarg($path2)); 148 }149 150 function _content_sync_format_db_credentials($dbData)151 {152 return "--user=" . escapeshellarg($dbData['user']) .153 " --password=" . escapeshellarg($dbData['password']) .154 " -h " . escapeshellarg($dbData['host']) .155 " " . $dbData['database'];156 145 } 157 146