28 lines
916 B
PHP
28 lines
916 B
PHP
|
<?php
|
||
|
require_once __DIR__ . '/../misuzu.php';
|
||
|
|
||
|
if(!MSZ_DEBUG)
|
||
|
die('Not running in debug mode. Are you sure you want to run this?' . PHP_EOL);
|
||
|
|
||
|
define('SRA_URL', 'https://abyss.flash.moe/dev-avatars/_random.php');
|
||
|
|
||
|
// oh boy this'll take a while
|
||
|
$users = \Misuzu\Users\User::all();
|
||
|
|
||
|
printf('[%s] Altering avatars for %d users.%s', date('H:i:s'), count($users), PHP_EOL);
|
||
|
|
||
|
foreach($users as $user) {
|
||
|
printf('[%s] Changing avatar for %d %s...%s', date('H:i:s'), $user->getId(), $user->getUsername(), PHP_EOL);
|
||
|
|
||
|
if(mt_rand(0, 1000) > 950) {
|
||
|
printf('[%s] Skipping this one.%s', date('H:i:s'), PHP_EOL);
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
printf('[%s] Downloading image from %s...%s', date('H:i:s'), SRA_URL, PHP_EOL);
|
||
|
$data = file_get_contents(SRA_URL);
|
||
|
|
||
|
printf('[%s] Applying through stupid roundabout method...%s', date('H:i:s'), PHP_EOL);
|
||
|
$user->getAvatarInfo()->setFromData($data);
|
||
|
}
|