From 47759adb667523641f111033927a96a6b15c431b Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Thu, 24 Oct 2013 16:41:09 +0200 Subject: [PATCH] Closed #38 --- scripts/process-old-users.php | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 scripts/process-old-users.php diff --git a/scripts/process-old-users.php b/scripts/process-old-users.php new file mode 100644 index 00000000..2c2b08a4 --- /dev/null +++ b/scripts/process-old-users.php @@ -0,0 +1,47 @@ +id . PHP_EOL; + echo 'Name: ' . $user->name . PHP_EOL; + echo 'E-mail: ' . $user->email_unconfirmed . PHP_EOL; + echo 'Date joined: ' . date('Y-m-d H:i:s', $user->join_date) . PHP_EOL; + echo PHP_EOL; +} + +$action = array_shift($argv); +switch ($action) +{ + case '-print': + $func = 'printUser'; + break; + + case '-purge': + $func = function($user) + { + printUser($user); + R::trash($user); + }; + break; + + default: + die('Unknown action' . PHP_EOL); +} + +$rows = R::find('user', 'email_confirmed IS NULL AND DATETIME(join_date) < DATETIME("now", "-21 days")'); +foreach ($rows as $user) +{ + $func($user); +}