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