diff options
author | Max Kostikov <max@kostikov.co> | 2021-09-30 20:45:02 +0000 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2021-09-30 20:45:02 +0000 |
commit | 591905c2829631564d39e6f9a59a51047adc7ead (patch) | |
tree | 170c09bad76e2734df17cebcac8364f27b27f1a2 | |
parent | 6ed160e4fa05e880bc81720b626f2bdc68a20db8 (diff) | |
parent | 9a19f7eac921bb5d05477cef98b2c2c200049c6c (diff) | |
download | volse-hubzilla-591905c2829631564d39e6f9a59a51047adc7ead.tar.gz volse-hubzilla-591905c2829631564d39e6f9a59a51047adc7ead.tar.bz2 volse-hubzilla-591905c2829631564d39e6f9a59a51047adc7ead.zip |
Merge branch 'dev' into 'dev'
Fix possible storage conversion stuck on file save error
See merge request hubzilla/core!1988
-rwxr-xr-x | util/storageconv | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/util/storageconv b/util/storageconv index 52bb77fbb..676425038 100755 --- a/util/storageconv +++ b/util/storageconv @@ -77,17 +77,18 @@ if($argc == 2) { } if(! file_put_contents($filename, dbunescbin($xx['content']))) { + @unlink($filename); echo PHP_EOL . 'Failed to save file ' . $filename . PHP_EOL; - continue; } - - $z = q("UPDATE photo SET content = '%s', os_storage = 1 WHERE id = %d", - dbescbin($filename), - intval($xx['id']) - ); - if(! $z) { - @unlink($filename); - echo PHP_EOL . 'Failed to update metadata for saved file ' . $filename . PHP_EOL; + else { + $z = q("UPDATE photo SET content = '%s', os_storage = 1 WHERE id = %d", + dbescbin($filename), + intval($xx['id']) + ); + if(! $z) { + @unlink($filename); + echo PHP_EOL . 'Failed to update metadata for saved file ' . $filename . PHP_EOL; + } } $cur_id = $xx['id']; |