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
ee863f0b
Commit
ee863f0b
authored
May 15, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(proxy) require post action for service control
parent
3b62a276
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
29 deletions
+45
-29
ServiceController.php
.../app/controllers/OPNsense/Proxy/Api/ServiceController.php
+45
-29
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Proxy/Api/ServiceController.php
View file @
ee863f0b
...
@@ -39,14 +39,18 @@ use \OPNsense\Proxy\Proxy;
...
@@ -39,14 +39,18 @@ use \OPNsense\Proxy\Proxy;
class
ServiceController
extends
ApiControllerBase
class
ServiceController
extends
ApiControllerBase
{
{
/**
/**
* start proxy service
* start proxy service
(in background)
* @return array
* @return array
*/
*/
public
function
startAction
()
public
function
startAction
()
{
{
$backend
=
new
Backend
();
if
(
$this
->
request
->
isPost
())
{
$response
=
$backend
->
configdRun
(
"proxy start"
,
true
);
$backend
=
new
Backend
();
return
array
(
"response"
=>
$response
);
$response
=
$backend
->
configdRun
(
"proxy start"
,
true
);
return
array
(
"response"
=>
$response
);
}
else
{
return
array
(
"response"
=>
array
());
}
}
}
/**
/**
...
@@ -55,9 +59,13 @@ class ServiceController extends ApiControllerBase
...
@@ -55,9 +59,13 @@ class ServiceController extends ApiControllerBase
*/
*/
public
function
stopAction
()
public
function
stopAction
()
{
{
$backend
=
new
Backend
();
if
(
$this
->
request
->
isPost
())
{
$response
=
$backend
->
configdRun
(
"proxy stop"
);
$backend
=
new
Backend
();
return
array
(
"response"
=>
$response
);
$response
=
$backend
->
configdRun
(
"proxy stop"
);
return
array
(
"response"
=>
$response
);
}
else
{
return
array
(
"response"
=>
array
());
}
}
}
/**
/**
...
@@ -66,9 +74,13 @@ class ServiceController extends ApiControllerBase
...
@@ -66,9 +74,13 @@ class ServiceController extends ApiControllerBase
*/
*/
public
function
restartAction
()
public
function
restartAction
()
{
{
$backend
=
new
Backend
();
if
(
$this
->
request
->
isPost
())
{
$response
=
$backend
->
configdRun
(
"proxy restart"
);
$backend
=
new
Backend
();
return
array
(
"response"
=>
$response
);
$response
=
$backend
->
configdRun
(
"proxy restart"
);
return
array
(
"response"
=>
$response
);
}
else
{
return
array
(
"response"
=>
array
());
}
}
}
/**
/**
...
@@ -105,31 +117,35 @@ class ServiceController extends ApiControllerBase
...
@@ -105,31 +117,35 @@ class ServiceController extends ApiControllerBase
*/
*/
public
function
reconfigureAction
()
public
function
reconfigureAction
()
{
{
// close session for long running action
if
(
$this
->
request
->
isPost
())
{
$this
->
sessionClose
();
// close session for long running action
$this
->
sessionClose
();
$mdlProxy
=
new
Proxy
();
$mdlProxy
=
new
Proxy
();
$backend
=
new
Backend
();
$backend
=
new
Backend
();
$runStatus
=
$this
->
statusAction
();
$runStatus
=
$this
->
statusAction
();
// stop squid when disabled
// stop squid when disabled
if
(
$runStatus
[
'status'
]
==
"running"
&&
$mdlProxy
->
general
->
enabled
->
__toString
()
==
0
)
{
if
(
$runStatus
[
'status'
]
==
"running"
&&
$mdlProxy
->
general
->
enabled
->
__toString
()
==
0
)
{
$this
->
stopAction
();
$this
->
stopAction
();
}
}
// generate template
// generate template
$backend
->
configdRun
(
"template reload OPNsense.Proxy"
);
$backend
->
configdRun
(
"template reload OPNsense.Proxy"
);
// (res)start daemon
// (res)start daemon
if
(
$mdlProxy
->
general
->
enabled
->
__toString
()
==
1
)
{
if
(
$mdlProxy
->
general
->
enabled
->
__toString
()
==
1
)
{
if
(
$runStatus
[
'status'
]
==
"running"
)
{
if
(
$runStatus
[
'status'
]
==
"running"
)
{
$backend
->
configdRun
(
"proxy reconfigure"
);
$backend
->
configdRun
(
"proxy reconfigure"
);
}
else
{
}
else
{
$this
->
startAction
();
$this
->
startAction
();
}
}
}
}
return
array
(
"status"
=>
"ok"
);
return
array
(
"status"
=>
"ok"
);
}
else
{
return
array
(
"status"
=>
"failed"
);
}
}
}
}
}
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