diff --git a/scripts/initializeinbox.php b/scripts/initializeinbox.php new file mode 100644 index 0000000000..43afc48eb2 --- /dev/null +++ b/scripts/initializeinbox.php @@ -0,0 +1,94 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'i:n:af'; +$longoptions = array('id=', 'nickname=', 'all', 'force'); + +$helptext = <<find()) { + while ($user->fetch()) { + initializeInbox($user); + } + } + } else { + show_help(); + exit(1); + } +} catch (Exception $e) { + print $e->getMessage()."\n"; + exit(1); +} + +function initializeInbox($user) +{ + if (!have_option('q', 'quiet')) { + print "Initializing inbox for $user->nickname..."; + } + + $inbox = Inbox::staticGet('user_id', $user_id); + + if (!empty($inbox)) { + if (!have_option('q', 'quiet')) { + print "SKIP\n"; + } + } else { + $inbox = Inbox::initialize($user_id); + if (!have_option('q', 'quiet')) { + if (empty($inbox)) { + print "ERR\n"; + } else { + print "DONE\n"; + } + } + } +}