Commit d440d59a authored by Ad Schellevis's avatar Ad Schellevis

(legacy) move get_ppp_uptime to interfaces.inc 

parent 63147c32
<?php
/*
Copyright (C) 2004-2006 Scott Ullrich
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/* include all configuration functions */
require_once("interfaces.inc");
require_once("services.inc");
......@@ -5418,3 +5418,22 @@ function zte_simstate_to_string($state) {
$string = "{$modes[$state]} State";
return $string;
}
/* Compute the total uptime from the ppp uptime log file in the conf directory */
function get_ppp_uptime($port){
if (file_exists("/conf/{$port}.log")){
$saved_time = file_get_contents("/conf/{$port}.log");
$uptime_data = explode("\n",$saved_time);
$sec=0;
foreach($uptime_data as $upt) {
$sec += substr($upt, 1 + strpos($upt, " "));
}
return convert_seconds_to_hms($sec);
} else {
$total_time = gettext("No history data found!");
return $total_time;
}
}
......@@ -435,24 +435,6 @@ function is_pppoe_server_enabled() {
return $pppoeenable;
}
/* Compute the total uptime from the ppp uptime log file in the conf directory */
function get_ppp_uptime($port){
if (file_exists("/conf/{$port}.log")){
$saved_time = file_get_contents("/conf/{$port}.log");
$uptime_data = explode("\n",$saved_time);
$sec=0;
foreach($uptime_data as $upt) {
$sec += substr($upt, 1 + strpos($upt, " "));
}
return convert_seconds_to_hms($sec);
} else {
$total_time = gettext("No history data found!");
return $total_time;
}
}
function add_hostname_to_watch($hostname) {
if(!is_dir("/var/db/dnscache")) {
mkdir("/var/db/dnscache");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment