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
73cd44e7
Commit
73cd44e7
authored
Jul 13, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firmware: flip remote array to emulate local array layout
parent
f11b72dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
FirmwareController.php
.../app/controllers/OPNsense/Core/Api/FirmwareController.php
+10
-4
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php
View file @
73cd44e7
...
...
@@ -130,19 +130,18 @@ class FirmwareController extends ApiControllerBase
{
$this
->
sessionClose
();
// long running action, close session
$response
=
array
(
'local'
=>
array
(),
'remote'
=>
array
());
$backend
=
new
Backend
();
$remote
=
$backend
->
configdRun
(
'firmware remote'
);
$local
=
$backend
->
configdRun
(
'firmware local'
);
/*
* pkg(8) returns malformed json by simply outputting each
* indivudual package json block... fix it up for now.
*/
$local
=
str_replace
(
"
\n
}
\n
"
,
"
\n
},
\n
"
,
trim
(
$local
));
$local
=
json_decode
(
'['
.
$local
.
']'
,
true
);
/* Remote packages are only a flat list */
$remote
=
explode
(
"
\n
"
,
trim
(
$remote
));
$response
=
array
(
'local'
=>
array
(),
'remote'
=>
$remote
);
if
(
$local
!=
null
)
{
$keep
=
array
(
'name'
,
'version'
,
'comment'
,
'www'
,
'flatsize'
,
'licenses'
,
'desc'
,
'categories'
);
foreach
(
$local
as
$infos
)
{
...
...
@@ -156,6 +155,13 @@ class FirmwareController extends ApiControllerBase
}
}
/* Remote packages are only a flat list */
$remote
=
explode
(
"
\n
"
,
trim
(
$remote
));
foreach
(
$remote
as
$name
)
{
/* keep layout compatible with the above */
$response
[
'remote'
][]
=
array
(
'name'
=>
$name
);
}
return
$response
;
}
}
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