コード例 #1
0
 public function testRegistrationEmailApplicationEmailCollide()
 {
     $app_email = '*****@*****.**';
     $app_email_object = PhabricatorMetaMTAApplicationEmail::initializeNewAppEmail($this->generateNewTestUser());
     $app_email_object->setAddress($app_email);
     $app_email_object->setApplicationPHID('test');
     $app_email_object->save();
     $caught = null;
     try {
         $this->registerUser('PhabricatorUserEditorTestCaseDomain', $app_email);
     } catch (Exception $ex) {
         $caught = $ex;
     }
     $this->assertTrue($caught instanceof Exception);
 }
コード例 #2
0
 private function returnNewAddressResponse(AphrontRequest $request, PhutilURI $uri, PhabricatorApplication $application)
 {
     $viewer = $request->getUser();
     $email_object = PhabricatorMetaMTAApplicationEmail::initializeNewAppEmail($viewer)->setApplicationPHID($application->getPHID());
     return $this->returnSaveAddressResponse($request, $uri, $email_object, $is_new = true);
 }
<?php

$key = 'metamta.maniphest.public-create-email';
echo pht("Migrating `%s` to new application email infrastructure...\n", $key);
$value = PhabricatorEnv::getEnvConfigIfExists($key);
$maniphest = new PhabricatorManiphestApplication();
if ($value) {
    try {
        PhabricatorMetaMTAApplicationEmail::initializeNewAppEmail(PhabricatorUser::getOmnipotentUser())->setAddress($value)->setApplicationPHID($maniphest->getPHID())->save();
    } catch (AphrontDuplicateKeyQueryException $ex) {
        // Already migrated?
    }
}
echo pht('Done.') . "\n";