From: Andrew Dolgov Date: Fri, 27 Sep 2013 09:45:21 +0000 (+0400) Subject: make language detection optional (closes #779) X-Git-Tag: 1.11~57 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=5ddd2705ca0c2729d4a5a6e37b6df8ad8b67379d;p=tt-rss.git make language detection optional (closes #779) --- diff --git a/config.php-dist b/config.php-dist index ec4fb841..789ac95b 100644 --- a/config.php-dist +++ b/config.php-dist @@ -184,6 +184,12 @@ define('CHECK_FOR_NEW_VERSION', true); // Check for new versions of tt-rss automatically. + define('DETECT_ARTICLE_LANGUAGE', true); + // Detect article language when updating feeds, presently this is only + // used for hyphenation. This may increase amount of CPU time used by + // update processes, disable if necessary (i.e. you are being billed + // for CPU time). + define('ENABLE_GZIP_OUTPUT', false); // Selectively gzip output to improve wire performance. This requires // PHP Zlib extension on the server. diff --git a/include/rssfuncs.php b/include/rssfuncs.php index 6d067065..13d6baea 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -356,10 +356,12 @@ $rss->init(); } - require_once "lib/languagedetect/LanguageDetect.php"; + if (DETECT_ARTICLE_LANGUAGE) { + require_once "lib/languagedetect/LanguageDetect.php"; - $lang = new Text_LanguageDetect(); - $lang->setNameMode(2); + $lang = new Text_LanguageDetect(); + $lang->setNameMode(2); + } // print_r($rss); @@ -572,15 +574,17 @@ print "\n"; } - $entry_language = $lang->detect($entry_title . " " . $entry_content, 1); + $entry_language = ""; + + if (DETECT_ARTICLE_LANGUAGE) { + $entry_language = $lang->detect($entry_title . " " . $entry_content, 1); - if (count($entry_language) > 0) { - $entry_language = array_keys($entry_language); - $entry_language = db_escape_string(substr($entry_language[0], 0, 2)); + if (count($entry_language) > 0) { + $entry_language = array_keys($entry_language); + $entry_language = db_escape_string(substr($entry_language[0], 0, 2)); - _debug("detected language: $entry_language", $debug_enabled); - } else{ - $entry_language = ""; + _debug("detected language: $entry_language", $debug_enabled); + } } $entry_comments = $item->get_comments_url(); diff --git a/include/sanity_config.php b/include/sanity_config.php index 527fa6dc..99e83e0d 100644 --- a/include/sanity_config.php +++ b/include/sanity_config.php @@ -1,3 +1,3 @@ - +$requred_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'FEED_CRYPT_KEY', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'PUBSUBHUBBUB_HUB', 'PUBSUBHUBBUB_ENABLED', 'SPHINX_ENABLED', 'SPHINX_SERVER', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SESSION_CHECK_ADDRESS', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'SMTP_SERVER', 'SMTP_LOGIN', 'SMTP_PASSWORD', 'SMTP_SECURE', 'CHECK_FOR_NEW_VERSION', 'DETECT_ARTICLE_LANGUAGE', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?>