Browse Source

Add a check for writable custom avatar dir on upgrading

Signed-off-by: Suki <[email protected]>
Suki 11 years ago
parent
commit
fbf9dc7cfc
1 changed files with 11 additions and 1 deletions
  1. 11 1
      other/upgrade.php

+ 11 - 1
other/upgrade.php

@@ -997,6 +997,16 @@ function WelcomeLogin()
 		$boarddir . '/Settings_bak.php',
 	);
 
+	$custom_av_dir = !empty($modSettings['custom_avatar_dir']) ? $modSettings['custom_avatar_dir'] : $GLOBALS['boarddir'] .'/custom_avatar';
+
+	// This little fellow has to cooperate...
+	if (!is_writable($custom_av_dir))
+		@chmod($custom_av_dir, 0777);
+
+	// Are we good now?
+	if(!is_writable($custom_av_dir))
+		return throw_error(sprintf('The directory: %1$s has to be writable to continue the upgrade. Please make sure permissions are correctly set to allow this.', $custom_av_dir));
+
 	require_once($sourcedir . '/Security.php');
 
 	// Check the cache directory.
@@ -1391,7 +1401,7 @@ function BackupDatabase()
 
 	// Some useful stuff here.
 	db_extend();
-	
+
 	// Might need this as well
 	db_extend('packages');