openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 21d761f1d1a7f22907a1a4631a51d24aeb96d4af
parent ae2e6ee7ca6affd6440dfa26e49af73860d84cf2
Author: Jan Dankert <develop@jandankert.de>
Date:   Mon,  8 Nov 2021 01:05:56 +0100

Fix: Do not update all rows with the content id :-O

Diffstat:
Mmodules/cms/update/version/DBVersion000030.class.php | 8++++----
Mmodules/cms/update/version/DBVersion000031.class.php | 2+-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/cms/update/version/DBVersion000030.class.php b/modules/cms/update/version/DBVersion000030.class.php @@ -27,17 +27,17 @@ class DBVersion000030 extends DbVersion $templateModelTable->column('contentid')->add(); $db = $this->getDb(); - $stmt = $db->sql('SELECT * FROM '.$templateModelTable->getSqlName().'' ); + $stmt = $db->sql('SELECT * FROM '.$templateModelTable->getSqlName() ); foreach($stmt->getAll() as $row ) // all templates should fit into memory. { - $stmt = $db->sql('SELECT MAX(id) FROM '.$contentTable->getSqlName().''); + $stmt = $db->sql('SELECT MAX(id) FROM '.$contentTable->getSqlName()); $contentid = $stmt->getOne() + 1; $stmt = $db->sql('INSERT INTO '.$contentTable->getSqlName().' (id) VALUES('.$contentid.')') ; $stmt->execute(); - $stmt = $db->sql('SELECT MAX(id) FROM '.$valueTable->getSqlName().''); + $stmt = $db->sql('SELECT MAX(id) FROM '.$valueTable->getSqlName()); $valueid = $stmt->getOne() + 1; $stmt = $db->sql('INSERT INTO '.$valueTable->getSqlName().' (id,contentid,active,publish,text,lastchange_date) VALUES('.$valueid.','.$contentid.',1,1,{text},{time})'); @@ -45,7 +45,7 @@ class DBVersion000030 extends DbVersion $stmt->setInt ( 'time', Startup::getStartTime() ); $stmt->execute(); - $stmt = $db->sql('UPDATE '.$templateModelTable->getSqlName().' SET contentid='.$contentid); + $stmt = $db->sql('UPDATE '.$templateModelTable->getSqlName().' SET contentid='.$contentid.' WHERE id='.$row['id']); $stmt->execute(); } diff --git a/modules/cms/update/version/DBVersion000031.class.php b/modules/cms/update/version/DBVersion000031.class.php @@ -48,7 +48,7 @@ class DBVersion000031 extends DbVersion $stmt->setInt ( 'time', Startup::getStartTime() ); $stmt->execute(); - $stmt = $db->sql('UPDATE '.$fileTable->getSqlName().' SET contentid='.$contentid); + $stmt = $db->sql('UPDATE '.$fileTable->getSqlName().' SET contentid='.$contentid.' WHERE id='.$row['id']); $stmt->execute(); }