moduleDataSetup = $moduleDataSetup; $this->logger = $logger; } /** * @inheritdoc */ public function apply() { try { $this->cleanAdminUserSessionTable(); } catch (\Throwable $e) { $this->logger->warning( 'Security module SessionIDColumnCleanUp patch experienced an error and could not be completed.' . ' Please submit a support ticket or email us at security@magento.com.' ); return $this; } return $this; } /** * Remove session id from admin_user_session table. * * @throws \Zend_Db_Statement_Exception */ private function cleanAdminUserSessionTable() { $tableName = $this->moduleDataSetup->getTable('admin_user_session'); // phpcs:ignore Magento2.SQL.RawQuery $rawQuery = sprintf( 'UPDATE %s SET session_id = NULL WHERE session_id IS NOT NULL LIMIT 1000', $tableName ); $adapter = $this->moduleDataSetup->getConnection(); if ($adapter instanceof Mysql) { do { $result = $adapter->rawQuery($rawQuery)->rowCount(); } while ($result > 0); } else { do { $result = $adapter->query($rawQuery)->rowCount(); } while ($result > 0); } } /** * @inheritdoc */ public static function getDependencies() { return []; } /** * @inheritdoc */ public function getAliases() { return []; } }