Rerun setup action centre if installing a deprecated plugin

This commit is contained in:
Squidly271 2022-05-07 09:12:43 -04:00
parent ad9ba81448
commit 5d9cb81591
4 changed files with 24 additions and 4 deletions

View File

@ -158,6 +158,8 @@ data.searchFlag = false;
data.searchActive = false; // Sets whether changepage re-sorts the displayed templates.
data.previousAppsSection = ""; // The section the user is on within previous apps
data.searchInProgress = false;
data.deprecated = false; // Only set by reinstalling a deprecated plugin
var dockerNotEnabled;
var postCount = 0;
var cookieWarning = false;
@ -1114,6 +1116,7 @@ function closeSidebar(cookie=false,visible=false) {
}
function installPlugin(pluginURL,update=false,comment="") {
alert(pluginURL);
type = update ? "update" : "install";
title = update ? "<?tr("Update Plugin")?>" : "<?tr("Install Plugin")?>";
closeSidebar(true);
@ -1137,6 +1140,11 @@ function installPlugin(pluginURL,update=false,comment="") {
} else {
var postFunction = "OpenSidebarAndRefreshDisplay";
}
data.deprecated = false; // global var here to trigger a rescan of action centre
if ( pluginURL.includes("&deprecated") ) {
data.deprecated = true;
pluginURL.replace("&deprecated","");
}
openBox('/plugins/community.applications/scripts/pluginInstall.php&arg1='+type+'&arg2='+pluginURL,title,600,900,true,postFunction);
} else {
enableSearch();
@ -1148,6 +1156,11 @@ function installPlugin(pluginURL,update=false,comment="") {
} else {
var postFunction = "OpenSidebarAndRefreshDisplay";
}
data.deprecated = false; // global var here to trigger a rescan of action centre
if ( pluginURL.includes("&deprecated") ) {
data.deprecated = true;
pluginURL.replace("&deprecated","");
}
openBox('/plugins/community.applications/scripts/pluginInstall.php&arg1='+type+'&arg2='+pluginURL,title,600,900,true,postFunction);
}
@ -1167,6 +1180,11 @@ function OpenSidebarAndRefreshDisplay() {
if ( $.trim(apppath) ) {
showSidebarApp(apppath,appname);
}
if ( data.deprecated ) {
data.deprecated = false;
setupActionCentre();
}
}
});
}

View File

@ -1,4 +1,4 @@
27e83831482abd3f3a30551ff06ada98 ./Apps.page
7f92a472f8e7bc8fc51db9778abc9ed5 ./Apps.page
4e55f7483b661af21a25b677179baffe ./CA_notices.page
42a1658a916a3a3eed2a9f2af80603c4 ./ca_settings.page
e718d7825dbdc96a17a915079222b098 ./default.cfg
@ -21,4 +21,4 @@ da3b4f9b73c5c3bf65be6c42d68b51f9 ./scripts/showStatistics.php
34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php
ce8e45452d3b63b5943b6f39c817bbf9 ./skins/Narrow/css.php
c4d6ce8de3baff1c9de2b7f348b2f340 ./skins/Narrow/skin.html
07b1886782ee6418f82e0724d6ba8f6f ./skins/Narrow/skin.php
484b42f519e72726c857a9c9d19954d1 ./skins/Narrow/skin.php

View File

@ -235,7 +235,8 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
}
if ( ! $template['RequiresFile'] || ($template['RequiresFile'] && is_file($template['RequiresFile'])) ) {
$installComment = $template['RequiresFile'] ? "" : $installComment;
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>$buttonTitle,"action"=>"installPlugin('{$template['PluginURL']}','','".str_replace([" ","\n"],["&#32;",""],htmlspecialchars($installComment))."');");
$isDeprecated = $template['Deprecated'] ? "&deprecated" : "";
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>$buttonTitle,"action"=>"installPlugin('{$template['PluginURL']}$isDeprecated','','".str_replace([" ","\n"],["&#32;",""],htmlspecialchars($installComment))."');");
}
if ( $template['InstallPath'] ) {
if ( ! empty($actionsContext) )
@ -662,7 +663,8 @@ function getPopupDescriptionSkin($appNumber) {
if ( !$template['Deprecated'] || $caSettings['hideDeprecated'] !== "true" ) {
if ( ($template['RequiresFile'] && is_file($template['RequiresFile']) ) || ! $template['RequiresFile'] ) {
$buttonTitle = $template['InstallPath'] ? tr("Reinstall") : tr("Install");
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>$buttonTitle,"action"=>"installPlugin('{$template['PluginURL']}');");
$isDeprecated = $template['Deprecated'] ? "&deprecated" : "";
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>$buttonTitle,"action"=>"installPlugin('{$template['PluginURL']}$isDeprecated');");
}
}
}