Fix schema validation and os def cache invalidation (#9789)

This commit is contained in:
Tony Murray
2019-02-06 10:53:25 -06:00
committed by GitHub
parent 86b820a11a
commit 61a48fbdd2
3 changed files with 8 additions and 17 deletions

View File

@@ -26,6 +26,7 @@
namespace LibreNMS\DB;
use LibreNMS\Config;
use LibreNMS\Util\Version;
use Symfony\Component\Yaml\Yaml;
use \Schema as LaravelSchema;
@@ -81,8 +82,7 @@ class Schema
*/
private static function getAppliedMigrations()
{
$db = Eloquent::DB()->table('migrations')->pluck('migration');
return $db;
return Eloquent::DB()->table('migrations')->pluck('migration');
}
/**
@@ -147,10 +147,11 @@ class Schema
{
$update_cache = true;
$cache_file = Config::get('install_dir') . "/cache/{$base}_relationships.cache";
$db_version = Version::get()->database();
if (is_file($cache_file)) {
$cache = unserialize(file_get_contents($cache_file));
if ($cache['version'] == get_db_schema()) {
if ($cache['version'] == $db_version) {
$update_cache = false; // cache is valid skip update
}
}
@@ -165,7 +166,7 @@ class Schema
}
$cache = [
'version' => get_db_schema(),
'version' => $db_version,
$base => $paths
];