diff --git a/inc/languages/english/thankyoulike.lang.php b/inc/languages/english/thankyoulike.lang.php index 63d94c8..96f1dce 100644 --- a/inc/languages/english/thankyoulike.lang.php +++ b/inc/languages/english/thankyoulike.lang.php @@ -80,9 +80,11 @@ $l['tyl_wol_searching'] = "Searching {2}"; +$l['tyl_this'] = 'This'; + $l['tyl_error'] = "Thank You/Like System Error Message"; $l['tyl_error_invalid_action'] = "You are trying to perform an invalid action."; -$l['tyl_error_disabled'] = "{1} Feature has been disabled."; +$l['tyl_error_disabled'] = "{1} feature has been disabled."; $l['tyl_error_not_allowed'] = "Not allowed for this post."; $l['tyl_error_first_post_only'] = "You may only add/remove a {1} for the first post of threads in this forum."; $l['tyl_error_excluded'] = "Not allowed for this post because this forum has been excluded."; diff --git a/inc/plugins/thankyoulike.php b/inc/plugins/thankyoulike.php index 6623675..2fd1c2e 100644 --- a/inc/plugins/thankyoulike.php +++ b/inc/plugins/thankyoulike.php @@ -576,12 +576,33 @@ function tyl_check_update_db_table_and_cols($from_version = false) if($from_version !== false && $from_version < 30308) { - // To speed up the member profile tyl statistics (tabulated display of date range counts of tyls). - $db->query("ALTER TABLE ".TABLE_PREFIX.$prefix."thankyoulike ADD KEY uid_dateline (uid , dateline)"); - $db->query("ALTER TABLE ".TABLE_PREFIX.$prefix."thankyoulike ADD KEY puid_dateline (puid, dateline)"); - $db->query("ALTER TABLE ".TABLE_PREFIX.$prefix."thankyoulike ADD KEY puid_uid (puid, uid)"); - // To speed up the determination of the member profile trophy post. - $db->query("ALTER TABLE ".TABLE_PREFIX.$prefix."thankyoulike ADD KEY puid_pid (puid, pid)"); + // These indexes speed up the member profile tyl statistics (tabulated display of date range counts of tyls). + $query = $db->query("SHOW INDEX FROM ".TABLE_PREFIX.$prefix."thankyoulike WHERE Key_name='uid_dateline'"); + if($db->num_rows($query) == 0) + { + $db->query("ALTER TABLE ".TABLE_PREFIX.$prefix."thankyoulike ADD KEY uid_dateline (uid , dateline)"); + } + $db->free_result($query); + $query = $db->query("SHOW INDEX FROM ".TABLE_PREFIX.$prefix."thankyoulike WHERE Key_name='puid_dateline'"); + if($db->num_rows($query) == 0) + { + $db->query("ALTER TABLE ".TABLE_PREFIX.$prefix."thankyoulike ADD KEY puid_dateline (puid, dateline)"); + } + $db->free_result($query); + $query = $db->query("SHOW INDEX FROM ".TABLE_PREFIX.$prefix."thankyoulike WHERE Key_name='puid_uid'"); + if($db->num_rows($query) == 0) + { + $db->query("ALTER TABLE ".TABLE_PREFIX.$prefix."thankyoulike ADD KEY puid_uid (puid, uid)"); + } + $db->free_result($query); + + // This index speeds up the determination of the member profile trophy post. + $query = $db->query("SHOW INDEX FROM ".TABLE_PREFIX.$prefix."thankyoulike WHERE Key_name='puid_pid'"); + if($db->num_rows($query) == 0) + { + $db->query("ALTER TABLE ".TABLE_PREFIX.$prefix."thankyoulike ADD KEY puid_pid (puid, pid)"); + } + $db->free_result($query); } // Added puid field after v1.0 so check for that @@ -1252,7 +1273,7 @@ function thankyoulike_activate() require_once MYBB_ROOT."/inc/adminfunctions_templates.php"; - find_replace_templatesets("showthread", "#".preg_quote('')."#i", ' + find_replace_templatesets("showthread", "#".preg_quote('')."#i", '