Skip to content

Commit

Permalink
reset_module removed and moved into
Browse files Browse the repository at this point in the history
  • Loading branch information
juggernautsei committed May 22, 2024
1 parent eb74f87 commit 3654cce
Showing 1 changed file with 9 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,43 +122,18 @@ private function disable($modId, $currentActionStatus): mixed
* @param $currentActionStatus
* @return mixed
*/
private function unregister($modId, $currentActionStatus): mixed
private function unregister($currentActionStatus): mixed
{
$logMessage = ''; // Initialize an empty string to store log messages
$sql = "DELETE FROM `background_services` WHERE `name` = ? OR `name` = ? OR `name` = ?";
sqlQuery($sql, array('ClaimRev_Send', 'ClaimRev_Receive', 'ClaimRev_Elig_Send_Receive'));
return $currentActionStatus;
}

/**
* @param $modId
* @param $currentActionStatus
* @return mixed
*/
private function reset_module($modId, $currentActionStatus): mixed
{
$logMessage = ''; // Initialize an empty string to store log messages
if (!self::getModuleState($modId)) {

$sql = "DELETE FROM `globals` WHERE `gl_name` LIKE 'oe_claimrev%'";
$rtn = sqlQuery($sql);
$logMessage .= "DELETE FROM `globals`: " . (empty($rtn) ? "Success" : "Failed") . "\n";

$sql = "DROP TABLE IF EXISTS `mod_claimrev_eligibility`";
$rtn = sqlQuery($sql);
$logMessage .= "DROP TABLE `mod_claimrev_eligibility`: " . (empty($rtn) ? "Success" : "Failed") . "\n";

error_log(text($logMessage));
}
$sql = "DELETE FROM `globals` WHERE `gl_name` LIKE 'oe_claimrev%'";
$rtn = sqlQuery($sql);
$logMessage .= "DELETE FROM `globals`: " . (empty($rtn) ? "Success" : "Failed") . "\n";

// return log messages to the MM to show user.
return text($logMessage);
}

public static function getModuleState($modId): bool
{
$sql = "SELECT `mod_active` FROM `modules` WHERE `mod_id` = ? OR `mod_directory` = ?";
$flag = sqlQuery($sql, array($modId, $modId));

return !empty($flag['mod_active']);
$sql = "DROP TABLE IF EXISTS `mod_claimrev_eligibility`";
$rtn = sqlQuery($sql);
$logMessage .= "DROP TABLE `mod_claimrev_eligibility`: " . (empty($rtn) ? "Success" : "Failed") . "\n";
return $currentActionStatus;
}
}

0 comments on commit 3654cce

Please sign in to comment.