diff --git a/patches/uniqueIds.php b/patches/uniqueIds.php index 8b83912e559858f4473320e3a9c5cec5db1856e4..0a1ab6afd9177804ccbaa7f519f30fc79bfb95d2 100644 --- a/patches/uniqueIds.php +++ b/patches/uniqueIds.php @@ -6,13 +6,27 @@ // workaround for older patch $Bricks = QUI\Bricks\Manager::init(); + +// database table +$columns = QUI::getDataBase()->table()->getColumns($Bricks->getUIDTable()); +$columns = array_flip($columns); + +if (isset($columns['id'])) { + QUI::getDataBase()->table()->deleteColumn( + $Bricks->getUIDTable(), + 'id' + ); + + QUI::getPackage('quiqqer/bricks')->setup(); +} + $result = QUI::getDataBase()->fetch(array( 'count' => 'count', 'from' => $Bricks->getUIDTable(), )); // if unique ids already exist, the pages no longer have to be passed through -if (false && isset($result[0]) && isset($result[0]['count']) && $result[0]['count']) { +if (isset($result[0]) && isset($result[0]['count']) && $result[0]['count']) { echo 'Already executed'.PHP_EOL; return; diff --git a/src/QUI/Bricks/Events.php b/src/QUI/Bricks/Events.php index 9e2cc208c39d860c6f9f7b3ce87141ad4b4ab4ea..f09520db89fa486da65d1321a806d5c743d9dac9 100644 --- a/src/QUI/Bricks/Events.php +++ b/src/QUI/Bricks/Events.php @@ -219,5 +219,7 @@ public static function onPackageSetup(QUI\Package\Package $Package) if ($Package->getName() !== 'quiqqer/bricks') { return; } + + shell_exec('php '.OPT_DIR.'quiqqer/bricks/patches/uniqueIds.php'); } }