Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1872 - Admin - Install Module - "Back to Module Loader" shows page with header only #10389

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 34 additions & 9 deletions modules/Administration/UpgradeHistory.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<?php
if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}

/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2018 SalesAgility Ltd.
* Copyright (C) 2011 - 2024 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
Expand Down Expand Up @@ -41,9 +39,9 @@
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/




if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}

// The history of upgrades on the system
#[\AllowDynamicProperties]
Expand Down Expand Up @@ -196,8 +194,8 @@ public function UninstallAvailable($patch_list, $patch_to_check)
//or the unique_keys do not match
$patch_to_check_backup_path = clean_path(remove_file_extension(from_html($patch_to_check->filename))).'-restore';
$more_recent_patch_backup_path = clean_path(remove_file_extension(from_html($more_recent_patch->filename))).'-restore';
$patch_to_check_timestamp = TimeDate::getInstance()->fromUser($patch_to_check->date_entered)->getTimestamp();
$more_resent_patch_timestamp = TimeDate::getInstance()->fromUser($more_recent_patch->date_entered)->getTimestamp();
$patch_to_check_timestamp = $this->getPackageTimestamp($this->getPackageDateString($patch_to_check));
$more_resent_patch_timestamp = $this->getPackageTimestamp($this->getPackageDateString($more_recent_patch));
if (
$this->foundConflict($patch_to_check_backup_path, $more_recent_patch_backup_path) &&
($more_resent_patch_timestamp >= $patch_to_check_timestamp)
Expand Down Expand Up @@ -305,4 +303,31 @@ public function retrieve($id = -1, $encode=true, $deleted=true)
{
return parent::retrieve($id, $encode, false); //ignore the deleted filter. the table does not have the deleted column in it.
}

/**
* Returns correct string for getting timestamp if the package has just been installed;
* @param UpgradeHistory $bean
* @return string
*/
protected function getPackageDateString(UpgradeHistory $bean): string
{
global $timedate;

if (!$bean->date_entered) {
return $timedate->to_display_date_time($bean->date_modified);
}

return $bean->date_entered;
}

/**
* Handler to get timestamp if the package has just been installed;
* @param $date
* @return int
*/
protected function getPackageTimestamp($date): int
{
global $timedate;
return $timedate->fromUser($date)->getTimestamp();
}
}