private function setManiphestCreateEmail()
 {
     $maniphest_app = new PhabricatorManiphestApplication();
     try {
         id(new PhabricatorMetaMTAApplicationEmail())->setApplicationPHID($maniphest_app->getPHID())->setAddress('*****@*****.**')->setConfigData(array())->save();
     } catch (AphrontDuplicateKeyQueryException $ex) {
     }
 }
 private function executeManiphestFieldChecks()
 {
     $maniphest_appclass = 'PhabricatorManiphestApplication';
     if (!PhabricatorApplication::isClassInstalled($maniphest_appclass)) {
         return;
     }
     $capabilities = array(ManiphestEditAssignCapability::CAPABILITY, ManiphestEditPoliciesCapability::CAPABILITY, ManiphestEditPriorityCapability::CAPABILITY, ManiphestEditProjectsCapability::CAPABILITY, ManiphestEditStatusCapability::CAPABILITY);
     // Check for any of these capabilities set to anything other than
     // "All Users".
     $any_set = false;
     $app = new PhabricatorManiphestApplication();
     foreach ($capabilities as $capability) {
         $setting = $app->getPolicy($capability);
         if ($setting != PhabricatorPolicies::POLICY_USER) {
             $any_set = true;
             break;
         }
     }
     if (!$any_set) {
         return;
     }
     $issue_summary = pht('Maniphest is currently configured with deprecated policy settings ' . 'which will be removed in a future version of Phabricator.');
     $message = pht('Some policy settings in Maniphest are now deprecated and will be ' . 'removed in a future version of Phabricator. You are currently using ' . 'at least one of these settings.' . "\n\n" . 'The deprecated settings are "Can Assign Tasks", ' . '"Can Edit Task Policies", "Can Prioritize Tasks", ' . '"Can Edit Task Projects", and "Can Edit Task Status". You can ' . 'find these settings in Applications, or follow the link below.' . "\n\n" . 'You can find discussion of this change (including rationale and ' . 'recommendations on how to configure similar features) in the upstream, ' . 'at the link below.' . "\n\n" . 'To resolve this issue, set all of these policies to "All Users" after ' . 'making any necessary form customization changes.');
     $more_href = 'https://secure.phabricator.com/T10003';
     $edit_href = '/applications/view/PhabricatorManiphestApplication/';
     $issue = $this->newIssue('maniphest.T10003-per-field-policies')->setShortName(pht('Deprecated Policies'))->setName(pht('Deprecated Maniphest Field Policies'))->setSummary($issue_summary)->setMessage($message)->addLink($more_href, pht('Learn More: Upstream Discussion'))->addLink($edit_href, pht('Edit These Settings'));
 }
<?php

$key = 'metamta.maniphest.default-public-author';
echo pht("Migrating `%s` to new application email infrastructure...\n", $key);
$value = PhabricatorEnv::getEnvConfigIfExists($key);
$maniphest = new PhabricatorManiphestApplication();
$config_key = PhabricatorMetaMTAApplicationEmail::CONFIG_DEFAULT_AUTHOR;
if ($value) {
    $app_emails = id(new PhabricatorMetaMTAApplicationEmailQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withApplicationPHIDs(array($maniphest->getPHID()))->execute();
    foreach ($app_emails as $app_email) {
        $app_email->setConfigValue($config_key, $value);
        $app_email->save();
    }
}
echo pht('Done.') . "\n";
<?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";