Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mesh
meshmap
Commits
2074f182
Commit
2074f182
authored
Jun 22, 2020
by
Eric - kg6wxc
Browse files
Merge branch 'expire_nodes_manually' into 'master'
enhancement: manually expire nodes Closes
#18
See merge request
!20
parents
c2e79937
dbd3a5a5
Changes
1
Show whitespace changes
Inline
Side-by-side
webpage/admin/otherAdmin.php
View file @
2074f182
...
...
@@ -23,23 +23,71 @@ function other_loadThePage(div_id, script) {
data
:
"arname="
+
arname
,
success
:
function
(
msg
){
alert
(
'Polling should now resume.'
);
// $("#"+div_id).html(msg);
// $('#nav_link_location').css("background-color", "#dddddd");
// $('#nav_link_non_mesh').css("background-color", "");
// $('#nav_link_removed').css("background-color", "");
// $('#nav_link_report').css("background-color", "");
// $('#nav_link_other').css("background-color", "");
}
});
}
}
$
(
"#manualNodeExpire"
)
.
submit
(
function
(
event
)
{
event
.
preventDefault
();
var
form
=
$
(
this
),
which
=
form
.
find
(
"input[type='submit'][name='submitExpireNodes']"
)
.
val
(),
number
=
form
.
find
(
"input[type='number'][name='daysSincePolled']"
)
.
val
(),
url
=
form
.
attr
(
"action"
);
postData
=
new
FormData
(
this
);
postData
.
append
(
"daysSincePolled"
,
number
);
postData
.
append
(
"submitExpireNodes"
,
which
);
// var posting = $.post(url, { submitNonMeshCSV: which, csvFile: postData } );
// posting.done(function(data) { $("#admin_content").html(data); } );
var
posting
=
$
.
post
({
url
:
url
,
method
:
"POST"
,
data
:
postData
,
contentType
:
false
,
processData
:
false
,
success
:
function
(
data
)
{
$
(
"#admin_content"
)
.
html
(
data
);
}
});
});
</
script
>
<
a
href
=
"javascript:onclick=other_loadThePage('admin_content','fixPolling');"
>
Fix
stuck
polling
run
.
</
a
>
<
br
>
(
It
should
reset
itself
after
3
*
node_polling_interval
,
but
you
can
manually
do
it
here
also
.
)
<
br
>
<!--
<
a
href
=
"javascript:onclick=other_loadThePage('admin_content','manuallyRemoveNodes');"
>
Manually
expire
nodes
.
</
a
>
-->
EOD
;
echo
$html
.
"
\n
"
;
echo
$html
.
"
\n
"
;
echo
"<br>
\n
"
;
//echo "<form action='otherAdmin.php' id='manualNodeExpire' enctype='multipart/form-data' method='POST'>\n";
echo
"<form action='otherAdmin.php' id='manualNodeExpire' enctype='multipart/form-data' method='POST'>
\n
"
;
echo
"Manually expire nodes that have not been polled in:
\n
"
;
echo
"<input type='number' size='4' name='daysSincePolled' id='daysSincePolled'> days.
\n
"
;
echo
"<input type='submit' value='Expire Nodes' id='submitExpireNodes' name='submitExpireNodes'></form>
\n
"
;
if
((
isset
(
$_POST
[
'submitExpireNodes'
])
==
"Expire Nodes"
)
&&
isset
(
$_POST
[
'daysSincePolled'
]))
{
$INCLUDE_DIR
=
"../.."
;
$USER_SETTINGS
=
parse_ini_file
(
$INCLUDE_DIR
.
"/scripts/user-settings.ini"
);
require
$INCLUDE_DIR
.
"/scripts/wxc_functions.inc"
;
@
include
$INCLUDE_DIR
.
"/custom.inc"
;
$sql_connection
=
wxc_connectToMySQL
();
$daysSincePolled
=
$_POST
[
'daysSincePolled'
];
$addedToSql
=
wxc_putMySQL
(
"DELETE from node_info WHERE last_seen < DATE_SUB(NOW(), INTERVAL "
.
$daysSincePolled
.
" DAY)"
);
if
(
$addedToSql
=
1
)
{
$expired
=
mysqli_affected_rows
(
$sql_connection
);
echo
"<script>alert('Expired "
.
$expired
.
" Nodes.')</script>
\n
"
;
$_POST
=
array
();
}
}
}
?>
Write
Preview
Supports
Markdown
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