Code Duplication    Length = 12-12 lines in 2 locations

code/backends/CapistranoDeploymentBackend.php 2 locations

@@ 322-333 (lines=12) @@
319
		$databasePath = $filepathBase . DIRECTORY_SEPARATOR . 'database.sql';
320
321
		// Backup database
322
		if(in_array($dataTransfer->Mode, array('all', 'db'))) {
323
			$log->write(sprintf('Backup of database from "%s" started', $name));
324
			$command = $this->getCommand('data:getdb', 'db', $environment, array('data_path' => $databasePath), $log);
325
			$command->run(function($type, $buffer) use($log) {
326
				$log->write($buffer);
327
			});
328
			if(!$command->isSuccessful()) {
329
				$this->extend('dataTransferFailure', $environment, $log);
330
				throw new RuntimeException($command->getErrorOutput());
331
			}
332
			$log->write(sprintf('Backup of database from "%s" done', $name));
333
		}
334
335
		// Backup assets
336
		if(in_array($dataTransfer->Mode, array('all', 'assets'))) {
@@ 336-347 (lines=12) @@
333
		}
334
335
		// Backup assets
336
		if(in_array($dataTransfer->Mode, array('all', 'assets'))) {
337
			$log->write(sprintf('Backup of assets from "%s" started', $name));
338
			$command = $this->getCommand('data:getassets', 'web', $environment, array('data_path' => $filepathBase), $log);
339
			$command->run(function($type, $buffer) use($log) {
340
				$log->write($buffer);
341
			});
342
			if(!$command->isSuccessful()) {
343
				$this->extend('dataTransferFailure', $environment, $log);
344
				throw new RuntimeException($command->getErrorOutput());
345
			}
346
			$log->write(sprintf('Backup of assets from "%s" done', $name));
347
		}
348
349
		// ensure the database connection is re-initialised, which is needed if the transfer
350
		// above took a really long time because the handle to the db may have become invalid.