diff --git a/update_chain.php b/update_chain.php index 24c2fde..4070dc3 100644 --- a/update_chain.php +++ b/update_chain.php @@ -139,6 +139,15 @@ function update_user_by_username($username) { $conn->query($query); } } +if ($argv[1] == "all") { + $query = "SELECT user_id, username FROM users WHERE follows = -1;"; + $end_points = $conn->query($query); + while ($end_point = $end_points->fetch_assoc()){ + $chain = get_chain_from_user($end_point); + send_text(chain_to_string($chain)); + } + exit(); +} # Update users $query = "SELECT username FROM users;"; diff --git a/webhook.php b/webhook.php index 6bff65a..4300f6c 100644 --- a/webhook.php +++ b/webhook.php @@ -77,6 +77,10 @@ function update() { exec('echo php ' . __DIR__ . '/update_chain.php send | at now'); } +function allchains() { + exec('echo php ' . __DIR__ . '/update_chain.php all | at now'); +} + function dnf() { $mysql = require('mysql_credentials.php'); $conn = new mysqli($mysql['servername'], $mysql['username'], $mysql['password'], $mysql['database']); @@ -112,6 +116,10 @@ $modules = array( array( "command" => "/doesnotfollow", "function" => "dnf();" + ), + array( + "command" => "/allchains", + "function" => "allchains();" ) );