Explorar el Código

fix install 3

causefx hace 8 años
padre
commit
1ae182085f
Se han modificado 1 ficheros con 14 adiciones y 11 borrados
  1. 14 11
      functions.php

+ 14 - 11
functions.php

@@ -2228,17 +2228,20 @@ function loadAppearance() {
 	);
 
 	if (DATABASE_LOCATION) {
-		if (!isset($GLOBALS['file_db'])) {
-			$GLOBALS['file_db'] = new PDO('sqlite:'.DATABASE_LOCATION.'users.db');
-			$GLOBALS['file_db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-		}
-		// Database Lookup
-		$options = $GLOBALS['file_db']->query('SELECT * FROM options');
-		// Replace defaults with filled options
-		foreach($options as $row) {
-			foreach($defaults as $key => $value) {
-				if (isset($row[$key]) && $row[$key]) {
-					$defaults[$key] = $row[$key];
+		if(is_file(DATABASE_LOCATION.'users.db') && filesize(DATABASE_LOCATION.'users.db') > 0){
+			if (!isset($GLOBALS['file_db'])) {
+				$GLOBALS['file_db'] = new PDO('sqlite:'.DATABASE_LOCATION.'users.db');
+				$GLOBALS['file_db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+			}
+			
+			// Database Lookup
+			$options = $GLOBALS['file_db']->query('SELECT * FROM options');
+			// Replace defaults with filled options
+			foreach($options as $row) {
+				foreach($defaults as $key => $value) {
+					if (isset($row[$key]) && $row[$key]) {
+						$defaults[$key] = $row[$key];
+					}
 				}
 			}
 		}