Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
class CleanLogs
{
    public function execute($retentionPeriodInDays) {
        .....

        $logsTable = $this->connection->getTableName('index_invalidation_log');

        $this->connection->delete(
            $logsTable,
            "executed_at < date_sub(CURDATE(), INTERVAL ".$retentionPeriodInDays." Day)"
        );
    }
}

Adding $stackTraceId to InvalidationLog table

vendor/creativestyle/magesuite-index-invalidation-logger/Model/ResourceModel/InvalidationLog.php:28
Code Block
class InvalidationLog extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
    protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
    {
        $context = $object->getContext();
        $stackTrace = $context['stack_trace'];

        $stackTraceId = $this->stacktraceResourceModel->getStackTraceId($stackTrace);

        unset($context['stack_trace']);

        $object->setContext(json_encode($context));
        $object->setStacktraceId($stackTraceId);

        return parent::_beforeSave($object);
    }
}

vendor/creativestyle/magesuite-index-invalidation-logger/Model/ResourceModel/InvalidationLogStacktrace.php:14
Code Block
class InvalidationLogStacktrace extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
    public function getStackTraceId($stackTrace)
    {
        .....
        $stacktraceId = $this->getExistingStacktraceId($hash);
        .....
        $this->existingStackTracesIdsCache[$hash] = $stacktraceId;

        return $this->existingStackTracesIdsCache[$hash];
    }
}

Frontend

There are no frontend functionalities in the module.