Skip to content

Commit

Permalink
Flow 2.2 compatibility: fix issue about missing Files::bytesToSizeStr…
Browse files Browse the repository at this point in the history
…ing() method
  • Loading branch information
ryzy committed Mar 2, 2015
1 parent 5da60bc commit a354450
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Classes/M12/DbExport/Command/DbCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ public function exportCommand($packageKey = NULL, $sqlFile = NULL, $mode = self:
$cmd = 'mysqldump -v' . $this->getSqlConnectionParams() . " $dbName $tablesToExport > $sqlFile";
$result = $this->exec($cmd);
$size = filesize($sqlFile);
// Note: make it compatible with Flow 2.2 where Files::bytesToSizeString() is not available
$sizeFormatted = method_exists('TYPO3\Flow\Utility\Files','bytesToSizeString') ? Files::bytesToSizeString($size) : round($size/1024).' kB';

$this->outputLine();
$this->outputLine("Database '$dbName' has been exported to '$sqlFile' file.");
$this->outputLine("Exported $sqlFile file size: " . Files::bytesToSizeString($size));
$this->outputLine("Exported $sqlFile file size: " . $sizeFormatted);
$this->outputLine();
$this->outputLine("Exported tables: " . ($tablesToExport ? $tablesToExport : '[all]') . '.');
$this->outputLine();
Expand Down

0 comments on commit a354450

Please sign in to comment.