Browse Source

Better install removal

Nathaniel van Diepen 11 years ago
parent
commit
bc4b68b759
2 changed files with 6 additions and 6 deletions
  1. 5 0
      index.php
  2. 1 6
      install/api.php

+ 5 - 0
index.php

@@ -2,6 +2,11 @@
 	if(!file_exists('config.json')){
 		header('Location: install');
 		die();
+	}elseif(file_exists('install')){
+		$files = scandir('install');
+		if(empty($files)){
+			@rmdir('install');
+		}
 	}
 	session_start();
 	require_once('php/include.php');

+ 1 - 6
install/api.php

@@ -142,12 +142,7 @@
 								@unlink(realpath(dirname(__FILE__)).'/'.$file);
 							}
 						}
-						$files = scandir(realpath(dirname(__FILE__)));
-						if(empty($files)){
-							@rmdir(realpath(dirname(__FILE__)));
-						}else{
-							echo "Couldn't remove install directory\n";
-						}
+						@rmdir(realpath(dirname(__FILE__)));
 					}else{
 						die('Invalid id');
 					}