Skip to content

Commit 7e5a141

Browse files
Avoid errors when trying to lock config if database is not yet available (#4603)
1 parent eb0e774 commit 7e5a141

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/code/core/Mage/Core/Model/Config.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,9 @@ public function getCacheSaveLock($waitTime = null, $ignoreFailure = false)
526526
}
527527
$waitTime = $waitTime ?: (getenv('MAGE_CONFIG_CACHE_LOCK_WAIT') ?: (PHP_SAPI === 'cli' ? 60 : 3));
528528
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
529+
if (!$connection) {
530+
return;
531+
}
529532
if (!$connection->fetchOne("SELECT GET_LOCK('core_config_cache_save_lock', ?)", [$waitTime])) {
530533
if ($ignoreFailure) {
531534
return;
@@ -550,6 +553,9 @@ public function releaseCacheSaveLock()
550553
return;
551554
}
552555
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
556+
if (!$connection) {
557+
return;
558+
}
553559
$connection->fetchOne("SELECT RELEASE_LOCK('core_config_cache_save_lock')");
554560
}
555561

0 commit comments

Comments
 (0)