Ignore:
Timestamp:
Aug 30, 2017, 2:45:37 PM (9 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
0.5, debian/bullseye, debian/jessie, master
Children:
a50c18f
Parents:
89c510f
Message:

Improved webservice class to use TrackItem in ServiceData.php and added some tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/webapp/webservice/inc/GnuBoat/ServiceShutdown.php

    r89c510f r0662b2d  
    3636                if($handle === false){
    3737                        $message = "Could not create file (". $config->shutdownRequestFile() .") to indicate shutdown to the daemon.";
    38                         error_log($message);
    39                         $result["shutdownstart"] = -1;
    40                         $result["errormessage"] = $message;
    41                 }
    42                 else{
    43                         $shutdownTime = new \DateTime('NOW');
    44                         $shutdownTime->modify("+15 seconds");
    45                         fwrite($handle, $shutdownTime->format(\DateTime::ATOM));
    46                         $result["shutdownstart"] = $shutdownTime->format(\DateTime::ATOM);
     38                        return $this->error($message, ["shutdownstart" => -1]);
    4739                }
    4840
    49                 header('Content-Type: application/json');
    50                 if($debug > 0){
    51                         echo json_encode($result,  JSON_PRETTY_PRINT) ."\n";
    52                 }
    53                 else{
    54                         echo json_encode($result) ."\n";
    55                 }
     41                $shutdownTime = new \DateTime('NOW');
     42                $shutdownTime->modify("+15 seconds");
     43                fwrite($handle, $shutdownTime->format(\DateTime::ATOM));
     44                fclose($handle);
     45                $result["shutdownstart"] = $shutdownTime->format(\DateTime::ATOM);
     46                $this->output($result);
    5647        }
    5748}
Note: See TracChangeset for help on using the changeset viewer.