mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 02:09:22 +02:00
Making sure clear the first page cache when it is requested
This commit is contained in:
parent
add1d4083a
commit
930b51e496
6 changed files with 58 additions and 35 deletions
|
@ -1492,33 +1492,11 @@ $(document).ready(function () {
|
|||
});
|
||||
$('#clearCache, .clearCacheButton').on('click', function (ev) {
|
||||
ev.preventDefault();
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'objects/configurationClearCache.json.php',
|
||||
success: function (response) {
|
||||
if (!response.error) {
|
||||
avideoToastSuccess("Your cache has been cleared!");
|
||||
} else {
|
||||
avideoAlert("Sorry!", "Your cache has NOT been cleared!", "error");
|
||||
}
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
clearCache(true, 0, 0);
|
||||
});
|
||||
$('.clearCacheFirstPageButton').on('click', function (ev) {
|
||||
ev.preventDefault();
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'objects/configurationClearCache.json.php?FirstPage=1',
|
||||
success: function (response) {
|
||||
if (!response.error) {
|
||||
avideoToastSuccess("Your First Page cache has been cleared!");
|
||||
} else {
|
||||
avideoAlert("Sorry!", "Your First Page cache has NOT been cleared!", "error");
|
||||
}
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
clearCache(true, 1, 0);
|
||||
});
|
||||
$('#generateSiteMap, .generateSiteMapButton').on('click', function (ev) {
|
||||
ev.preventDefault();
|
||||
|
@ -1595,6 +1573,25 @@ $(document).ready(function () {
|
|||
});
|
||||
});
|
||||
|
||||
function clearCache(showPleaseWait, FirstPage, sessionOnly){
|
||||
if(showPleaseWait){
|
||||
modal.showPleaseWait();
|
||||
}
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'objects/configurationClearCache.json.php?FirstPage='+FirstPage+'&sessionOnly='+sessionOnly,
|
||||
success: function (response) {
|
||||
if(showPleaseWait){
|
||||
if (!response.error) {
|
||||
avideoToastSuccess("Your First Page cache has been cleared!");
|
||||
} else {
|
||||
avideoAlert("Sorry!", "Your First Page cache has NOT been cleared!", "error");
|
||||
}
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validURL(str) {
|
||||
var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
|
||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
|
||||
|
@ -1926,4 +1923,9 @@ document.addEventListener('visibilitychange', function () {
|
|||
if (document.visibilityState === 'hidden') {
|
||||
_addViewAsync();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function socketClearSessionCache(json){
|
||||
console.log('socketClearSessionCache', json);
|
||||
clearCache(false, 0, 1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue