/**
  * Handler method
  *
  * @param array $argarray is ignored since it's now passed in in prepare()
  *
  * @return void
  */
 function handle($argarray = null)
 {
     try {
         $confirm = DomainStatusNetworkPlugin::registerEmail($this->email);
         EmailRegistrationPlugin::sendConfirmEmail($confirm);
         $this->showSuccess();
     } catch (ClientException $e) {
         $this->showError($e->getMessage(), $e->getCode());
     } catch (Exception $e) {
         common_log(LOG_ERR, $e->getMessage());
         $this->showError(_('An internal error occurred.'), 500);
     }
     return;
 }
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$shortoptions = 'wt::';
$longoptions = array('welcome', 'template=');
$helptext = <<<END_OF_INSTALLFOREMAIL_HELP

installforemail.php [options] <email address>
Create a new account and, if necessary, a new network for the given email address

-w --welcome   Send a welcome email
-t --template= Use this email template

END_OF_INSTALLFOREMAIL_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$email = $args[0];
$sendWelcome = have_option('w', 'welcome');
if ($sendWelcome && have_option('t', 'template')) {
    $template = get_option_value('t', 'template');
}
try {
    $confirm = DomainStatusNetworkPlugin::registerEmail($email);
    if ($sendWelcome) {
        EmailRegistrationPlugin::sendConfirmEmail($confirm, $template);
    }
    $confirmUrl = common_local_url('register', array('code' => $confirm->code));
    print $confirmUrl . "\n";
} catch (Exception $e) {
    print "ERROR: " . $e->getMessage() . "\n";
}