From: Andrew Dolgov Date: Thu, 25 Aug 2016 06:47:02 +0000 (+0300) Subject: af_psql_trgm: do not try to render preference pane if enabled on mysql X-Git-Tag: 17.1~44 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e8a94ec7e21b797398ed3eba826bc294b314b00f;p=tt-rss.git af_psql_trgm: do not try to render preference pane if enabled on mysql --- diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php index 0de46b08..8dde76d4 100644 --- a/plugins/af_psql_trgm/init.php +++ b/plugins/af_psql_trgm/init.php @@ -119,90 +119,91 @@ class Af_Psql_Trgm extends Plugin { if (DB_TYPE != "pgsql") { print_error("Database type not supported."); - } - - $result = db_query("select 'similarity'::regproc"); - - if (db_num_rows($result) == 0) { - print_error("pg_trgm extension not found."); - } - - $similarity = $this->host->get($this, "similarity"); - $min_title_length = $this->host->get($this, "min_title_length"); - $enable_globally = $this->host->get($this, "enable_globally"); + } else { - if (!$similarity) $similarity = '0.75'; - if (!$min_title_length) $min_title_length = '32'; + $result = db_query("select 'similarity'::regproc"); - $enable_globally_checked = $enable_globally ? "checked" : ""; + if (db_num_rows($result) == 0) { + print_error("pg_trgm extension not found."); + } - print "
"; + $similarity = $this->host->get($this, "similarity"); + $min_title_length = $this->host->get($this, "min_title_length"); + $enable_globally = $this->host->get($this, "enable_globally"); - print ""; + if (!$similarity) $similarity = '0.75'; + if (!$min_title_length) $min_title_length = '32'; - print ""; - print ""; - print ""; + $enable_globally_checked = $enable_globally ? "checked" : ""; - print "

" . __("PostgreSQL trigram extension returns string similarity as a floating point number (0-1). Setting it too low might produce false positives, zero disables checking.") . "

"; - print_notice("Enable the plugin for specific feeds in the feed editor."); + print ""; - print "

" . __("Global settings") . "

"; + print ""; - print ""; + print ""; + print ""; + print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; + print "

" . __("PostgreSQL trigram extension returns string similarity as a floating point number (0-1). Setting it too low might produce false positives, zero disables checking.") . "

"; + print_notice("Enable the plugin for specific feeds in the feed editor."); - print "
".__("Minimum similarity:")." -
".__("Minimum title length:")." -
".__("Enable for all feeds:")." -
"; + print "

" . __("Global settings") . "

"; - print "

"; + print ""; - print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; - $enabled_feeds = $this->host->get($this, "enabled_feeds"); - if (!array($enabled_feeds)) $enabled_feeds = array(); + print "
" . __("Minimum similarity:") . " +
" . __("Minimum title length:") . " +
" . __("Enable for all feeds:") . " +
"; - $enabled_feeds = $this->filter_unknown_feeds($enabled_feeds); - $this->host->set($this, "enabled_feeds", $enabled_feeds); + print "

"; - if (count($enabled_feeds) > 0) { - print "

" . __("Currently enabled for (click to edit):") . "

"; + print ""; - print ""; } print "";