public function disable_free_leech() { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query = "UPDATE #__tracker_torrents as tt "; $query .= "JOIN #__tracker_torrents_freeleech as fl on tt.fid = fl.fid "; $query .= "SET tt.download_multiplier = fl.download_multiplier, tt.flags = 2"; $db->setQuery((string) $query); try { $db->query(); } catch (Exception $e) { $this->setError(JText::_('COM_TRACKER_UTILITY_FREE_LEECH_COULDNT_SET_ORIGINAL_VALUES')); return false; } // Finally we delete the temporary table $query = 'DROP TABLE IF EXISTS #__tracker_torrents_freeleech'; $db->setQuery((string) $query); // Check if we have an error and output it try { $db->query(); } catch (Exception $e) { $this->setError(JText::_('COM_TRACKER_UTILITY_FREE_LEECH_COULDNT_DELETE_TEMP_TABLE')); return false; } TrackerHelper::update_parameter('freeleech', '0'); // Clean the cache. $this->cleanCache('_system', 0); $this->cleanCache('_system', 1); return true; }