Skip to content

Commit 79fe837

Browse files
committed
change reset cache
1 parent 9ebe71c commit 79fe837

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

system/Database/BaseConnection.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ public function tableExists(string $tableName, bool $cached = true): bool
14201420
return false;
14211421
}
14221422

1423-
$result = $this->query($sql)->getResultArray() !== [];
1423+
$tableExists = $this->query($sql)->getResultArray() !== [];
14241424

14251425
// if cache has been built already
14261426
if (! empty($this->dataCache['table_names'])) {
@@ -1430,18 +1430,13 @@ public function tableExists(string $tableName, bool $cached = true): bool
14301430
true
14311431
);
14321432

1433-
// remove from cache
1434-
if ($key !== false) {
1435-
unset($this->dataCache['table_names'][$key]);
1436-
}
1437-
1438-
// if exists add back to cache (if cache has been built already)
1439-
if ($result) {
1440-
$this->dataCache['table_names'][] = strtolower($tableName);
1433+
// table doesn't exist but still in cache - lets reset cache, it can be rebuilt later
1434+
if ($key !== false && ! $tableExists) {
1435+
$this->resetDataCache();
14411436
}
14421437
}
14431438

1444-
return $result;
1439+
return $tableExists;
14451440
}
14461441

14471442
/**

0 commit comments

Comments
 (0)