Przeglądaj źródła

Ensure newline at end of hestiaweb user crontab (#4992)

sahsanu 9 miesięcy temu
rodzic
commit
c74f442eaf
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      web/edit/server/hestiaweb/index.php

+ 5 - 1
web/edit/server/hestiaweb/index.php

@@ -17,7 +17,11 @@ if (!empty($_POST["save"])) {
 		exec("mktemp", $mktemp_output, $return_var);
 		$new_conf = $mktemp_output[0];
 		$fp = fopen($new_conf, "w");
-		fwrite($fp, str_replace("\r\n", "\n", $_POST["v_config"]));
+		$config = str_replace("\r\n", "\n", $_POST["v_config"]);
+		if (!str_ends_with($config, "\n")) {
+			$config .= "\n";
+		}
+		fwrite($fp, $config);
 		fclose($fp);
 		exec(
 			HESTIA_CMD . "v-change-sys-service-config " . $new_conf . " hestiaweb yes",