We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit aa236985 authored by Evan Prodromou's avatar Evan Prodromou

accept file for initializeinbox.php

parent 085406ea
......@@ -20,17 +20,18 @@
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
$shortoptions = 'i:n:af';
$longoptions = array('id=', 'nickname=', 'all', 'force');
$shortoptions = 'i:n:af:';
$longoptions = array('id=', 'nickname=', 'all', 'file=');
initializeinbox.php [options]
initialize the inbox for a user
-i --id ID of user to update
-n --nickname nickname of the user to update
-f --force force update even if user already has a location
-a --all update all
-i --id ID of user to update
-n --nickname nickname of the user to update
-f FILENAME read list of IDs from FILENAME (1 per line)
--file=FILENAME ditto
-a --all update all
......@@ -60,6 +61,21 @@ try {
} else if (have_option('f', 'file')) {
$filename = get_option_value('f', 'file');
if (!file_exists($filename)) {
throw new Exception("No such file '$filename'.");
} else if (!is_readable($filename)) {
throw new Exception("Can't read '$filename'.");
$ids = file($filename);
foreach ($ids as $id) {
$user = User::staticGet('id', $id);
if (empty($user)) {
throw new Exception("Can't find user with id '$id'.");
} else {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment