Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
dc92d397
Commit
dc92d397
authored
Dec 02, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
includes
parent
6d27ca80
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
3 deletions
+113
-3
eyesis4pi_interface.php
src/eyesis4pi/eyesis4pi_interface.php
+8
-1
Makefile
src/php_top/Makefile
+4
-2
include_parallel_requests.php
src/php_top/include_parallel_requests.php
+0
-0
include_response.php
src/php_top/include_response.php
+101
-0
No files found.
src/eyesis4pi/eyesis4pi_interface.php
View file @
dc92d397
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
*! DESCRIPTION: command interface for the eyesis4pi gui
*! DESCRIPTION: command interface for the eyesis4pi gui
*! Copyright (C) 2016 Elphel, Inc.
*! Copyright (C) 2016 Elphel, Inc.
*! --------------------------------------------------------------------------
*! --------------------------------------------------------------------------
*!
*! This program is free software: you can redistribute it and/or modify
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! the Free Software Foundation, either version 3 of the License, or
...
@@ -36,6 +35,14 @@ switch($cmd){
...
@@ -36,6 +35,14 @@ switch($cmd){
if
(
is_link
(
$symlink
))
die
(
"already exists"
);
if
(
is_link
(
$symlink
))
die
(
"already exists"
);
die
(
symlink
(
$mountpoint
,
$symlink
));
die
(
symlink
(
$mountpoint
,
$symlink
));
break
;
break
;
case
"free_space"
:
if
(
$_GET
[
'mountpoint'
]
==
"/mnt/sda2"
){
//unpartitioned area
}
else
{
if
(
is_dir
(
$mountpoint
))
$res
=
disk_free_space
(
$mountpoint
);
else
$res
=
0
;
}
break
;
default
:
default
:
print
(
"nothing has been done"
);
print
(
"nothing has been done"
);
}
}
...
...
src/php_top/Makefile
View file @
dc92d397
...
@@ -10,7 +10,6 @@ SYSCONFDIR = /etc
...
@@ -10,7 +10,6 @@ SYSCONFDIR = /etc
CONFDIR
=
$(SYSCONFDIR)
/elphel393
CONFDIR
=
$(SYSCONFDIR)
/elphel393
PHP_SCRIPTS
=
i2c.php
\
PHP_SCRIPTS
=
i2c.php
\
parallel_requests.php
\
camvars.php
\
camvars.php
\
ccam.php
\
ccam.php
\
diag_utils.php
\
diag_utils.php
\
...
@@ -20,7 +19,10 @@ PHP_SCRIPTS=i2c.php \
...
@@ -20,7 +19,10 @@ PHP_SCRIPTS=i2c.php \
snapfull.php
\
snapfull.php
\
tuneseq.php
tuneseq.php
PHPINCLUDES
=
i2c_include.php show_source_include.php
PHPINCLUDES
=
i2c_include.php
\
show_source_include.php
\
include_parallel_requests.php
\
include_response.php
all
:
all
:
@
echo
"make all in src"
@
echo
"make all in src"
...
...
src/php_top/parallel_requests.php
→
src/php_top/
include_
parallel_requests.php
View file @
dc92d397
File moved
src/php_top/include_response.php
0 → 100644
View file @
dc92d397
<?php
/*
*!***************************************************************************
*! FILE NAME : include_response.php
*! DESCRIPTION: http requests response functions
*! Copyright (C) 2016 Elphel, Inc.
*! --------------------------------------------------------------------------
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! --------------------------------------------------------------------------
*/
function
get_uptime
(){
exec
(
'cat /proc/uptime'
,
$output
,
$retval
);
return
floatval
(
explode
(
" "
,
trim
(
$output
[
0
]))[
0
]);
}
//printf("%08.2f\n",$f);
function
log_open
(){
$GLOBALS
[
'logFile'
]
=
fopen
(
$GLOBALS
[
'logFilePath'
],
"a"
);
}
/** Log message and optionally print to console */
function
log_msg
(
$msg
,
///< message to print
$mode
=
-
1
)
///< -1 - print only short messages, 0 - never print, 1 - always print, 2 print in bold red (error), 3 - bold white, 4 - bold yellow (warning)
{
// do not output log when in HTTP request mode
$ut
=
get_uptime
();
if
((
$mode
!=
0
)
&&
!
array_key_exists
(
'REQUEST_METHOD'
,
$_SERVER
)
&&
((
$mode
>
0
)
||
(
strlen
(
$msg
)
<
$GLOBALS
[
'LOG_MAX_ECHO'
])))
{
switch
(
$mode
)
{
case
2
:
$emsg
=
colorize
(
$msg
,
'RED'
,
1
);
// bold red
break
;
case
3
:
$emsg
=
colorize
(
$msg
,
''
,
1
);
// bold white
break
;
case
4
:
$emsg
=
colorize
(
$msg
,
'YELLOW'
,
1
);
// bold white
break
;
default
:
$emsg
=
$msg
;
}
printf
(
colorize
(
sprintf
(
"[%8.2f] autocampars: "
,
$ut
),
"GREEN"
,
0
)
.
$emsg
.
"
\n
"
);
}
fwrite
(
$GLOBALS
[
'logFile'
],
sprintf
(
"%08.2f autocampars: %s
\n
"
,
$ut
,
$msg
));
// date ("F j, Y, G:i:s")
}
function
log_error
(
$msg
)
{
log_msg
(
$msg
,
2
);
log_close
();
exit
(
1
);
}
function
log_close
()
{
log_msg
(
"Log file saved as "
.
$GLOBALS
[
'logFilePath'
],
3
);
log_msg
(
"----------------------------------------------"
,
0
);
fclose
(
$GLOBALS
[
'logFile'
]);
unset
(
$GLOBALS
[
'logFile'
]);
// to catch errors
}
/** Closes log file, optianally responxds with XML (if in HTTP mode), exits with 0/1 */
function
respond_xml
(
$result
,
$error
=
null
,
$color_mode
=
3
){
// default white bold
if
(
array_key_exists
(
'REQUEST_METHOD'
,
$_SERVER
)){
$xml
=
new
SimpleXMLElement
(
"<?xml version='1.0' standalone='yes'?><autocampars/>"
);
if
(
$result
!==
""
){
//"" will not be loged/output
if
(
is_string
(
$result
)
&&
((
count
(
$result
)
==
0
)
||
(
$result
[
0
]
!=
'"'
))){
$result
=
'"'
.
$result
.
'"'
;
}
$xml
->
addChild
(
'result'
,
$result
);
}
if
(
$error
){
$xml
->
addChild
(
'error'
,
'"'
.
$error
.
'"'
);
}
$rslt
=
$xml
->
asXML
();
header
(
"Content-Type: text/xml"
);
header
(
"Content-Length: "
.
strlen
(
$rslt
)
.
"
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
printf
(
$rslt
);
}
if
(
isset
(
$GLOBALS
[
'logFile'
])){
if
(
$result
!==
""
){
//"" will not be loged/output
log_msg
(
''
.
$result
,
$color_mode
);
}
if
(
$error
){
log_error
(
$error
);
}
else
{
log_close
();
exit
(
0
);
}
}
}
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment