ifsnop / mysqldump-php

PHP version of mysqldump cli that comes with MySQL
https://github.com/ifsnop/mysqldump-php
GNU General Public License v3.0
1.25k stars 300 forks source link

Do not overwrite the dump file when it is not empty #222

Closed mauriac closed 3 years ago

mauriac commented 3 years ago

I would like to sequence the dumps, and for that I need to write to the same file. there is a way not to overwrite the contents of the file?

ifsnop commented 3 years ago

Use a temporary filename, and only rename it after dump, if no exceptions were raised.

El jue., 11 mar. 2021 15:17, mauriac @.***> escribió:

I would like to sequence the dumps, and for that I need to write to the same file. there is a way not to overwrite the contents of the file?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ifsnop/mysqldump-php/issues/222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHMH2E2LC3BDOXZYOJYOF3TDDGIHANCNFSM4ZALRSWQ .

mauriac commented 3 years ago

Hello thank you for your answer, but please can you provide me some snippet that i can understand?

thank you.

mauriac commented 3 years ago

hello I found the solution,

we just have to replace in CompressNone::open function the write parameter of fopen in "a +" instead of "wb".

thank you for your help.

best regards