first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

68
admin/fulltext.php Normal file
View File

@@ -0,0 +1,68 @@
<?php
use KupShop\CatalogBundle\Search\FulltextInterface;
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
$main_class = 'fulltext';
class fulltext extends Window
{
use \KupShop\AdminBundle\FulltextUpdatesTrait;
public function get_vars()
{
$vars = parent::get_vars();
/** @var FulltextInterface $fulltext */
$fulltext = ServiceContainer::getService(FulltextInterface::class);
$vars['synonyms'] = $fulltext->loadSynonyms();
$vars['support'] = true;
return $vars;
}
public function handle()
{
if (!getVal('Submit') && !getVal('Reindex')) {
return;
}
/** @var FulltextInterface $fulltext */
$fulltext = ServiceContainer::getService(FulltextInterface::class);
$data = $this->getData();
$synonyms = [];
foreach ($data as $line) {
if (!empty($line['from']) && !empty($line['to']) && !key_exists('delete', $line)) {
$synonyms[] = $line;
}
}
$fulltext->updateSynonyms($synonyms);
if (getVal('Reindex')) {
ini_set('max_execution_time', 500);
try {
$this->updateIndices();
} catch (\KupShop\CatalogBundle\Search\Exception\FulltextException $e) {
getRaven()->captureException($e);
$this->returnError('Nastala chyba při generování vyhledávácího indexu');
}
}
$this->handleTabs(true);
$this->returnOK();
}
public function hasRights($name = null)
{
switch ($name) {
case Window::RIGHT_DUPLICATE:
case Window::RIGHT_DELETE:
return false;
default:
return parent::hasRights($name);
}
}
}