mirror of
https://github.com/UnickSoft/graphonline.git
synced 2026-02-16 02:30:51 +00:00
Added admin page to update script caches.
This commit is contained in:
41
tpl/admin/pack.php
Normal file
41
tpl/admin/pack.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php if (!isset($_GET["cacheFiles"]) && isset($_GET["target"])): ?>
|
||||
<head>
|
||||
<script src="/script/shared/config.js" ></script>
|
||||
<script src="/script/shared/loader.js" ></script>
|
||||
<script src="<?= $_GET["target"] ?>" ></script>
|
||||
<script>
|
||||
setTimeout(
|
||||
() => {
|
||||
document.getElementById("state").innerHTML = "Saving files";
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "pack?cacheFiles=" + moduleLoader.syncLoaded.toString() + "&target=" + "<?= $_GET["target"] ?>");
|
||||
xhr.send();
|
||||
xhr.onload = () => {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
document.getElementById("state").innerHTML = "Finished <br>";
|
||||
document.getElementById("other_page").innerHTML = xhr.response;
|
||||
} else {
|
||||
document.getElementById("state").innerHTML = "Error happends";
|
||||
}
|
||||
};
|
||||
}, 3000);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<h1>Update script cache</h1>
|
||||
|
||||
<h2>State: <span id="state">Loading</span></h2>
|
||||
<p id="other_page"></p>
|
||||
</div>
|
||||
</doby>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if (!isset($_GET["target"])) {
|
||||
echo ("Error target is not set");
|
||||
return;
|
||||
}
|
||||
?>
|
||||
13
tpl/admin/page_update_script_cache.php
Normal file
13
tpl/admin/page_update_script_cache.php
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
<?php IncludeCom('dev/bootstrap3')?>
|
||||
|
||||
<h1>Update script cache</h1>
|
||||
<p>Click to each link to update cache. Don't forget change $g_config['engine_version'] version in file /core/config/main.php</p>
|
||||
<ul>
|
||||
<?php
|
||||
foreach ($cacheList as &$page) {
|
||||
$date = date('d.m.Y H:i:s', filemtime("./$page.cache"));
|
||||
echo ("<li><a href='pack?target=$page' target='_blank'>$page</a> $date</li>");
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
Reference in New Issue
Block a user