Browse Source

Better test by starts with

main
Jeroen De Meerleer 2 years ago
parent
commit
3db109065c
4 changed files with 4 additions and 4 deletions
  1. +1
    -1
      js/site.js
  2. +1
    -1
      runnow.php
  3. +1
    -1
      runs.php
  4. +1
    -1
      webcron.php

+ 1
- 1
js/site.js View File

@ -47,7 +47,7 @@ $(document).ready(function() {
});
});
$("body").on("focusout", "input[name=url]", function() {
if($("input[name=url]").val().indexOf("reboot") !== -1) {
if($("input[name=url]").val().startsWith("reboot") !== -1) {
$("label[for=expected]").html("Capture services after reboot? (1: yes; 0: no)");
$("input[name=expected]").attr("placeholder", "1");
}


+ 1
- 1
runnow.php View File

@ -49,7 +49,7 @@ if (filter_var($jobnameResult[0]["url"], FILTER_VALIDATE_URL)) {
$timestamp = time();
} else {
if(!stristr($jobnameResult[0]["url"],"reboot")) {
if(strpos($jobnameResult[0]["url"],"reboot") !== 0) {
$body = '';
$statuscode = 0;
$url = "ssh " . $jobnameResult[0]['host'] . " '" . $jobnameResult[0]['url'] . "' 2>&1";


+ 1
- 1
runs.php View File

@ -34,7 +34,7 @@ if ($jobnameResult[0]["user"] != $_SESSION["userID"]) {
exit;
}
$jobName = $jobnameResult[0]['name'];
$rebootjob = stristr($jobnameResult[0]["url"],"reboot") ? true : false;
$rebootjob = strpos($jobnameResult[0]["url"],"reboot") === 0 ? true : false;
$runsForJobQry = "SELECT runs.*, jobs.jobID FROM runs, jobs WHERE runs.job = jobs.jobID AND runs.job = ?";
$allruns = true;


+ 1
- 1
webcron.php View File

@ -81,7 +81,7 @@ foreach ($results as $result) {
$body = $res->getBody();
} else {
if(!stristr($result["url"],"reboot")) {
if(strpos($result["url"],"reboot") !== 0) {
$body = '';
$statuscode = 0;
$url = "ssh " . $result['host'] . " '" . $result['url'] . "' 2>&1";


Loading…
Cancel
Save