Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
499ee8c8
Commit
499ee8c8
authored
Apr 10, 2019
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'adam-www'
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parents
f544f798
248e15ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
lighttpd.conf
userspace/rootfs_override/etc/lighttpd/lighttpd.conf
+1
-1
functions.php
userspace/rootfs_override/var/www/functions.php
+9
-7
No files found.
userspace/rootfs_override/etc/lighttpd/lighttpd.conf
View file @
499ee8c8
...
...
@@ -93,7 +93,7 @@ $HTTP["host"] == "www2.example.org" {
}
#### accesslog module
accesslog
.
filename
=
"/var/log/access_lighttpd.log"
#
accesslog.filename = "/var/log/access_lighttpd.log"
############# experimentos ##################
...
...
userspace/rootfs_override/var/www/functions.php
View file @
499ee8c8
...
...
@@ -82,7 +82,7 @@ function wrs_header_ports(){
}
function
draw_table
(){
$ports
=
shell_exec
(
"/wr/bin/wr_mon -w | tail -20 | head -18
"
);
$ports
=
shell_exec
(
"/wr/bin/wr_mon -w | tail -20 | head -18
2>/dev/null"
);
$ports
=
explode
(
PHP_EOL
,
$ports
);
echo
"<table id='sfp_panel' border='0' align='center' vspace='15'>"
;
...
...
@@ -90,10 +90,10 @@ function draw_table(){
$cont
=
0
;
for
(
$i
=
0
;
$i
<
18
;
$i
=
$i
+
1
){
if
(
strpos
(
$ports
[
$i
],
"up"
)){
if
(
!
strpos
(
$ports
[
$i
],
"Master"
)){
$mode
=
"master"
;
}
else
{
if
(
strpos
(
$ports
[
$i
],
"Master"
)
===
false
){
$mode
=
"slave"
;
}
else
{
$mode
=
"master"
;
}
}
else
$mode
=
"linkdown"
;
...
...
@@ -778,6 +778,8 @@ function wrs_management(){
if
(
!
strcmp
(
$cmd
,
"reboot"
)){
wrs_reboot
();
}
else
if
(
!
empty
(
$_FILES
[
'firmware'
][
'name'
])){
shell_exec
(
"rm /tmp/wrs-firmware.tar"
);
//Clean previously uploaded files
shell_exec
(
"rm /tmp/wr-switch-sw-v*_binaries.tar"
);
//Clean previously uploaded files
$uploaddir
=
'/tmp/'
;
$uploadfname
=
basename
(
$_FILES
[
'firmware'
][
'name'
]);
$uploadfile
=
$uploaddir
.
$uploadfname
;
...
...
@@ -786,14 +788,14 @@ function wrs_management(){
echo
'<p align=center ><font color="red"><br>Upgrade procedure will take place after reboot.<br>Please do not switch off the device during flashing procedure.</font></p>'
;
if
(
$uploadfname
==
"barebox.bin"
||
$uploadfname
==
"wrs-firmware.tar"
||
$uploadfname
==
"zImage"
)
{
rename
(
$uploadfile
,
"
/update/"
.
(
$_FILES
[
'firmware'
][
'name'
]));
shell_exec
(
"mv -f
$uploadfile
/update/"
.
(
$_FILES
[
'firmware'
][
'name'
]));
//Reboot switch
sleep
(
1
);
wrs_reboot
(
90
);
//Updating only one part of the firmware take ~90s.
}
else
if
(
substr
(
$uploadfname
,
0
,
14
)
==
"wr-switch-sw-v"
&&
substr
(
$uploadfname
,
-
13
)
==
"_binaries.tar"
)
{
rename
(
$uploadfile
,
"
/update/wrs-firmware.tar"
);
shell_exec
(
"mv -f
$uploadfile
/update/wrs-firmware.tar"
);
//Reboot switch
sleep
(
1
);
wrs_reboot
(
150
);
//120s should be enough but we prefer to keep safe
...
...
@@ -1336,7 +1338,7 @@ function echoSelectedClassIfRequestMatches($requestUri)
return
'class="selected"'
;
}
function
wrs_reboot
(
$timeout
=
4
0
){
function
wrs_reboot
(
$timeout
=
6
0
){
sleep
(
1
);
header
(
'Location: reboot.php?timeout='
.
$timeout
);
}
...
...
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