Fix DbUpdate not updating nntmux.xml properly

This commit is contained in:
DariusIII
2017-08-11 09:38:05 +02:00
parent 94841f40cb
commit cd6a8fb842
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
</last> </last>
</scripts> </scripts>
<sql> <sql>
<db>314</db> <db>315</db>
<file>315</file> <file>315</file>
</sql> </sql>
</versions> </versions>
+5 -3
View File
@@ -165,6 +165,8 @@ class DbUpdate
* numbers to order them. i.e. +1~settings.sql, +2~predb.sql, etc. * numbers to order them. i.e. +1~settings.sql, +2~predb.sql, etc.
* *
* @param array $options * @param array $options
*
* @throws \Exception
*/ */
public function newPatches(array $options = []) public function newPatches(array $options = [])
{ {
@@ -195,7 +197,7 @@ class DbUpdate
} else { } else {
echo $this->log->header('Processing patch file: ' . $file); echo $this->log->header('Processing patch file: ' . $file);
$this->splitSQL($file, ['local' => $local, 'data' => $options['data']]); $this->splitSQL($file, ['local' => $local, 'data' => $options['data']]);
$current = (integer)Settings::value('..sqlpatch'); $current = Settings::value('..sqlpatch');
$current++; $current++;
$this->pdo->queryExec("UPDATE settings SET value = '$current' WHERE setting = 'sqlpatch';"); $this->pdo->queryExec("UPDATE settings SET value = '$current' WHERE setting = 'sqlpatch';");
$newName = $matches['drive'] . $matches['path'] . $newName = $matches['drive'] . $matches['path'] .
@@ -248,7 +250,7 @@ class DbUpdate
$patch, $patch,
$matches) $matches)
) { ) {
$patch = (integer)$matches['patch']; $patch = (int)$matches['patch'];
} else { } else {
throw new \RuntimeException("No patch information available, stopping!!"); throw new \RuntimeException("No patch information available, stopping!!");
} }
@@ -259,7 +261,7 @@ class DbUpdate
} }
$this->splitSQL($file, ['local' => $local, 'data' => $data]); $this->splitSQL($file, ['local' => $local, 'data' => $data]);
if ($setPatch) { if ($setPatch) {
$this->pdo->queryExec("UPDATE settings SET value = '$patch' WHERE setting = 'sqlpatch';"); Settings::query()->where('setting', '=', 'sqlpatch')->update(['value' => $patch]);
} }
$patched++; $patched++;
} }