Skip to content
Commits auf Quelle (4)
......@@ -20,7 +20,7 @@
<table name="cron_history">
<field type="INT(3) NOT NULL">cronid</field>
<field type="INT( 11 ) NOT NULL">uid</field>
<field type="VARCHAR(50) NOT NULL">uid</field>
<field type="DATETIME NOT NULL">lastexec</field>
<field type="DATETIME NULL DEFAULT NULl">finish</field>
......@@ -29,7 +29,7 @@
<table name="cron_cronservice">
<field type="INT(3) NOT NULL">cronid</field>
<field type="INT( 11 ) NOT NULL">uid</field>
<field type="VARCHAR(50) NOT NULL">uid</field>
<field type="DATETIME NOT NULL">lastexec</field>
<index>cronid</index>
......
......@@ -6,4 +6,5 @@
<event on="onCreateProject" fire="\QUI\Cron\EventHandler::onCreateProject"/>
<event on="onPackageInstallAfter" fire="\QUI\Cron\EventHandler::onPackageInstall"/>
<event on="onUpdateEnd" fire="\QUI\Cron\EventHandler::updateEnd"/>
<event on="onQuiqqerMigrationV2" fire="\QUI\Cron\EventHandler::onQuiqqerMigrationV2"/>
</events>
\ No newline at end of file
......@@ -8,6 +8,7 @@ namespace QUI\Cron;
use QUI;
use QUI\Exception;
use QUI\System\Console\Tools\MigrationV2;
use function explode;
use function str_replace;
......@@ -343,4 +344,33 @@ class EventHandler
return $createCrons;
}
public static function onQuiqqerMigrationV2(MigrationV2 $Console): void
{
$Console->writeLn('- Migrate cron history');
$count = (new Manager())->getHistoryCount();
if ($count > 100000) {
$Console->writeLn(
'cron history table has more than 100000 entries. skip the migration.
please have a look and empty or decimate the table if necessary.',
'red'
);
$Console->resetColor();
return;
}
QUI\Utils\MigrationV1ToV2::migrateUsers(
QUI::getDBTableName('cron_history'),
['uid'],
'cronid'
);
QUI\Utils\MigrationV1ToV2::migrateUsers(
QUI::getDBTableName('cron_cronservice'),
['uid'],
'cronid'
);
}
}
......@@ -466,7 +466,7 @@ class Manager
'cronid' => $cronId,
'lastexec' => date('Y-m-d H:i:s', $starTime),
'finish' => date('Y-m-d H:i:s'),
'uid' => QUI::getUserBySession()->getId() ?: 0
'uid' => QUI::getUserBySession()->getUUID() ?: 0
]);
......