ExtSearch/setup/d3_extsearch_update.php

602 lines
28 KiB
PHP

<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
namespace D3\Extsearch\setup;
use D3\Extsearch\Application\Model\d3_extsearch_synset;
use D3\ModCfg\Application\Model\d3database;
use D3\ModCfg\Application\Model\Install\d3install_updatebase;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\ParameterType;
use OxidEsales\Eshop\Core\Exception\ConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Application\Model\Shop;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* Class d3_extsearch_update
*/
class d3_extsearch_update extends d3install_updatebase
{
public $sModKey = 'd3_extsearch';
public $sModName = 'erweiterte Suche';
public $sModVersion = '8.0.1.0';
public $sModRevision = '8010';
public $sBaseConf = '02zv2==azlGUGNtK2VaQm5ucWIzUkV4QjM0M1NjRExra1VNM1B3TCsrWlVVbkVpWDNTYWRZYkZpbERWM
WlpYTFYcEhzdkt2UXJtazlhdFgwN2pRRFYzM000VFBpOTJLZlRFT1BIczlIREVydXIyVzk0eklCRGVFd
28vSXRnOTcwQzJQN2pxeHNQc0NIRzhLZjJ0OTExU0lOeDR2MzArdStLbERmcWI2a2VScTBTMVVlaHJEU
kl1R1ZpbzhjMS9HQ0ZUbTY5bkRJd0xBRHhweUl4S2trTW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SUyMjAlMjIlM0JzJTNBMzglM0ElMjJkM19jZmdfbW9kX19ibEV4dFNlYXJjaF91c2VBTGlzdEZpbHRlciUyMiUzQnMlM0ExJTNBJTIyMSUyMiUzQnMlM0E0NSUzQSUyMmQzX2NmZ19tb2RfX2JsRXh0U2VhcmNoX3VzZUF0dHJpYnV0ZUNvbWJpbmVPciUyMiUzQnMlM0ExJTNBJTIyMCUyMiUzQnMlM0EzOCUzQSUyMmQzX2NmZ19tb2RfX3NFeHRTZWFyY2hfb3JkZXJBdHRyaWJ1dGVzJTIyJTNCcyUzQTUlM0ElMjJveHBvcyUyMiUzQnMlM0E1MSUzQSUyMmQzX2NmZ19tb2RfX2JsRXh0U2VhcmNoX3VzZUF0dHJpYnV0ZVZhbHVlQ29tYmluZUFuZCUyMiUzQnMlM0ExJTNBJTIyMCUyMiUzQnMlM0E1MSUzQSUyMmQzX2NmZ19tb2RfX2JsRXh0U2VhcmNoX3Nob3dOb3RTZWxlY3RhYmxlQXR0cmlidXRlcyUyMiUzQnMlM0ExJTNBJTIyMCUyMiUzQnMlM0E0OSUzQSUyMmQzX2NmZ19tb2RfX2JsRXh0U2VhcmNoX2FqYXhTZWFyY2hMb2FkRnVsbE9iamVjdHMlMjIlM0JzJTNBMSUzQSUyMjAlMjIlM0IlN0Q=';
public $sMinModCfgVersion = '7.0.0.0';
protected $_aUpdateMethods = [
['check' => 'checkModCfgItemExist',
'do' => 'updateModCfgItemExist'],
['check' => 'checkRenameFields',
'do' => 'fixRenameFields'],
['check' => 'checkIndexRefreshMsg',
'do' => 'fixIndexRefreshMsg'],
['check' => 'checkAttribute2ObjectTableExist',
'do' => 'addAttribute2ObjectTable'],
['check' => 'checkStatisticTablesExist',
'do' => 'addStatisticTables'],
['check' => 'checkSynsetTablesExist',
'do' => 'addSynsetTables'],
['check' => 'checkFields',
'do' => 'fixFields'],
['check' => 'checkIndizes',
'do' => 'fixIndizes'],
['check' => 'checkUnsetSynsetTypes',
'do' => 'setInitialSynsetTypes'],
['check' => 'checkContentNoArtItemExist',
'do' => 'updateContentNoArtItemExist'],
['check' => 'hasModcfgMultilangSetting',
'do' => 'addModcfgMultilangSetting'],
['check' => 'checkModCfgSameRevision',
'do' => 'updateModCfgSameRevision'],
];
public $aFields = [
'D3_PHONETIC' => [
'sTableName' => 'oxartextends',
'sFieldName' => 'D3_PHONETIC',
'sType' => 'LONGTEXT',
'blNull' => false,
'sDefault' => false,
'sComment' => 'modExtSearch',
'sExtra' => '',
'blMultilang' => true,
],
'D3_SEARCHINDEXDATE' => [
'sTableName' => 'oxarticles',
'sFieldName' => 'D3_SEARCHINDEXDATE',
'sType' => 'DATETIME',
'blNull' => true,
'sDefault' => null,
'sComment' => 'modExtSearch',
'sExtra' => '',
'blMultilang' => true,
],
'D3PUSH' => [
'sTableName' => 'oxarticles',
'sFieldName' => 'D3PUSH',
'sType' => 'TINYINT(1)',
'blNull' => false,
'sDefault' => '1',
'sComment' => 'search sort criteria',
'sExtra' => '',
'blMultilang' => false,
],
'D3CONTENTHASH' => [
'sTableName' => 'oxarticles',
'sFieldName' => 'D3CONTENTHASH',
'sType' => 'CHAR(32)',
'blNull' => false,
'sDefault' => '',
'sComment' => 'extSearch: hashed search field content',
'sExtra' => '',
'blMultilang' => true,
],
'D3ISSEARCHABLE' => [
'sTableName' => 'oxcontents',
'sFieldName' => 'D3ISSEARCHABLE',
'sType' => 'TINYINT(1)',
'blNull' => false,
'sDefault' => '0',
'sComment' => 'modExtSearch',
'sExtra' => '',
'blMultilang' => false,
],
'D3NOTUSE4FILTER' => [
'sTableName' => 'oxattribute',
'sFieldName' => 'D3NOTUSE4FILTER',
'sType' => 'TINYINT(1)',
'blNull' => false,
'sDefault' => '0',
'sComment' => 'attrib use in extsearch',
'sExtra' => '',
'blMultilang' => false,
],
'D3USECORRESPONDINGVALUES' => [
'sTableName' => 'oxattribute',
'sFieldName' => 'D3USECORRESPONDINGVALUES',
'sType' => 'TINYINT(1)',
'blNull' => false,
'sDefault' => '0',
'sComment' => 'use synonyms in extsearch',
'sExtra' => '',
'blMultilang' => false,
],
'D3HIDESMALLFILTER' => [
'sTableName' => 'oxattribute',
'sFieldName' => 'D3HIDEONEITEMFILTER',
'sType' => 'TINYINT(1)',
'blNull' => false,
'sDefault' => '0',
'sComment' => 'hide filter with less than 2 items',
'sExtra' => '',
'blMultilang' => false,
],
'D3NOTUSE4FILTERCAT' => [
'sTableName' => 'oxcategories',
'sFieldName' => 'D3NOTUSE4FILTER',
'sType' => 'TINYINT(1)',
'blNull' => false,
'sDefault' => '0',
'sComment' => 'category use in extsearch',
'sExtra' => '',
'blMultilang' => false,
],
];
public $aIndizes = [];
public $aRenameFields = [
'D3_PHONETIC' => [
'sTableName' => 'oxarticles',
'mOldFieldNames' => ['d3_phonetic'], // is case sensitive
'sFieldName' => 'D3_PHONETIC',
'blMultilang' => true,
],
'D3_SEARCHINDEXDATE' => [
'sTableName' => 'oxarticles',
'mOldFieldNames' => ['d3_searchIndexDate'], // is case sensitive
'sFieldName' => 'D3_SEARCHINDEXDATE',
'blMultilang' => true,
],
'D3PUSH' => [
'sTableName' => 'oxarticles',
'mOldFieldNames' => ['d3push'], // is case sensitive
'sFieldName' => 'D3PUSH',
'blMultilang' => false,
],
'D3NOTUSE4FILTER' => [
'sTableName' => 'oxattribute',
'mOldFieldNames' => ['d3notuse4filter'], // is case sensitive
'sFieldName' => 'D3NOTUSE4FILTER',
'blMultilang' => false,
],
];
public array $aA2OFields = [];
public array $aA2OIndizes = [];
public array $aESSemanticTables = [];
public array $aESSemanticFields = [];
public array $aESSemanticIndizes = [];
public array $aESSemanticRenameFields = [];
public array $aESStatisticTables = [];
public array $aESStatisticFields = [];
public array $aESStatisticIndizes = [];
public array $aESStatisticRenameFields = [];
public array $aSemanticTables = [];
public array $aStatisticTables = [];
public $aOldModuleFiles = [
'd3/d3_extsearch/models/d3_extsearch_update.php',
];
protected $_aRefreshMetaModuleIds = ['d3_extsearch'];
/**
* constructor
*/
public function __construct()
{
require('d3_extsearch_semanticstructure.php');
require('d3_extsearch_statisticlog.php');
require('d3_extsearch_attribute2object.php');
parent::__construct();
}
/**
* @return bool
*/
public function checkIndexRefreshMsg(): bool
{
if (Registry::getSession()->getVariable('checkIndexRefreshMsg')) {
return true;
}
return false;
}
/**
* @return bool
*/
public function fixIndexRefreshMsg(): bool
{
$blRet = true;
if (Registry::getSession()->getVariable('checkIndexRefreshMsg')) {
Registry::getSession()->setVariable('checkIndexRefreshMsg', false);
$this->_confirmMessage('D3_EXTSEARCH_UPDATE_GENPHONETIC');
}
return $blRet;
}
/**
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
*/
public function checkContentNoArtItemExist(): bool
{
$blRet = false;
/** @var Shop $oShop */
foreach ($this->getShopList() as $oShop) {
$aWhere = [
'oxloadid' => 'd3extsearch_noarticlefound',
'oxshopid' => $oShop->getId(),
];
$blRet = $this->_checkTableItemNotExist('oxcontents', $aWhere);
if ($blRet) {
return $blRet;
}
}
return $blRet;
}
/**
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
* @throws ConnectionException
* @throws DatabaseErrorException
*/
public function updateContentNoArtItemExist(): bool
{
$blRet = false;
/** @var Shop $oShop */
foreach ($this->getShopList() as $oShop) {
$aWhere = [
'oxloadid' => 'd3extsearch_noarticlefound',
'oxshopid' => $oShop->getId(),
];
if ($this->_checkTableItemNotExist('oxcontents', $aWhere)) {
$aWhere = [];
$aInsertFields = [
[
'fieldname' => 'OXID',
'content' => "md5('d3extsearch_noarticlefound " . $oShop->getId() . "')",
'force_update' => true,
'use_quote' => false,
],
[
'fieldname' => 'OXLOADID',
'content' => "d3extsearch_noarticlefound",
'force_update' => true,
'use_quote' => true,
],
[
'fieldname' => 'OXSHOPID',
'content' => $oShop->getId(),
'force_update' => true,
'use_quote' => true,
],
[
'fieldname' => 'OXSNIPPET',
'content' => "1",
'force_update' => true,
'use_quote' => true,
],
[
'fieldname' => 'OXTYPE',
'content' => "0",
'force_update' => true,
'use_quote' => true,
],
[
'fieldname' => 'OXACTIVE',
'content' => "1",
'force_update' => false,
'use_quote' => true,
'use_multilang' => true,
],
[
'fieldname' => 'OXPOSITION',
'content' => "",
'force_update' => true,
'use_quote' => true,
],
[
'fieldname' => $this->_getLangAbbrFieldName('oxcontents', 'OXTITLE', 'de'),
'content' => "Leider wurden keine Artikel gefunden",
'force_update' => false,
'use_quote' => true,
'use_multilang' => true,
],
[
'fieldname' => 'OXCONTENT',
'content' => "<p>Versuchen Sie es mit einem anderen Suchbegriff, einer anderen ".
"Schreibweise oder anderen Filtern bitte noch einmal. </p><p>Erhalten Sie dennoch keine ".
"Ergebnisse, kontaktieren Sie uns bitte ".
"<a href=\"[{oxgetseourl ident=\$oViewConf->getSelfLink()|cat:\"cl=contact\"}]\">hier</a>.".
"</p><br />",
'force_update' => false,
'use_quote' => true,
'use_multilang' => true,
],
[
'fieldname' => $this->_getLangAbbrFieldName('oxcontents', 'OXTITLE', 'en'),
'content' => "Sorry, no items were found.",
'force_update' => false,
'use_quote' => true,
],
[
'fieldname' => 'OXCATID',
'content' => "kgo83a794223bfd23cbb091d0a34019d",
'force_update' => true,
'use_quote' => true,
],
[
'fieldname' => 'OXFOLDER',
'content' => "CMSFOLDER_USERINFO",
'force_update' => true,
'use_quote' => true,
],
];
$this->setInitialExecMethod(__METHOD__);
$blRet = $this->_updateTableItem2('oxcontents', $aInsertFields, $aWhere);
if ($this->getStepByStepMode()) {
break;
}
}
}
return $blRet;
}
/**
* @return bool true, if table is missing
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function checkStatisticTablesExist(): bool
{
foreach ($this->aStatisticTables as $aStatisticTable) {
if (($blRet = $this->_checkTableNotExist($aStatisticTable['sName']))) {
return $blRet;
}
}
return false;
}
/**
* @return bool
* @throws ConnectionException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function addStatisticTables(): bool
{
$this->setInitialExecMethod(__METHOD__);
$blDoRet = false;
foreach ($this->aStatisticTables as $aStatisticTable) {
if ($this->_checkTableNotExist($aStatisticTable['sName'])) {
if ($this->hasExecute()) {
$iCount = $this->getUpdateStepCount();
Registry::getSession()->setVariable('iD3UpdatebaseCount', $iCount + 1);
}
$blDoRet = $this->_addTable2(
$aStatisticTable['sName'],
$this->aFields,
$this->aIndizes,
$aStatisticTable['sComment'],
$aStatisticTable['sType']
);
if ($this->getUpdateBreak() || false == $blDoRet) {
return $blDoRet;
}
}
}
return $blDoRet;
}
/**
* @return bool true, if table is missing
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function checkAttribute2ObjectTableExist(): bool
{
return $this->_checkTableNotExist('d3extsearch_attribute2object');
}
/**
* @return bool
* @return bool
* @throws ConnectionException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function addAttribute2ObjectTable(): bool
{
$this->setInitialExecMethod(__METHOD__);
$blDoRet = false;
if ($this->checkAttribute2ObjectTableExist()) {
if ($this->hasExecute()) {
$iCount = $this->getUpdateStepCount();
Registry::getSession()->setVariable('iD3UpdatebaseCount', $iCount + 1);
}
$blDoRet = $this->_addTable2(
'd3extsearch_attribute2object',
$this->aFields,
$this->aIndizes,
'Shows many-to-many relationship between attributes and objects (table determined by oxtype)',
'InnoDb'
);
}
return $blDoRet;
}
/**
* @return bool true, if table is missing
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function checkSynsetTablesExist(): bool
{
foreach ($this->aSemanticTables as $aSemanticTable) {
if (($blRet = $this->_checkTableNotExist($aSemanticTable['sName']))) {
return $blRet;
}
}
return false;
}
/**
* @return bool
* @throws ConnectionException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function addSynsetTables(): bool
{
$this->setInitialExecMethod(__METHOD__);
$blDoRet = false;
foreach ($this->aSemanticTables as $aSemanticTable) {
if ($this->_checkTableNotExist($aSemanticTable['sName'])) {
if ($this->hasExecute()) {
$iCount = $this->getUpdateStepCount();
Registry::getSession()->setVariable('iD3UpdatebaseCount', $iCount + 1);
}
$blDoRet = $this->_addTable2(
$aSemanticTable['sName'],
$this->aFields,
$this->aIndizes,
$aSemanticTable['sComment'],
$aSemanticTable['sType']
);
if ( $this->getUpdateBreak() || ! $blDoRet ) {
return $blDoRet;
}
}
}
return $blDoRet;
}
/**
* @return bool // true, if there are unassigned synsets
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function checkUnsetSynsetTypes(): bool
{
$qb = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$qb->select('count(*)')
->from(oxNew(d3_extsearch_synset::class)->getCoreTableName())
->where(
$qb->expr()->in(1, ['USEFORTERMS', 'USEFORATTRIBUTES'])
);
$iUnassigned = (int) $qb->execute()->fetchOne();
$qb = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$qb->select('count(*)')
->from(oxNew(d3_extsearch_synset::class)->getCoreTableName());
$iTotal = (int) $qb->execute()->fetchOne();
return !$iUnassigned && $iTotal;
}
/**
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function setInitialSynsetTypes(): bool
{
if ($this->checkUnsetSynsetTypes()) {
$qb = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$qb->update(oxNew(d3_extsearch_synset::class)->getCoreTableName(), 't')
->set('t.USEFORTERMS', $qb->createNamedParameter(1, ParameterType::INTEGER));
if ($this->hasExecute()) {
try {
$qb->execute();
} catch (Exception $exception) {
$this->setErrorMessage($exception->getMessage());
}
}
$this->setUpdateBreak(false);
$this->setActionLog('SQL', d3database::getInstance()->getPreparedStatementQuery($qb->getSQL(), $qb->getParameters()), __METHOD__);
}
return true;
}
}