本文整理汇总了PHP中Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions方法的具体用法?PHP Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions怎么用?PHP Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Search_Lucene_Storage_Directory_Filesystem
的用法示例。
在下文中一共展示了Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor to set initial values.
*
* @param string $location The index location
*/
public function __construct($location)
{
$this->location = $location;
$this->analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive();
require_once 'Zend/Search/Lucene/Storage/Directory/Filesystem.php';
Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0666);
}
示例2: getInstance
/**
* Returns Zend_Search_Lucene instance for given subroot
*
* every subroot has it's own instance
*
* @param Kwf_Component_Data for this index
* @return Zend_Search_Lucene_Interface
*/
public static function getInstance(Kwf_Component_Data $subroot)
{
while ($subroot) {
if (Kwc_Abstract::getFlag($subroot->componentClass, 'subroot')) {
break;
}
$subroot = $subroot->parent;
}
if (!$subroot) {
$subroot = Kwf_Component_Data_Root::getInstance();
}
static $instance = array();
if (!isset($instance[$subroot->componentId])) {
$analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive();
$analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_ShortWords(2));
//$stopWords = explode(' ', 'der dir das einer eine ein und oder doch ist sind an in vor nicht wir ihr sie es ich');
//$analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords));
Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0666);
$path = 'cache/fulltext';
$path .= '/' . $subroot->componentId;
try {
$instance[$subroot->componentId] = Zend_Search_Lucene::open($path);
} catch (Zend_Search_Lucene_Exception $e) {
$instance[$subroot->componentId] = Zend_Search_Lucene::create($path);
}
}
return $instance[$subroot->componentId];
}
示例3: __construct
function __construct($directory, $lang = 'en', $highlight = true)
{
switch ($lang) {
case 'en':
default:
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new StandardAnalyzer_Analyzer_Standard_English());
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('UTF-8');
}
Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0660);
$this->directory = $directory;
$this->lastModif = file_exists($directory) ? filemtime($directory) : 0;
$this->highlight = (bool) $highlight;
}
示例4: prepareZendSearchLucene
private static function prepareZendSearchLucene()
{
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
$stopWords = sfConfig::get('app_sf_propel_luceneable_behavior_stopWords', false);
$stopWordsFilter = new Zend_Search_Lucene_Analysis_TokenFilter_StopWords(false === $stopWords ? array() : explode(',', $stopWords));
Zend_Search_Lucene_Analysis_Analyzer::getDefault()->addFilter($stopWordsFilter);
$shortWords = sfConfig::get('app_sf_propel_luceneable_behavior_shortWords', 3);
$shortWordsFilter = new Zend_Search_Lucene_Analysis_TokenFilter_ShortWords($shortWords);
Zend_Search_Lucene_Analysis_Analyzer::getDefault()->addFilter($shortWordsFilter);
Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0777);
}
示例5: __construct
/**
* Indexer Constructor.
*
* @global type $webDir
*/
public function __construct()
{
global $webDir;
if (!get_config('enable_indexing')) {
return;
}
$index_path = $webDir . self::$_index_dir;
// Give read-writing permissions only for current user and group
Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0600);
// Utilize UTF-8 compatible text analyzer
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
try {
if (file_exists($index_path)) {
$this->__index = Zend_Search_Lucene::open($index_path);
// Open index
} else {
$this->__index = Zend_Search_Lucene::create($index_path);
// Create index
}
} catch (Zend_Search_Lucene_Exception $e) {
require_once 'fatal_error.php';
}
$this->__index->setFormatVersion(Zend_Search_Lucene::FORMAT_2_3);
// Set Index Format Version
Zend_Search_Lucene::setResultSetLimit(self::$_resultSetLimit);
// Set Result Set Limit
// write an .htaccess to prevent raw access to index files
$htaccess = $index_path . '/.htaccess';
if (!file_exists($htaccess)) {
$fd = fopen($htaccess, "w");
fwrite($fd, "deny from all\n");
fclose($fd);
}
if (!file_exists($index_path . '/index.php')) {
touch($index_path . '/index.php');
}
}
示例6: _index
/**
* Instanciate the Lucene index
*
* The index will be created if it doesn't exist yet.
*
* @return \Zend_Search_Lucene_Interface Lucene index instance
* @throws Exception If the index cannot be created
*/
protected function _index()
{
// One-time instanciation or creation of the lucene index
if ($this->_index === null) {
// Try to instanciate an existing lucene index
try {
$this->_index = \Zend_Search_Lucene::open($this->_indexDirectory);
// If an error occurs ...
} catch (\Zend_Search_Lucene_Exception $e) {
// Try to create a new lucene index ...
try {
$this->_index = \Zend_Search_Lucene::create($this->_indexDirectory);
// If an error occurs: Failure
} catch (\Zend_Search_Lucene_Exception $e) {
throw new Exception(sprintf('Error creating lucene index in "%1$s", reason: "%2$s"', $this->_indexDirectory, $e->getMessage()));
}
}
// Index setup
\Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0664);
\Zend_Search_Lucene_Analysis_Analyzer::setDefault(new \Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
\Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('UTF-8');
// Minimize memory consumption
$this->_index->setMaxBufferedDocs(1);
// Set optimization frequency
$this->_index->setMergeFactor(max(1, intval($GLOBALS['TYPO3_CONF_VARS']['EXT']['extParams']['tw_lucenesearch']['mergeFactor'])));
// If applicable: Optimize index
if ($this->_indexOptimize) {
$this->_index->optimize();
}
$this->_index->commit();
if (TYPO3_MODE == 'FE') {
\Zend_Search_Lucene::setTermsPerQueryLimit(\Tollwerk\TwLucenesearch\Utility\Indexer::indexConfig($GLOBALS['TSFE'], 'search.limits.query'));
}
}
return $this->_index;
}
示例7: getIndex
private function getIndex()
{
global $prefs;
Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0660);
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new StandardAnalyzer_Analyzer_Standard_English());
if ($this->indexNeedsRebuilding()) {
return $this->rebuildIndex();
}
return Zend_Search_Lucene::open($this->file);
}