|
|
@@ -0,0 +1,31 @@
|
|
|
+<?php /** @noinspection PhpUnhandledExceptionInspection */
|
|
|
+
|
|
|
+use Carbon\CarbonImmutable;
|
|
|
+
|
|
|
+require "../initialise.php";
|
|
|
+
|
|
|
+$date = CarbonImmutable::now()->subYears(23)->toDateString();
|
|
|
+
|
|
|
+$users = User::query([
|
|
|
+ "level" => User::LEVEL_TESTER,
|
|
|
+ "date_of_birth" => Constraint::lessThan($date),
|
|
|
+ "archived" => "0"
|
|
|
+]);
|
|
|
+
|
|
|
+$user_count = count($users);
|
|
|
+$archived_count = 0;
|
|
|
+
|
|
|
+foreach($users as $user) {
|
|
|
+ if($user->date_of_birth === "0000-00-00") {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ $archived_count++;
|
|
|
+
|
|
|
+ echo sprintf("%s (%s) archived.\n", $user->getDisplayName(), $user->date_of_birth);
|
|
|
+
|
|
|
+ $user->archived = 1;
|
|
|
+ $user->commit();
|
|
|
+}
|
|
|
+
|
|
|
+echo "Users archived: $archived_count\n";
|