File: /srv/admin/htdocs/reloadapplication.php
<?php
require('_util.php');
define('RELOAD_MSG_SUCCESS', 'Your application is being reloaded.');
define('RELOAD_MSG_FAILED', 'Your application cannot be reloaded.');
function get_process_pid()
{
if (file_exists('/srv/run/nodejs/nodejs-watchd.pid')) {
return file_get_contents('/srv/run/nodejs/nodejs-watchd.pid');
} else if (file_exists('/srv/run/uwsgi/uwsgi.pid')) {
return file_get_contents('/srv/run/uwsgi/uwsgi.pid');
}
return false;
}
$reload_msg = RELOAD_MSG_FAILED;
$pid = get_process_pid();
if ($pid !== false && posix_kill($pid, 1) === true) {
$reload_msg = RELOAD_MSG_SUCCESS;
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo $reload_msg; ?></title>
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="<?= css_path(); ?>">
<link rel="shortcut icon" href="<?= favicon_path(); ?>">
</head>
<body>
<?php require(header_file()); ?>
<section id="main">
<h1><?php echo $reload_msg; ?></h1>
<p><a href="" title="Reload">Reload</a> again or go back to the <a href="/" title="Admin homepage">admin homepage</a>.</p>
</section>
<?php require(footer_file()); ?>
</body>
</html>