Sfoglia il codice sorgente

Remove Atom Files if Certain Settings Change

own3mall 5 anni fa
parent
commit
61cc180e0d
1 ha cambiato i file con 13 aggiunte e 0 eliminazioni
  1. 13 0
      modules/settings/settings.php

+ 13 - 0
modules/settings/settings.php

@@ -31,6 +31,9 @@ function exec_ogp_module()
 	{
 		$ssl = (isset($_POST['smtp_secure']) and $_POST['smtp_secure'] == 'ssl') ? 1 : 0;
 		$tls = (isset($_POST['smtp_secure']) and $_POST['smtp_secure'] == 'tls') ? 1 : 0;
+		
+		$oldSettings = $db->getSettings();
+		
 		$settings = array("panel_name" => $_REQUEST['panel_name'],
 			"header_code" => $_REQUEST['header_code'],
 			"maintenance_mode" => $_REQUEST['maintenance_mode'],
@@ -81,6 +84,16 @@ function exec_ogp_module()
 			$db->resetGameServerOrder();
 		}
 		
+		if($oldSettings["custom_github_update_branch_name"] != $settings["custom_github_update_branch_name"] || $oldSettings["custom_github_update_usernam"] != $settings["custom_github_update_usernam"]){
+			// Delete any old atom files for extras module
+			$extrasPathData = realpath('modules/extras/') . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR;
+			recursiveDelete($extrasPathData);
+			
+			// Delete any branch atom for update module
+			$updatesPath = realpath('modules/update/');
+			array_map('unlink', glob($updatesPath . "*.atom"));
+		}
+		
 		echo "<h2>".get_lang('settings')."</h2>";
 		print_success(get_lang('settings_updated'));
 		$view->refresh("?m=settings");