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
877ad265
Commit
877ad265
authored
Nov 24, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter: improve status reload page
parent
0dea657b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
39 deletions
+25
-39
filter.inc
src/etc/inc/filter.inc
+1
-1
util.inc
src/etc/inc/util.inc
+12
-2
status_filter_reload.php
src/www/status_filter_reload.php
+12
-36
No files found.
src/etc/inc/filter.inc
View file @
877ad265
...
...
@@ -169,7 +169,7 @@ function filter_configure_sync($delete_states_if_needed = true)
filter_pflog_start
();
update_filter_reload_status
(
gettext
(
"Initializing"
));
update_filter_reload_status
(
gettext
(
"Initializing"
)
,
true
);
/* Get interface list to work with. */
filter_generate_optcfg_array
();
...
...
src/etc/inc/util.inc
View file @
877ad265
...
...
@@ -1090,9 +1090,19 @@ function format_bytes($bytes) {
}
}
function
update_filter_reload_status
(
$text
)
function
update_filter_reload_status
(
$text
,
$first
=
false
)
{
file_put_contents
(
'/var/run/filter_reload_status'
,
$text
);
$filter_reload_status
=
'/var/run/filter_reload_status'
;
if
(
$first
)
{
@
unlink
(
$filter_reload_status
);
}
file_put_contents
(
$filter_reload_status
,
sprintf
(
"%s: %s
\n
"
,
microtime
(
true
),
$text
),
FILE_APPEND
);
}
/****** util/return_dir_as_array
...
...
src/www/status_filter_reload.php
View file @
877ad265
...
...
@@ -31,14 +31,15 @@ require_once("guiconfig.inc");
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"Filter Reload Status"
));
$shortcut_section
=
"firewall"
;
if
(
file_exists
(
'/var/run/filter_reload_status'
))
{
$status
=
file_get_contents
(
'/var/run/filter_reload_status'
);
}
if
(
$_GET
[
'getstatus'
])
{
echo
"|
{
$status
}
|"
;
$status
=
''
;
if
(
file_exists
(
'/var/run/filter_reload_status'
))
{
$status
=
file_get_contents
(
'/var/run/filter_reload_status'
);
}
echo
$status
;
exit
;
}
if
(
$_POST
[
'reloadfilter'
])
{
configd_run
(
"filter reload"
);
if
(
isset
(
$config
[
'hasync'
][
'synchronizetoip'
])
&&
trim
(
$config
[
'hasync'
][
'synchronizetoip'
])
!=
""
)
{
...
...
@@ -71,24 +72,13 @@ include("head.inc");
<div
class=
"content-box "
>
<div
class=
"col-xs-12"
>
<br
/>
<form
action=
"status_filter_reload.php"
method=
"post"
name=
"filter"
>
<p><form
action=
"status_filter_reload.php"
method=
"post"
name=
"filter"
>
<input
type=
"submit"
value=
"Reload Filter"
class=
"btn btn-primary"
name=
"reloadfilter"
id=
"reloadfilter"
/>
<?php
if
(
$config
[
'hasync'
]
&&
$config
[
'hasync'
][
"synchronizetoip"
]
!=
""
)
:
?>
<input
type=
"submit"
value=
"Force Config Sync"
class=
"btn btn-primary"
name=
"syncfilter"
id=
"syncfilter"
/>
<?php
endif
;
?>
</form>
<br
/><br
/><br
/>
<div
id=
"status"
class=
"well"
>
<?php
echo
$status
;
?>
</div>
</div>
<br/>
<div
id=
"reloadinfo"
>
<?=
gettext
(
"This page will automatically refresh every 3 seconds until the filter is done reloading"
);
?>
.
</div>
</form></p>
<pre
id=
"status"
></pre>
</div>
</div>
</section>
...
...
@@ -105,22 +95,8 @@ function update_status_thread() {
}
function
update_data
(
obj
)
{
var
result_text
=
obj
.
content
;
var
result_text_split
=
result_text
.
split
(
"
|
"
);
result_text
=
result_text_split
[
1
];
result_text
=
result_text
.
replace
(
"
\n
"
,
""
);
result_text
=
result_text
.
replace
(
"
\r
"
,
""
);
if
(
result_text
)
{
jQuery
(
'
#status
'
).
html
(
'
<span class="glyphicon glyphicon-refresh"></span>
'
+
result_text
+
'
...
'
);
}
else
{
jQuery
(
'
#status
'
).
html
(
'
<span class="glyphicon glyphicon-refresh"></span> Obtaining filter status...
'
);
}
if
(
result_text
==
"
Initializing
"
)
{
jQuery
(
'
#status
'
).
html
(
'
<span class="glyphicon glyphicon-refresh"></span> Initializing...
'
);
}
else
if
(
result_text
==
"
Done
"
)
{
jQuery
(
'
#status
'
).
html
(
'
Done. The filter rules have been reloaded.
'
);
jQuery
(
'
#reloadinfo
'
).
css
(
"
visibility
"
,
"
hidden
"
);
}
window
.
setTimeout
(
'
update_status_thread()
'
,
2500
);
jQuery
(
'
#status
'
).
html
(
result_text
);
window
.
setTimeout
(
'
update_status_thread()
'
,
200
);
}
//]]>
</script>
...
...
@@ -170,7 +146,7 @@ if (typeof getURL == 'undefined') {
http_request
.
send
(
null
);
}
}
window
.
setTimeout
(
'
update_status_thread()
'
,
2500
);
update_status_thread
(
);
//]]>
</script>
...
...
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