mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Remove product literal strings in "pht()", part 6
Summary: Ref T13658. Test Plan: This test plan is non-exhaustive. - Ran `bin/mail`. - Uninstalled and reinstalled an application. Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13658 Differential Revision: https://secure.phabricator.com/D21770
This commit is contained in:
parent
ad880491e8
commit
b3557796fe
18 changed files with 59 additions and 49 deletions
|
@ -98,7 +98,7 @@ final class HarbormasterBuildPlanQuery
|
|||
$this->statuses);
|
||||
}
|
||||
|
||||
if (strlen($this->datasourceQuery)) {
|
||||
if (!phutil_nonempty_string($this->datasourceQuery)) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'plan.name LIKE %>',
|
||||
|
|
|
@ -8,7 +8,7 @@ final class HarbormasterUploadArtifactBuildStepImplementation
|
|||
}
|
||||
|
||||
public function getGenericDescription() {
|
||||
return pht('Upload a file from a host to Phabricator.');
|
||||
return pht('Upload a file.');
|
||||
}
|
||||
|
||||
public function getBuildStepGroupKey() {
|
||||
|
|
|
@ -131,7 +131,7 @@ final class LegalpadDocumentEditEngine
|
|||
->setKey('requireSignature')
|
||||
->setOptions(
|
||||
pht('No Signature Required'),
|
||||
pht('Signature Required to use Phabricator'))
|
||||
pht('Signature Required to Log In'))
|
||||
->setAsCheckbox(true)
|
||||
->setTransactionType(
|
||||
LegalpadDocumentRequireSignatureTransaction::TRANSACTIONTYPE)
|
||||
|
|
|
@ -218,7 +218,7 @@ The keys you can provide in a specification are:
|
|||
|
||||
Statuses will appear in the UI in the order specified. Note the status marked
|
||||
`special` as `duplicate` is not settable directly and will not appear in UI
|
||||
elements, and that any status marked `silly` does not appear if Phabricator
|
||||
elements, and that any status marked `silly` does not appear if the software
|
||||
is configured with `phabricator.serious-business` set to true.
|
||||
|
||||
Examining the default configuration and examples below will probably be helpful
|
||||
|
|
|
@ -38,7 +38,7 @@ final class PhabricatorApplicationUninstallController
|
|||
->appendChild(
|
||||
pht(
|
||||
'To manage prototypes, enable them by setting %s in your '.
|
||||
'Phabricator configuration.',
|
||||
'configuration.',
|
||||
phutil_tag('tt', array(), 'phabricator.show-prototypes')));
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
@ -98,9 +98,9 @@ final class PhabricatorApplicationUninstallController
|
|||
->appendParagraph(
|
||||
pht(
|
||||
'This is very unusual and will leave you without any '.
|
||||
'content on the Phabricator home page. You should only '.
|
||||
'do this if you are certain you know what you are doing.'))
|
||||
->addSubmitButton(pht('Completely Break Phabricator'));
|
||||
'content on the home page. You should only do this if you '.
|
||||
'are certain you know what you are doing.'))
|
||||
->addSubmitButton(pht('Completely Break Everything'));
|
||||
} else {
|
||||
$dialog
|
||||
->appendParagraph(
|
||||
|
@ -114,8 +114,7 @@ final class PhabricatorApplicationUninstallController
|
|||
->setTitle(pht('Information'))
|
||||
->appendChild(
|
||||
pht(
|
||||
'This application cannot be uninstalled, '.
|
||||
'because it is required for Phabricator to work.'));
|
||||
'This application is required and cannot be uninstalled.'));
|
||||
}
|
||||
}
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
|
|
|
@ -126,12 +126,12 @@ final class PhabricatorMailTestAdapter
|
|||
$guts['headers'] = $header_list;
|
||||
|
||||
$text_body = $message->getTextBody();
|
||||
if (strlen($text_body)) {
|
||||
if (phutil_nonempty_string($text_body)) {
|
||||
$guts['body'] = $text_body;
|
||||
}
|
||||
|
||||
$html_body = $message->getHTMLBody();
|
||||
if (strlen($html_body)) {
|
||||
if (phutil_nonempty_string($html_body)) {
|
||||
$guts['html-body'] = $html_body;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ final class MetaMTAReceivedMailStatus
|
|||
public static function getHumanReadableName($status) {
|
||||
$map = array(
|
||||
self::STATUS_DUPLICATE => pht('Duplicate Message'),
|
||||
self::STATUS_FROM_PHABRICATOR => pht('Phabricator Mail'),
|
||||
self::STATUS_FROM_PHABRICATOR => pht('Mail From Self'),
|
||||
self::STATUS_NO_RECEIVERS => pht('No Receivers'),
|
||||
self::STATUS_UNKNOWN_SENDER => pht('Unknown Sender'),
|
||||
self::STATUS_DISABLED_SENDER => pht('Disabled Sender'),
|
||||
|
|
|
@ -428,7 +428,7 @@ final class PhabricatorMetaMTAMailViewController
|
|||
if ($actor_phid) {
|
||||
$actor_str = $viewer->renderHandle($actor_phid);
|
||||
} else {
|
||||
$actor_str = pht('Generated by Phabricator');
|
||||
$actor_str = pht('Generated by Server');
|
||||
}
|
||||
$properties->addProperty(pht('Actor'), $actor_str);
|
||||
|
||||
|
|
|
@ -119,6 +119,8 @@ final class PhabricatorMailEmailEngine
|
|||
}
|
||||
|
||||
$body_limit = PhabricatorEnv::getEnvConfig('metamta.email-body-limit');
|
||||
|
||||
$body = phutil_string_cast($body);
|
||||
if (strlen($body) > $body_limit) {
|
||||
$body = id(new PhutilUTF8StringTruncator())
|
||||
->setMaximumBytes($body_limit)
|
||||
|
@ -143,7 +145,7 @@ final class PhabricatorMailEmailEngine
|
|||
|
||||
if ($send_html) {
|
||||
$html_body = $mail->getHTMLBody();
|
||||
if (strlen($html_body)) {
|
||||
if (phutil_nonempty_string($html_body)) {
|
||||
// NOTE: We just drop the entire HTML body if it won't fit. Safely
|
||||
// truncating HTML is hard, and we already have the text body to fall
|
||||
// back to.
|
||||
|
@ -166,7 +168,7 @@ final class PhabricatorMailEmailEngine
|
|||
if (PhabricatorEnv::getEnvConfig('phabricator.silent')) {
|
||||
$mail->setMessage(
|
||||
pht(
|
||||
'Phabricator is running in silent mode. See `%s` '.
|
||||
'This software is running in silent mode. See `%s` '.
|
||||
'in the configuration to change this setting.',
|
||||
'phabricator.silent'));
|
||||
|
||||
|
@ -226,7 +228,7 @@ final class PhabricatorMailEmailEngine
|
|||
$mail = $this->getMail();
|
||||
|
||||
$reply_raw = $mail->getReplyTo();
|
||||
if (!strlen($reply_raw)) {
|
||||
if (!phutil_nonempty_string($reply_raw)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -241,7 +243,7 @@ final class PhabricatorMailEmailEngine
|
|||
|
||||
// If we don't have a display name, fill in a default.
|
||||
if (!strlen($reply_address->getDisplayName())) {
|
||||
$reply_address->setDisplayName(pht('Phabricator'));
|
||||
$reply_address->setDisplayName(PlatformSymbols::getPlatformServerName());
|
||||
}
|
||||
|
||||
return $reply_address;
|
||||
|
@ -301,7 +303,11 @@ final class PhabricatorMailEmailEngine
|
|||
}
|
||||
}
|
||||
|
||||
$subject[] = trim($mail->getSubjectPrefix());
|
||||
$subject_prefix = $mail->getSubjectPrefix();
|
||||
$subject_prefix = phutil_string_cast($subject_prefix);
|
||||
$subject_prefix = trim($subject_prefix);
|
||||
|
||||
$subject[] = $subject_prefix;
|
||||
|
||||
// If mail content must be encrypted, we replace the subject with
|
||||
// a generic one.
|
||||
|
@ -313,7 +319,7 @@ final class PhabricatorMailEmailEngine
|
|||
$subject[] = $encrypt_subject;
|
||||
} else {
|
||||
$vary_prefix = $mail->getVarySubjectPrefix();
|
||||
if (strlen($vary_prefix)) {
|
||||
if (phutil_nonempty_string($vary_prefix)) {
|
||||
if ($this->shouldVarySubject()) {
|
||||
$subject[] = $vary_prefix;
|
||||
}
|
||||
|
@ -323,7 +329,7 @@ final class PhabricatorMailEmailEngine
|
|||
}
|
||||
|
||||
foreach ($subject as $key => $part) {
|
||||
if (!strlen($part)) {
|
||||
if (!phutil_nonempty_string($part)) {
|
||||
unset($subject[$key]);
|
||||
}
|
||||
}
|
||||
|
@ -403,7 +409,7 @@ final class PhabricatorMailEmailEngine
|
|||
$headers = array();
|
||||
|
||||
$thread_id = $mail->getThreadID();
|
||||
if (!strlen($thread_id)) {
|
||||
if (!phutil_nonempty_string($thread_id)) {
|
||||
return $headers;
|
||||
}
|
||||
|
||||
|
@ -508,8 +514,8 @@ final class PhabricatorMailEmailEngine
|
|||
|
||||
$address = new PhutilEmailAddress($raw_address);
|
||||
|
||||
if (!strlen($address->getDisplayName())) {
|
||||
$address->setDisplayName(pht('Phabricator'));
|
||||
if (!phutil_nonempty_string($address->getDisplayName())) {
|
||||
$address->setDisplayName(PlatformSymbols::getPlatformServerName());
|
||||
}
|
||||
|
||||
return $address;
|
||||
|
|
|
@ -6,7 +6,7 @@ final class PhabricatorMailManagementListInboundWorkflow
|
|||
protected function didConstruct() {
|
||||
$this
|
||||
->setName('list-inbound')
|
||||
->setSynopsis(pht('List inbound messages received by Phabricator.'))
|
||||
->setSynopsis(pht('List inbound messages.'))
|
||||
->setExamples(
|
||||
'**list-inbound**')
|
||||
->setArguments(
|
||||
|
|
|
@ -6,7 +6,7 @@ final class PhabricatorMailManagementListOutboundWorkflow
|
|||
protected function didConstruct() {
|
||||
$this
|
||||
->setName('list-outbound')
|
||||
->setSynopsis(pht('List outbound messages sent by Phabricator.'))
|
||||
->setSynopsis(pht('List outbound messages.'))
|
||||
->setExamples('**list-outbound**')
|
||||
->setArguments(
|
||||
array(
|
||||
|
|
|
@ -81,6 +81,7 @@ final class PhabricatorMetaMTAEmailBodyParser extends Phobject {
|
|||
}
|
||||
|
||||
private function stripQuotedText($body) {
|
||||
$body = phutil_string_cast($body);
|
||||
|
||||
// Look for "On <date>, <user> wrote:". This may be split across multiple
|
||||
// lines. We need to be careful not to remove all of a message like this:
|
||||
|
|
|
@ -263,19 +263,16 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
|
|||
MetaMTAReceivedMailStatus::STATUS_UNKNOWN_SENDER,
|
||||
pht(
|
||||
'This email was sent from an email address ("%s") that is not '.
|
||||
'associated with a Phabricator account. To interact with '.
|
||||
'Phabricator via email, add this address to your account.',
|
||||
'associated with a registered user account. To interact via '.
|
||||
'email, add this address to your account.',
|
||||
(string)$this->newFromAddress()));
|
||||
} else {
|
||||
throw new PhabricatorMetaMTAReceivedMailProcessingException(
|
||||
MetaMTAReceivedMailStatus::STATUS_NO_RECEIVERS,
|
||||
pht(
|
||||
'Phabricator can not process this mail because no application '.
|
||||
'This mail can not be processed because no application '.
|
||||
'knows how to handle it. Check that the address you sent it to '.
|
||||
'is correct.'.
|
||||
"\n\n".
|
||||
'(No concrete, enabled subclass of PhabricatorMailReceiver can '.
|
||||
'accept this mail.)'));
|
||||
'is correct.'));
|
||||
}
|
||||
}
|
||||
} catch (PhabricatorMetaMTAReceivedMailProcessingException $ex) {
|
||||
|
@ -348,9 +345,13 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
|
|||
|
||||
private function getRawEmailAddresses($addresses) {
|
||||
$raw_addresses = array();
|
||||
foreach (explode(',', $addresses) as $address) {
|
||||
$raw_addresses[] = $this->getRawEmailAddress($address);
|
||||
|
||||
if (phutil_nonempty_string($addresses)) {
|
||||
foreach (explode(',', $addresses) as $address) {
|
||||
$raw_addresses[] = $this->getRawEmailAddress($address);
|
||||
}
|
||||
}
|
||||
|
||||
return array_filter($raw_addresses);
|
||||
}
|
||||
|
||||
|
@ -436,7 +437,7 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
|
|||
$status_code,
|
||||
pht(
|
||||
'Your message does not contain any body text or attachments, so '.
|
||||
'Phabricator can not do anything useful with it. Make sure comment '.
|
||||
'this server can not do anything useful with it. Make sure comment '.
|
||||
'text appears at the top of your message: quoted replies, inline '.
|
||||
'text, and signatures are discarded and ignored.'));
|
||||
}
|
||||
|
@ -484,7 +485,7 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
|
|||
$headers = implode("\n", $headers);
|
||||
|
||||
$body = pht(<<<EOBODY
|
||||
Your email to Phabricator was not processed, because an error occurred while
|
||||
Your email to %s was not processed, because an error occurred while
|
||||
trying to handle it:
|
||||
|
||||
%s
|
||||
|
@ -499,6 +500,7 @@ trying to handle it:
|
|||
|
||||
EOBODY
|
||||
,
|
||||
PlatformSymbols::getPlatformServerName(),
|
||||
wordwrap($description, 78),
|
||||
$this->getRawTextBody(),
|
||||
$headers);
|
||||
|
@ -563,21 +565,20 @@ EOBODY
|
|||
if ($sender->getIsDisabled()) {
|
||||
$failure_reason = pht(
|
||||
'Your account ("%s") is disabled, so you can not interact with '.
|
||||
'Phabricator over email.',
|
||||
'over email.',
|
||||
$sender->getUsername());
|
||||
} else if ($sender->getIsStandardUser()) {
|
||||
if (!$sender->getIsApproved()) {
|
||||
$failure_reason = pht(
|
||||
'Your account ("%s") has not been approved yet. You can not '.
|
||||
'interact with Phabricator over email until your account is '.
|
||||
'approved.',
|
||||
'interact over email until your account is approved.',
|
||||
$sender->getUsername());
|
||||
} else if (PhabricatorUserEmail::isEmailVerificationRequired() &&
|
||||
!$sender->getIsEmailVerified()) {
|
||||
$failure_reason = pht(
|
||||
'You have not verified the email address for your account ("%s"). '.
|
||||
'You must verify your email address before you can interact '.
|
||||
'with Phabricator over email.',
|
||||
'You must verify your email address before you can interact over '.
|
||||
'email.',
|
||||
$sender->getUsername());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ final class PhabricatorMetaMTAMailTestCase extends PhabricatorTestCase {
|
|||
// We expect the HTML body was dropped completely after the text body was
|
||||
// truncated.
|
||||
$this->assertTrue(
|
||||
!strlen($html_body),
|
||||
!phutil_nonempty_string($html_body),
|
||||
pht('HTML Body Removed'));
|
||||
|
||||
|
||||
|
@ -416,7 +416,7 @@ final class PhabricatorMetaMTAMailTestCase extends PhabricatorTestCase {
|
|||
$html_body = $mailer->getHTMLBody();
|
||||
|
||||
$this->assertEqual($string_1kb, $text_body);
|
||||
$this->assertTrue(!strlen($html_body));
|
||||
$this->assertTrue(!phutil_nonempty_string($html_body));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,11 +21,10 @@ final class PhabricatorMailUtil
|
|||
// If a mailbox prefix is configured and present, strip it off.
|
||||
$prefix_key = 'metamta.single-reply-handler-prefix';
|
||||
$prefix = PhabricatorEnv::getEnvConfig($prefix_key);
|
||||
$len = strlen($prefix);
|
||||
|
||||
if ($len) {
|
||||
if (phutil_nonempty_string($prefix)) {
|
||||
$prefix = $prefix.'+';
|
||||
$len = $len + 1;
|
||||
$len = strlen($prefix);
|
||||
|
||||
if (!strncasecmp($raw_address, $prefix, $len)) {
|
||||
$raw_address = substr($raw_address, $len);
|
||||
|
|
|
@ -42,7 +42,7 @@ final class PhabricatorEditorSetting
|
|||
}
|
||||
|
||||
public function validateTransactionValue($value) {
|
||||
if (!strlen($value)) {
|
||||
if (!phutil_nonempty_string($value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ abstract class PhabricatorSelectSetting
|
|||
}
|
||||
|
||||
final public function validateTransactionValue($value) {
|
||||
$value = phutil_string_cast($value);
|
||||
if (!strlen($value)) {
|
||||
return;
|
||||
}
|
||||
|
@ -66,11 +67,13 @@ abstract class PhabricatorSelectSetting
|
|||
}
|
||||
|
||||
public function getTransactionNewValue($value) {
|
||||
$value = phutil_string_cast($value);
|
||||
|
||||
if (!strlen($value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (string)$value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ abstract class AphrontBaseMySQLDatabaseConnection
|
|||
}
|
||||
|
||||
public function escapeStringForLikeClause($value) {
|
||||
$value = phutil_string_cast($value);
|
||||
$value = addcslashes($value, '\%_');
|
||||
$value = $this->escapeUTF8String($value);
|
||||
return $value;
|
||||
|
|
Loading…
Reference in a new issue