Rewrite towns support for TFS 1.3

Won't show warning anymore

(cherry picked from commit cd58008a0f667e97122d6c0e3b164df7979ade3f)
This commit is contained in:
slawkens 2020-05-25 00:09:06 +02:00
parent af3a1c2f55
commit 5fcd97129e

View File

@ -180,7 +180,8 @@ else {
// load towns from database (TFS 1.3) // // load towns from database (TFS 1.3) //
//////////////////////////////////////// ////////////////////////////////////////
$towns = array(); $tmp = '';
$towns = [];
if($cache->enabled() && $cache->fetch('towns', $tmp)) { if($cache->enabled() && $cache->fetch('towns', $tmp)) {
$towns = unserialize($tmp); $towns = unserialize($tmp);
} }
@ -197,16 +198,13 @@ else {
$cache->set('towns', serialize($towns), 600); $cache->set('towns', serialize($towns), 600);
} }
} }
else if($cache->enabled()) { else {
$cache->set('towns', serialize(array()), 600); $towns = config('towns');
} }
}
$configTowns = config('towns'); if($cache->enabled()) {
if($configTowns !== null && (!isset($configTowns[1]) || $configTowns[1] !== 'Sample town')) { $cache->set('towns', serialize($towns), 600);
$towns = array_replace( }
$towns, $configTowns
);
} }
config(['towns', $towns]); config(['towns', $towns]);