Explorar o código

- Check that the temporary directory used by files upload exists and is writable from PHP. (As required in Trac #15).

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@221 a333f486-631f-4898-b8df-5754b55c2be0
dflaven %!s(int64=15) %!d(string=hai) anos
pai
achega
2c0e5e4eab
Modificáronse 1 ficheiros con 19 adicións e 1 borrados
  1. 19 1
      setup/index.php

+ 19 - 1
setup/index.php

@@ -73,6 +73,25 @@ function CheckPHPVersion(setup_web_page $oP)
 		$oP->error("Temporary directory for files upload is not defined (upload_tmp_dir)");
 		$bResult = false;
 	}
+	// check that the upload directory is indeed writable from PHP
+  	if (!empty($sUploadTmpDir))
+  	{
+  		if (!file_exists($sUploadTmpDir))
+  		{
+			$oP->error("Temporary directory for files upload ($sUploadTmpDir) does not exist or cannot be read by PHP.");
+			$bResult = false;
+		}
+  		else if (!is_writable($sUploadTmpDir))
+  		{
+			$oP->error("Temporary directory for files upload ($sUploadTmpDir) is not writable.");
+			$bResult = false;
+		}
+		else
+		{
+			$oP->log("Info - Temporary directory for files upload ($sUploadTmpDir) is writable.");
+		}
+	}
+	
 
   	if (!ini_get('upload_max_filesize'))
   	{
@@ -86,7 +105,6 @@ function CheckPHPVersion(setup_web_page $oP)
 		$bResult = false;
 	}
 	$oP->log("Info - upload_max_filesize: ".ini_get('upload_max_filesize'));
-	$oP->log("Info - upload_tmp_dir: $sUploadTmpDir");
 	$oP->log("Info - max_file_uploads: ".ini_get('max_file_uploads'));
 
 	return $bResult;