Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/sms/storage/PhabricatorSMS.php
Show All 37 Lines | public static function initializeNewSMS($body) { | ||||
// and ProviderSMSID are totally garbage data before a send it attempted. | // and ProviderSMSID are totally garbage data before a send it attempted. | ||||
return id(new PhabricatorSMS()) | return id(new PhabricatorSMS()) | ||||
->setBody($body) | ->setBody($body) | ||||
->setSendStatus(PhabricatorSMS::STATUS_UNSENT) | ->setSendStatus(PhabricatorSMS::STATUS_UNSENT) | ||||
->setProviderShortName(PhabricatorSMS::SHORTNAME_PLACEHOLDER) | ->setProviderShortName(PhabricatorSMS::SHORTNAME_PLACEHOLDER) | ||||
->setProviderSMSID(Filesystem::readRandomCharacters(40)); | ->setProviderSMSID(Filesystem::readRandomCharacters(40)); | ||||
} | } | ||||
public function getConfiguration() { | |||||
return array( | |||||
self::CONFIG_COLUMN_SCHEMA => array( | |||||
'providerShortName' => 'text16', | |||||
'providerSMSID' => 'text40', | |||||
'toNumber' => 'text20', | |||||
'fromNumber' => 'text20?', | |||||
'body' => 'text', | |||||
'sendStatus' => 'text16?', | |||||
), | |||||
self::CONFIG_KEY_SCHEMA => array( | |||||
'key_provider' => array( | |||||
'columns' => array('providerSMSID', 'providerShortName'), | |||||
'unique' => true, | |||||
), | |||||
), | |||||
) + parent::getConfiguration(); | |||||
} | |||||
public function getTableName() { | public function getTableName() { | ||||
// Slightly non-standard, but otherwise this class needs "MetaMTA" in its | // Slightly non-standard, but otherwise this class needs "MetaMTA" in its | ||||
// name. :/ | // name. :/ | ||||
return 'sms'; | return 'sms'; | ||||
} | } | ||||
public function hasBeenSentAtLeastOnce() { | public function hasBeenSentAtLeastOnce() { | ||||
return ($this->getProviderShortName() != | return ($this->getProviderShortName() != | ||||
PhabricatorSMS::SHORTNAME_PLACEHOLDER); | PhabricatorSMS::SHORTNAME_PLACEHOLDER); | ||||
} | } | ||||
} | } |