diff --git a/src/Settings.php b/src/Settings.php index 240c0a4..aa8cdf2 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -39,6 +39,9 @@ $cookiename = 'SMFCookie10'; # Name of the cookie to set for authentication. $memcached_host = 'memcached'; $memcached_port = 11211; +$redis_host = 'valkey'; +$redis_port = 6379; + $recaptcha_secret = '6LfbSRUUAAAAAM4goUyXz9gB21cfIHL0ZhiQ6doM'; $recaptcha_site_key = '6LfbSRUUAAAAAN1TtRVmVsHw8NKWe5w50fzjyK3U'; ########## Database Info ########## diff --git a/src/Sources/Ignore.php b/src/Sources/Ignore.php index 3ddfb68..81f82c3 100644 --- a/src/Sources/Ignore.php +++ b/src/Sources/Ignore.php @@ -8,7 +8,7 @@ if (!defined('SMF')) function ignore() { - global $topic, $txt, $db_prefix, $context, $scripturl, $sourcedir, $ID_MEMBER, $mongodb; + global $topic, $txt, $db_prefix, $context, $scripturl, $sourcedir, $ID_MEMBER, $redis; // We need at least a topic... go away if you don't have one. if (empty($topic)) @@ -19,17 +19,14 @@ function ignore() $ignoree_id = $_GET['member']; $msg = $_GET['msg']; if ($ID_MEMBER > 0 && $ignoree_id > 0) - $mongodb->rock->ignorelists->update( - array ('user' => (int) $ID_MEMBER), - array ('$addToSet' => array ('ignores' => $ignoree_id)), - array ('upsert' => true)); + $redis->sadd("ignore:${ID_MEMBER}", $ignoree_id); // Back to the topic! redirectexit('topic=' . $topic . '.msg'.$msg."#msg".$msg); } function unignore() { - global $topic, $txt, $db_prefix, $context, $scripturl, $sourcedir, $ID_MEMBER, $mongodb; + global $topic, $txt, $db_prefix, $context, $scripturl, $sourcedir, $ID_MEMBER, $redis; // We need at least a topic... go away if you don't have one. if (empty($topic)) @@ -40,9 +37,7 @@ function unignore() $ignoree_id = $_GET['member']; $msg = $_GET['msg']; if ($ID_MEMBER > 0 && $ignoree_id > 0) - $mongodb->rock->ignorelists->update( - array ('user' => (int) $ID_MEMBER), - array ('$pull' => array ('ignores' => $ignoree_id))); + $redis->sadd("ignore:${ID_MEMBER}", $ignoree_id); // Back to the topic! redirectexit('topic=' . $topic . '.msg'.$msg."#msg".$msg); diff --git a/src/index.php b/src/index.php index 7d4e62c..65a1817 100644 --- a/src/index.php +++ b/src/index.php @@ -78,6 +78,9 @@ if (!$db_connection || !@mysql_select_db($db_name, $db_connection)) $memcached = new Memcached(); $memcached->addServer($memcached_host, $memcached_port); +$redis = new Redis(); +$redis->connect($redis_host, $redis_port); + // mysql_query("SET NAMES 'utf8'"); mysql_query("set SESSION sql_mode='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'");