public function installConfigFile() { $configFile = \Pimcore\Config::locateConfigFile('lucenesearch_configurations'); if (is_file($configFile . '.BACKUP')) { rename($configFile . '.BACKUP', $configFile . '.php'); return TRUE; } Configuration::set('frontend.index', 'website/var/search/frontend/index/'); Configuration::set('frontend.ignoreLanguage', FALSE); Configuration::set('frontend.ignoreCountry', TRUE); Configuration::set('frontend.ignoreRestriction', TRUE); Configuration::set('frontend.restriction.class', ''); Configuration::set('frontend.restriction.method', ''); Configuration::set('frontend.auth.useAuth', FALSE); Configuration::set('frontend.auth.username', ''); Configuration::set('frontend.auth.password', ''); Configuration::set('frontend.fuzzySearch', FALSE); Configuration::set('frontend.enabled', FALSE); Configuration::set('frontend.urls', array()); Configuration::set('frontend.validLinkRegexes', array()); Configuration::set('frontend.invalidLinkRegexesEditable', array()); Configuration::set('frontend.invalidLinkRegexes', '@.*\\.(js|JS|gif|GIF|jpg|JPG|png|PNG|ico|ICO|eps|jpeg|JPEG|bmp|BMP|css|CSS|sit|wmf|zip|ppt|mpg|xls|gz|rpm|tgz|mov|MOV|exe|mp3|MP3|kmz|gpx|kml|swf|SWF)$@'); Configuration::set('frontend.categories', array()); Configuration::set('frontend.allowedSchemes', array('http')); Configuration::set('frontend.ownHostOnly', FALSE); Configuration::set('frontend.crawler.maxLinkDepth', 15); Configuration::set('frontend.crawler.maxDownloadLimit', 0); Configuration::set('frontend.crawler.contentStartIndicator', ''); Configuration::set('frontend.crawler.contentEndIndicator', ''); Configuration::set('frontend.crawler.contentExcludeStartIndicator', ''); Configuration::set('frontend.crawler.contentExcludeEndIndicator', ''); Configuration::set('frontend.sitemap.render', FALSE); Configuration::set('frontend.view.maxPerPage', 10); Configuration::set('frontend.view.maxSuggestions', 10); Configuration::setCoreSettings(array('forceStart' => FALSE, 'forceStop' => FALSE, 'running' => FALSE, 'started' => FALSE, 'finished' => FALSE)); return TRUE; }
public function setSettingAction() { $values = \Zend_Json::decode($this->_getParam('data')); //general settings Configuration::set('frontend.enabled', FALSE); if (!Configuration::get('frontend.enabled') && $values['search.frontend.enabled']) { Configuration::set('frontend.enabled', TRUE); } Configuration::set('frontend.ignoreLanguage', FALSE); if ($values['frontend.ignoreLanguage']) { Configuration::set('frontend.ignoreLanguage', TRUE); } Configuration::set('frontend.ignoreCountry', FALSE); if ($values['frontend.ignoreCountry']) { Configuration::set('frontend.ignoreCountry', TRUE); } Configuration::set('frontend.ignoreRestriction', FALSE); Configuration::set('frontend.auth.useAuth', FALSE); Configuration::set('frontend.auth.username', ''); Configuration::set('frontend.auth.password', ''); Configuration::set('frontend.restriction.class', ''); Configuration::set('frontend.restriction.method', ''); if ($values['frontend.ignoreRestriction']) { Configuration::set('frontend.ignoreRestriction', TRUE); } else { if ($values['frontend.auth.useAuth']) { Configuration::set('frontend.auth.useAuth', TRUE); Configuration::set('frontend.auth.username', $values['frontend.auth.username']); Configuration::set('frontend.auth.password', $values['frontend.auth.password']); } Configuration::set('frontend.restriction.class', $values['frontend.restriction.class']); Configuration::set('frontend.restriction.method', $values['frontend.restriction.method']); } Configuration::set('frontend.fuzzySearch', FALSE); if ($values['frontend.fuzzySearch']) { Configuration::set('frontend.fuzzySearch', TRUE); } Configuration::set('frontend.ownHostOnly', FALSE); if ($values['frontend.ownHostOnly']) { Configuration::set('frontend.ownHostOnly', TRUE); } Configuration::set('frontend.sitemap.render', FALSE); if ($values['frontend.sitemap.render']) { Configuration::set('frontend.sitemap.render', TRUE); } if (is_numeric($values['frontend.crawler.maxLinkDepth'])) { Configuration::set('frontend.crawler.maxLinkDepth', (int) $values['frontend.crawler.maxLinkDepth']); } else { Configuration::set('frontend.crawler.maxLinkDepth', 15); } if (is_numeric($values['frontend.crawler.maxDownloadLimit'])) { Configuration::set('frontend.crawler.maxDownloadLimit', (int) $values['frontend.crawler.maxDownloadLimit']); } else { Configuration::set('frontend.crawler.maxDownloadLimit', 0); } //Frontend Urls must end with an trailing slash $_frontendUrls = $values['frontend.urls']; $frontendUrls = array(); if (is_array($_frontendUrls)) { foreach ($_frontendUrls as $seedUrl) { $frontendUrls[] = rtrim($seedUrl, '/') . '/'; } } Configuration::set('frontend.urls', $frontendUrls); Configuration::set('frontend.allowedSchemes', $values['frontend.allowedSchemes']); Configuration::set('frontend.categories', $values['frontend.categories']); Configuration::set('frontend.validLinkRegexes', $values['frontend.validLinkRegexes']); Configuration::set('frontend.invalidLinkRegexesEditable', $values['frontend.invalidLinkRegexesEditable']); Configuration::set('frontend.crawler.contentStartIndicator', $values['frontend.crawler.contentStartIndicator']); Configuration::set('frontend.crawler.contentEndIndicator', $values['frontend.crawler.contentEndIndicator']); Configuration::set('frontend.crawler.contentExcludeStartIndicator', $values['frontend.crawler.contentExcludeStartIndicator']); Configuration::set('frontend.crawler.contentExcludeEndIndicator', $values['frontend.crawler.contentExcludeEndIndicator']); if (is_numeric($values['frontend.view.maxPerPage'])) { Configuration::set('frontend.view.maxPerPage', (int) $values['frontend.view.maxPerPage']); } else { Configuration::set('frontend.view.maxPerPage', 10); } if (is_numeric($values['frontend.view.maxSuggestions'])) { Configuration::set('frontend.view.maxSuggestions', (int) $values['frontend.view.maxSuggestions']); } else { Configuration::set('frontend.view.maxSuggestions', 10); } $this->_helper->json(array('success' => TRUE)); }