@@ -108,6 +108,8 @@ public function __construct(
108108 'skip-tz-utz ' => false ,
109109 'no-autocommit ' => true ,
110110 'default-character-set ' => Mysqldump::UTF8 ,
111+ 'skip-comments ' => false ,
112+ 'skip-dump-date ' => false ,
111113 /* deprecated */
112114 'disable-foreign-keys-check ' => true
113115 );
@@ -298,18 +300,20 @@ public function start($filename = '')
298300 */
299301 private function getDumpFileHeader ()
300302 {
301- // Some info about software, source and time
302- $ header = "-- mysqldump-php https://github.com/ifsnop/mysqldump-php " . PHP_EOL .
303- "-- " . PHP_EOL .
304- "-- Host: {$ this ->host }\tDatabase: {$ this ->db }" . PHP_EOL .
305- "-- ------------------------------------------------------ " . PHP_EOL ;
306-
307- if (!empty ($ this ->version )) {
308- $ header .= "-- Server version \t" . $ this ->version . PHP_EOL ;
309- }
303+ $ header = '' ;
304+ if (!$ this ->dumpSettings ['skip-comments ' ]) {
305+ // Some info about software, source and time
306+ $ header = "-- mysqldump-php https://github.com/ifsnop/mysqldump-php " . PHP_EOL .
307+ "-- " . PHP_EOL .
308+ "-- Host: {$ this ->host }\tDatabase: {$ this ->db }" . PHP_EOL .
309+ "-- ------------------------------------------------------ " . PHP_EOL ;
310310
311- $ header .= "-- Date: " . date ('r ' ) . PHP_EOL . PHP_EOL ;
311+ if (!empty ($ this ->version )) {
312+ $ header .= "-- Server version \t" . $ this ->version . PHP_EOL ;
313+ }
312314
315+ $ header .= "-- Date: " . date ('r ' ) . PHP_EOL . PHP_EOL ;
316+ }
313317 return $ header ;
314318 }
315319
@@ -320,7 +324,14 @@ private function getDumpFileHeader()
320324 */
321325 private function getDumpFileFooter ()
322326 {
323- $ footer = "-- Dump completed on: " . date ('r ' ) . PHP_EOL ;
327+ $ footer = '' ;
328+ if (!$ this ->dumpSettings ['skip-comments ' ]) {
329+ $ footer .= '-- Dump completed ' ;
330+ if (!$ this ->dumpSettings ['skip-dump-date ' ]) {
331+ $ footer .= ' on: ' . date ('r ' );
332+ }
333+ $ footer .= PHP_EOL ;
334+ }
324335
325336 return $ footer ;
326337 }
@@ -441,9 +452,12 @@ private function exportTriggers()
441452 private function getTableStructure ($ tableName )
442453 {
443454 if (!$ this ->dumpSettings ['no-create-info ' ]) {
444- $ ret = "-- " . PHP_EOL .
445- "-- Table structure for table ` $ tableName` " . PHP_EOL .
446- "-- " . PHP_EOL . PHP_EOL ;
455+ $ ret = '' ;
456+ if (!$ this ->dumpSettings ['skip-comments ' ]) {
457+ $ ret = "-- " . PHP_EOL .
458+ "-- Table structure for table ` $ tableName` " . PHP_EOL .
459+ "-- " . PHP_EOL . PHP_EOL ;
460+ }
447461 $ stmt = $ this ->typeAdapter ->show_create_table ($ tableName );
448462 foreach ($ this ->dbHandler ->query ($ stmt ) as $ r ) {
449463 $ this ->compressManager ->write ($ ret );
@@ -486,9 +500,12 @@ private function getTableStructure($tableName)
486500 */
487501 private function getViewStructure ($ viewName )
488502 {
489- $ ret = "-- " . PHP_EOL .
490- "-- Table structure for view ` $ {viewName}` " . PHP_EOL .
491- "-- " . PHP_EOL . PHP_EOL ;
503+ $ ret = '' ;
504+ if (!$ this ->dumpSettings ['skip-comments ' ]) {
505+ $ ret = "-- " . PHP_EOL .
506+ "-- Table structure for view ` $ {viewName}` " . PHP_EOL .
507+ "-- " . PHP_EOL . PHP_EOL ;
508+ }
492509 $ this ->compressManager ->write ($ ret );
493510 $ stmt = $ this ->typeAdapter ->show_create_view ($ viewName );
494511 foreach ($ this ->dbHandler ->query ($ stmt ) as $ r ) {
@@ -615,11 +632,13 @@ private function listValues($tableName)
615632 */
616633 function prepareListValues ($ tableName )
617634 {
618- $ this ->compressManager ->write (
619- "-- " . PHP_EOL .
620- "-- Dumping data for table ` $ tableName` " . PHP_EOL .
621- "-- " . PHP_EOL . PHP_EOL
622- );
635+ if (!$ this ->dumpSettings ['skip-comments ' ]) {
636+ $ this ->compressManager ->write (
637+ "-- " . PHP_EOL .
638+ "-- Dumping data for table ` $ tableName` " . PHP_EOL .
639+ "-- " . PHP_EOL . PHP_EOL
640+ );
641+ }
623642
624643 if ($ this ->dumpSettings ['single-transaction ' ]) {
625644 $ this ->dbHandler ->exec ($ this ->typeAdapter ->setup_transaction ());
0 commit comments