From c0ef15f56120366f75f41c2a4d1beb1da7146ab4 Mon Sep 17 00:00:00 2001 From: Casey Lucas Date: Fri, 14 Sep 2018 02:03:41 -0500 Subject: [PATCH] Fixed issue #13982 : (partial) some existing Yii cacche can not be used Dev: test existing method before use it. --- application/helpers/update/updatedb_helper.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/helpers/update/updatedb_helper.php b/application/helpers/update/updatedb_helper.php index 4c539102b76..e37b8f3d598 100644 --- a/application/helpers/update/updatedb_helper.php +++ b/application/helpers/update/updatedb_helper.php @@ -2383,9 +2383,12 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false) // Try to clear tmp/runtime (database cache files). // Related to problems like https://bugs.limesurvey.org/view.php?id=13699. - if (!(defined('YII_DEBUG') && YII_DEBUG)) { + // Some cache implementations may not have 'flush' method. Only call flush if method exists. + if (method_exists(Yii::app()->cache, 'flush')) { Yii::app()->cache->flush(); - // NB: CDummyCache does not have a gc method (used if debug > 0). + } + // Some cache implementations (ex: CRedisCache, CDummyCache) may not have 'gc' method. Only call gc if method exists. + if (method_exists(Yii::app()->cache, 'gc')) { Yii::app()->cache->gc(); }