Browse Source

+ The clean cache button is shown in caching page after saving with 'no caching' seleted [Bug 3702]

emanuele 13 years ago
parent
commit
c3d126f6e2
2 changed files with 34 additions and 1 deletions
  1. 8 1
      Sources/ManageServer.php
  2. 26 0
      Themes/default/Admin.template.php

+ 8 - 1
Sources/ManageServer.php

@@ -343,10 +343,17 @@ function ModifyCacheSettings($return_config = false)
 		saveDBSettings($config_vars);
 
 		// We have to manually force the clearing of the cache otherwise the changed settings might not get noticed.
+		$cache_enable = $modSettings['cache_enable'];
 		$modSettings['cache_enable'] = 1;
 		cache_put_data('modSettings', null, 90);
+		$modSettings['cache_enable'] = $cache_enable;
 
-		redirectexit('action=admin;area=serversettings;sa=cache;' . $context['session_var'] . '=' . $context['session_id']);
+		if ($modSettings['cache_enable'] == 0)
+		{
+			loadLanguage('ManageMaintenance');
+			createToken('admin-maint');
+			$context['template_layers'][] = 'clean_cache_button';
+		}
 	}
 
 	$context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=cache;save';

+ 26 - 0
Themes/default/Admin.template.php

@@ -1621,4 +1621,30 @@ function template_php_info()
 	}
 }
 
+function template_clean_cache_button_above()
+{
+}
+
+function template_clean_cache_button_below()
+{
+	global $txt, $scripturl, $context;
+
+	echo '
+	<div class="cat_bar">
+		<h3 class="catbg">', $txt['maintain_cache'], '</h3>
+	</div>
+	<div class="windowbg">
+		<span class="topslice"><span></span></span>
+		<div class="content">
+			<form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=cleancache" method="post" accept-charset="', $context['character_set'], '">
+				<p>', $txt['maintain_cache_info'], '</p>
+				<span><input type="submit" value="', $txt['maintain_run_now'], '" class="button_submit" /></span>
+				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
+				<input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
+			</form>
+		</div>
+		<span class="botslice"><span></span></span>
+	</div>';
+}
+
 ?>