]> git.mxchange.org Git - friendica.git/commitdiff
fopen error messages
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Sat, 8 Aug 2020 06:47:21 +0000 (08:47 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Sat, 8 Aug 2020 06:47:21 +0000 (08:47 +0200)
src/Console/ServerBlock.php

index 40d8e45e74ba7180d2afb6daf7ee8d3b30ceea65..d052612e1fae2b1db09fdaa76985e207583f2a60 100644 (file)
@@ -112,6 +112,9 @@ HELP;
                $filename = $this->getArgument(1);
                $blocklist = $config->get('system', 'blocklist', []);
                $fp = fopen($filename, 'w');
+               if (!$fp) {
+                       throw new Exception(sprintf('The file "%s" could not be created.', $filename));
+               }
                foreach ($blocklist as $domain) {
                        fputcsv($fp, $domain);
                }
@@ -156,6 +159,8 @@ HELP;
                                return 1;
                        }
 
+               } else {
+                       throw new Exception(sprintf('The file "%s" could not be opened for importing', $filename));
                }
        }