Skip to content

Commit

Permalink
refs #39637, fixes cache api to prevent null expiry date, correct fro…
Browse files Browse the repository at this point in the history
…nt end testing
  • Loading branch information
jimyhuang committed Jun 8, 2024
1 parent da81b07 commit 02d65ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions CRM/Core/BAO/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static function &getItem($group, $path, $componentID = NULL, $createdTime = 0) {
$dao->group_name = $group;
$dao->path = $path;
$dao->component_id = $componentID;
$dao->whereAdd("expired_date >= NOW()");
if ($createdTime) {
if (is_numeric($createdTime)) {
$createdTime = CRM_Utils_Type::escape($createdTime, 'Positive');
Expand Down Expand Up @@ -246,7 +245,7 @@ static function storeSessionToCache($names, $resetSession = TRUE) {
foreach ($names as $key => $sessionName) {
if (is_array($sessionName)) {
if (!empty($_SESSION[$sessionName[0]][$sessionName[1]])) {
$expired = isset($_SESSION[$sessionName[0]][$sessionName[1]]['expired']) ? $_SESSION[$sessionName[0]][$sessionName[1]]['expired'] : NULL;
$expired = isset($_SESSION[$sessionName[0]][$sessionName[1]]['expired']) ? $_SESSION[$sessionName[0]][$sessionName[1]]['expired'] : CRM_REQUEST_TIME+86400;
self::setItem($_SESSION[$sessionName[0]][$sessionName[1]], 'CiviCRM Session', "{$sessionName[0]}_{$sessionName[1]}", NULL, $expired);
// CRM_Core_Error::debug_var( "session value for: {$sessionName[0]}_{$sessionName[1]}",
// $_SESSION[$sessionName[0]][$sessionName[1]] );
Expand All @@ -258,7 +257,7 @@ static function storeSessionToCache($names, $resetSession = TRUE) {
}
else {
if (!empty($_SESSION[$sessionName])) {
$expired = isset($_SESSION[$sessionName]) ? $_SESSION[$sessionName]['expired'] : NULL;
$expired = isset($_SESSION[$sessionName]['expired']) ? $_SESSION[$sessionName]['expired'] : CRM_REQUEST_TIME+86400;
self::setItem($_SESSION[$sessionName], 'CiviCRM Session', $sessionName, NULL, $expired);
// CRM_Core_Error::debug_var( "session value for: {$sessionName}",
// $_SESSION[$sessionName] );
Expand Down
2 changes: 1 addition & 1 deletion CRM/SMS/BAO/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function getProviders($selectArr = NULL, $filter = NULL, $getActiv
$dao->whereAdd("(domain_id = " . CRM_Core_Config::domainID() . " OR domain_id IS NULL)");
$dao->orderBy($orderBy);
$cacheId = md5(implode('|', $dao->_query));
$providers = CRM_Core_BAO_Cache::getItem('SMS Provider', $cacheId, NULL);
$providers = CRM_Core_BAO_Cache::getItem('SMS Provider', $cacheId, NULL, CRM_REQUEST_TIME-3600);
if (empty($providers)) {
$dao->find();
while ($dao->fetch()) {
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright/tests/edit_mailing.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ test.describe.serial('Mailing Editing', () => {
await test.step('Mailing Test.', async () => {

/* Step 1: open "New Mailing" page */
await page.goto('civicrm/mailing/send');
await page.goto('civicrm/mailing/send?reset=1');
await utils.wait(wait_secs);
await expect(page.locator('.crm-error')).toHaveCount(0);
await utils.findElement(page, 'form#Group');
Expand Down

0 comments on commit 02d65ca

Please sign in to comment.