Skip to content

Commit

Permalink
pkp#6457 Disentangle beacon enable/disable from upgrade warning
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Dec 9, 2020
1 parent 538dc7a commit b32509e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
22 changes: 12 additions & 10 deletions pages/admin/AdminHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,18 @@ function initialize($request) {
]);
}

if (Config::getVar('general', 'show_upgrade_warning')) {
import('lib.pkp.classes.site.VersionCheck');
if ($latestVersion = VersionCheck::checkIfNewVersionExists()) {
$currentVersion = VersionCheck::getCurrentDBVersion();
$templateMgr->assign([
'currentVersion' => $currentVersion,
'newVersionAvailable' => true,
'latestVersion' => $latestVersion,
]);
}
// Interact with the beacon (if enabled) and determine if a new version exists
import('lib.pkp.classes.site.VersionCheck');
$latestVersion = VersionCheck::checkIfNewVersionExists();

// Display a warning message if there is a new version of OJS available
if (Config::getVar('general', 'show_upgrade_warning') && $latestVersion) {
$currentVersion = VersionCheck::getCurrentDBVersion();
$templateMgr->assign([
'newVersionAvailable' => true,
'currentVersion' => $currentVersion,
'latestVersion' => $latestVersion,
]);
}

return parent::initialize($request);
Expand Down
29 changes: 16 additions & 13 deletions pages/management/ManagementHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,23 @@ function context($args, $request) {
],
]);

// Interact with the beacon (if enabled) and determine if a new version exists
import('lib.pkp.classes.site.VersionCheck');
$latestVersion = VersionCheck::checkIfNewVersionExists();

// Display a warning message if there is a new version of OJS available
if (Config::getVar('general', 'show_upgrade_warning')) {
import('lib.pkp.classes.site.VersionCheck');
if ($latestVersion = VersionCheck::checkIfNewVersionExists()) {
$templateMgr->assign('newVersionAvailable', true);
$templateMgr->assign('latestVersion', $latestVersion);
$currentVersion = VersionCheck::getCurrentDBVersion();
$templateMgr->assign('currentVersion', $currentVersion->getVersionString());

// Get contact information for site administrator
$roleDao = DAORegistry::getDAO('RoleDAO'); /* @var $roleDao RoleDAO */
$siteAdmins = $roleDao->getUsersByRoleId(ROLE_ID_SITE_ADMIN);
$templateMgr->assign('siteAdmin', $siteAdmins->next());
}
if (Config::getVar('general', 'show_upgrade_warning') && $latestVersion) {
$currentVersion = VersionCheck::getCurrentDBVersion();
$templateMgr->assign([
'newVersionAvailable' => true,
'currentVersion' => $currentVersion->getVersionString()
'latestVersion' => $latestVersion,
]);

// Get contact information for site administrator
$roleDao = DAORegistry::getDAO('RoleDAO'); /* @var $roleDao RoleDAO */
$siteAdmins = $roleDao->getUsersByRoleId(ROLE_ID_SITE_ADMIN);
$templateMgr->assign('siteAdmin', $siteAdmins->next());
}

AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION);
Expand Down

0 comments on commit b32509e

Please sign in to comment.