Browse Source

Better error handling

Nathaniel van Diepen 11 years ago
parent
commit
e24795f557
1 changed files with 10 additions and 2 deletions
  1. 10 2
      install/api.php

+ 10 - 2
install/api.php

@@ -139,9 +139,17 @@
 						$files = scandir(realpath(dirname(__FILE__)));
 						foreach($files as $file){
 							if($file != '.' && $file != '..'){
-								unlink(realpath(dirname(__FILE__)).'/'.$file);
+								try{
+									unlink(realpath(dirname(__FILE__)).'/'.$file);
+								}catch(e){
+									echo "Couldn't remove {$file}\n";
+								}
+							}
+							try{
+								rmdir(realpath(dirname(__FILE__)));
+							}catch(e){
+								echo "Couldn't remove install directory\n";
 							}
-							rmdir(realpath(dirname(__FILE__)));
 						}
 					}else{
 						die('Invalid id');