Quellcode durchsuchen

fixed folder not writable check for wizard

CauseFX vor 4 Jahren
Ursprung
Commit
8fbc129bff
1 geänderte Dateien mit 10 neuen und 13 gelöschten Zeilen
  1. 10 13
      api/classes/organizr.class.php

+ 10 - 13
api/classes/organizr.class.php

@@ -2581,17 +2581,19 @@ class Organizr
 			if (is_writable($path)) {
 			if (is_writable($path)) {
 				$this->setAPIResponse('success', 'Path exists and is writable', 200);
 				$this->setAPIResponse('success', 'Path exists and is writable', 200);
 				return true;
 				return true;
+			} else {
+				$this->setAPIResponse('error', 'Path exists but is not writable', 403);
+				return false;
 			}
 			}
 		} else {
 		} else {
-			if (is_writable(dirname($path, 1))) {
-				if (mkdir($path, 0760, true)) {
-					$this->setAPIResponse('success', 'Path is writable - Creating now', 200);
-					return true;
-				}
+			if (mkdir($path, 0760, true)) {
+				$this->setAPIResponse('success', 'Path is writable - Creating now', 200);
+				return true;
+			} else {
+				$this->setAPIResponse('error', 'Failed making directory - Check permissions', 403);
+				return false;
 			}
 			}
 		}
 		}
-		$this->setAPIResponse('error', 'Path is not writable', 401);
-		return false;
 	}
 	}
 
 
 	public function formatDatabaseDriver($driver)
 	public function formatDatabaseDriver($driver)
@@ -2664,12 +2666,7 @@ class Organizr
 					return false;
 					return false;
 				}
 				}
 			} else {
 			} else {
-				if (is_writable(dirname($path, 1))) {
-					if (!mkdir($path, 0760, true)) {
-						$this->setAPIResponse('error', '[' . $path . ']  is not writable', 422);
-						return false;
-					}
-				} else {
+				if (!mkdir($path, 0760, true)) {
 					$this->setAPIResponse('error', '[' . $path . ']  is not writable', 422);
 					$this->setAPIResponse('error', '[' . $path . ']  is not writable', 422);
 					return false;
 					return false;
 				}
 				}