- Timestamp:
- 08/13/2011 02:20:09 AM (9 months ago)
- Location:
- trunk/WordPress/plugin/transposh/wp
- Files:
-
- 2 edited
-
transposh_admin.php (modified) (1 diff)
-
transposh_db.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/wp/transposh_admin.php
r657 r660 232 232 } 233 233 234 if (!(class_exists('Memcache') && @$this->memcache->connect(TP_MEMCACHED_SRV, TP_MEMCACHED_PORT)) && !function_exists('apc_fetch') && !function_exists('xcache_get') && !function_exists('eaccelerator_get')) {234 if (!(class_exists('Memcache') /*!!&& $this->memcache->connect(TP_MEMCACHED_SRV, TP_MEMCACHED_PORT)*/) && !function_exists('apc_fetch') && !function_exists('xcache_get') && !function_exists('eaccelerator_get')) { 235 235 $this->add_warning('tp_cache_warning', __('We were not able to find a supported in-memory caching engine, installing one can improve performance.', TRANSPOSH_TEXT_DOMAIN) . ' <a href="http://transposh.org/faq#performance">' . __('Check Transposh FAQs', TRANSPOSH_TEXT_DOMAIN) . '</a>'); 236 236 } -
trunk/WordPress/plugin/transposh/wp/transposh_db.php
r657 r660 54 54 55 55 if (class_exists('Memcache')) { 56 logger('I am using memcached!', 3);56 logger('I am using pecl-Memcache!', 3); 57 57 $this->memcache_working = true; 58 58 $this->memcache = new Memcache; 59 59 @$this->memcache->connect(TP_MEMCACHED_SRV, TP_MEMCACHED_PORT) or $this->memcache_working = false; 60 logger($this->memcache_working); 61 } 60 } 61 // I have space in keys issues... 62 /* elseif (class_exists('Memcached')) { 63 logger('I am using pecl-Memcached!', 3); 64 $this->memcache_working = true; 65 $this->memcache = new Memcached(); 66 //if (!count($this->memcache->getServerList())) { 67 $this->memcache->addServer(TP_MEMCACHED_SRV, TP_MEMCACHED_PORT); 68 // } 69 //@$this->memcache->connect(TP_MEMCACHED_SRV, TP_MEMCACHED_PORT) or $this->memcache_working = false; 70 } */ 71 logger($this->memcache_working); 62 72 } 63 73 … … 74 84 if ($this->memcache_working) { 75 85 $cached = $this->memcache->get($key); 76 logger('memcached ', 5);86 logger('memcached ' . $key . ' ' . $cached, 5); 77 87 } elseif (function_exists('apc_fetch')) { 78 88 $cached = apc_fetch($key, $rc); … … 790 800 $this->cache_delete($row->original, $row->lang); 791 801 } 802 803 // clean duplication in the translation table (don't know how it ever happened...) 804 $dedup = 'SELECT * , count( * )' . 805 ' FROM ' . $this->translation_table . 806 ' GROUP BY `original` , `lang`' . 807 ' HAVING count( * ) >1'; 808 $rows = $GLOBALS['wpdb']->get_results($dedup); 809 logger($dedup, 3); 810 foreach ($rows as $row) { 811 $row->original = $GLOBALS['wpdb']->escape($row->original); 812 $row->lang = $GLOBALS['wpdb']->escape($row->lang); 813 list($source, $tranlation) = $this->fetch_translation($row->original, $row->lang); 814 if ($source != NULL) { 815 $delvalues = "(original ='{$row->original}' AND lang='{$row->lang}'"; 816 $update = "DELETE FROM " . $this->translation_table . " WHERE $delvalues"; 817 logger($update, 3); 818 $result = $GLOBALS['wpdb']->query($update); 819 } 820 $row->translated = $GLOBALS['wpdb']->escape($translation); 821 $row->source = $GLOBALS['wpdb']->escape($source); 822 $values = "('{$row->original}','{$row->lang}','{$row->translated}','$row->source')"; 823 $update = "INSERT INTO " . $this->translation_table . " (original, lang, translated, source) VALUES $values"; 824 logger($update, 3); 825 $result = $GLOBALS['wpdb']->query($update); 826 $this->cache_delete($row->original, $row->lang); 827 } 828 792 829 // check for discrepencies (last translation in log does not equal current translation) 793 830 // TODO
Note: See TracChangeset
for help on using the changeset viewer.
