Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
634b4a2f
Commit
634b4a2f
authored
Feb 20, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mvc: handle execution error more gracefully; closes #1413
parent
1df84c3e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
3 deletions
+12
-3
FirmwareController.php
.../app/controllers/OPNsense/Core/Api/FirmwareController.php
+2
-1
SystemhealthController.php
...llers/OPNsense/Diagnostics/Api/SystemhealthController.php
+3
-1
Backend.php
src/opnsense/mvc/app/library/OPNsense/Core/Backend.php
+7
-1
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php
View file @
634b4a2f
...
@@ -446,6 +446,7 @@ class FirmwareController extends ApiControllerBase
...
@@ -446,6 +446,7 @@ class FirmwareController extends ApiControllerBase
return
$result
;
return
$result
;
}
}
/**
/**
* retrieve upgrade status (and log file of current process)
* retrieve upgrade status (and log file of current process)
*/
*/
...
@@ -457,7 +458,7 @@ class FirmwareController extends ApiControllerBase
...
@@ -457,7 +458,7 @@ class FirmwareController extends ApiControllerBase
$result
[
'log'
]
=
$cmd_result
;
$result
[
'log'
]
=
$cmd_result
;
if
(
trim
(
$cmd_result
)
==
'Execute error'
)
{
if
(
$cmd_result
==
null
)
{
$result
[
'status'
]
=
'error'
;
$result
[
'status'
]
=
'error'
;
}
elseif
(
strpos
(
$cmd_result
,
'***DONE***'
)
!==
false
)
{
}
elseif
(
strpos
(
$cmd_result
,
'***DONE***'
)
!==
false
)
{
$result
[
'status'
]
=
'done'
;
$result
[
'status'
]
=
'done'
;
...
...
src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php
View file @
634b4a2f
...
@@ -540,8 +540,10 @@ class SystemhealthController extends ApiControllerBase
...
@@ -540,8 +540,10 @@ class SystemhealthController extends ApiControllerBase
if
(
$rrd_details
[
'filename'
]
!=
""
)
{
if
(
$rrd_details
[
'filename'
]
!=
""
)
{
$backend
=
new
Backend
();
$backend
=
new
Backend
();
$response
=
$backend
->
configdpRun
(
"systemhealth fetch "
,
array
(
$rrd_details
[
'filename'
]));
$response
=
$backend
->
configdpRun
(
"systemhealth fetch "
,
array
(
$rrd_details
[
'filename'
]));
if
(
$response
!=
null
)
{
$xml
=
@
simplexml_load_string
(
$response
);
$xml
=
@
simplexml_load_string
(
$response
);
}
}
}
if
(
$xml
!==
false
)
{
if
(
$xml
!==
false
)
{
// we only use the average databases in any RRD, remove the rest to avoid strange behaviour.
// we only use the average databases in any RRD, remove the rest to avoid strange behaviour.
...
...
src/opnsense/mvc/app/library/OPNsense/Core/Backend.php
View file @
634b4a2f
...
@@ -77,6 +77,7 @@ class Backend
...
@@ -77,6 +77,7 @@ class Backend
public
function
configdRun
(
$event
,
$detach
=
false
,
$timeout
=
120
,
$connect_timeout
=
10
)
public
function
configdRun
(
$event
,
$detach
=
false
,
$timeout
=
120
,
$connect_timeout
=
10
)
{
{
$endOfStream
=
chr
(
0
)
.
chr
(
0
)
.
chr
(
0
);
$endOfStream
=
chr
(
0
)
.
chr
(
0
)
.
chr
(
0
);
$errorOfStream
=
'Execute error'
;
$poll_timeout
=
2
;
// poll timeout interval
$poll_timeout
=
2
;
// poll timeout interval
// wait until socket exist for a maximum of $connect_timeout
// wait until socket exist for a maximum of $connect_timeout
...
@@ -122,7 +123,12 @@ class Backend
...
@@ -122,7 +123,12 @@ class Backend
}
}
}
}
return
str_replace
(
$endOfStream
,
""
,
$resp
);
if
(
strlen
(
$resp
)
>=
strlen
(
$errorOfStream
)
&&
substr
(
$resp
,
0
,
strlen
(
$errorOfStream
))
==
$errorOfStream
)
{
return
null
;
}
return
str_replace
(
$endOfStream
,
''
,
$resp
);
}
}
/**
/**
...
...
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