@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+59 -49
+1 -1
src/applications/harbormaster/query/HarbormasterBuildPlanQuery.php
··· 98 98 $this->statuses); 99 99 } 100 100 101 - if (strlen($this->datasourceQuery)) { 101 + if (!phutil_nonempty_string($this->datasourceQuery)) { 102 102 $where[] = qsprintf( 103 103 $conn, 104 104 'plan.name LIKE %>',
+1 -1
src/applications/harbormaster/step/HarbormasterUploadArtifactBuildStepImplementation.php
··· 8 8 } 9 9 10 10 public function getGenericDescription() { 11 - return pht('Upload a file from a host to Phabricator.'); 11 + return pht('Upload a file.'); 12 12 } 13 13 14 14 public function getBuildStepGroupKey() {
+1 -1
src/applications/legalpad/editor/LegalpadDocumentEditEngine.php
··· 131 131 ->setKey('requireSignature') 132 132 ->setOptions( 133 133 pht('No Signature Required'), 134 - pht('Signature Required to use Phabricator')) 134 + pht('Signature Required to Log In')) 135 135 ->setAsCheckbox(true) 136 136 ->setTransactionType( 137 137 LegalpadDocumentRequireSignatureTransaction::TRANSACTIONTYPE)
+1 -1
src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
··· 218 218 219 219 Statuses will appear in the UI in the order specified. Note the status marked 220 220 `special` as `duplicate` is not settable directly and will not appear in UI 221 - elements, and that any status marked `silly` does not appear if Phabricator 221 + elements, and that any status marked `silly` does not appear if the software 222 222 is configured with `phabricator.serious-business` set to true. 223 223 224 224 Examining the default configuration and examples below will probably be helpful
+5 -6
src/applications/meta/controller/PhabricatorApplicationUninstallController.php
··· 38 38 ->appendChild( 39 39 pht( 40 40 'To manage prototypes, enable them by setting %s in your '. 41 - 'Phabricator configuration.', 41 + 'configuration.', 42 42 phutil_tag('tt', array(), 'phabricator.show-prototypes'))); 43 43 return id(new AphrontDialogResponse())->setDialog($dialog); 44 44 } ··· 98 98 ->appendParagraph( 99 99 pht( 100 100 'This is very unusual and will leave you without any '. 101 - 'content on the Phabricator home page. You should only '. 102 - 'do this if you are certain you know what you are doing.')) 103 - ->addSubmitButton(pht('Completely Break Phabricator')); 101 + 'content on the home page. You should only do this if you '. 102 + 'are certain you know what you are doing.')) 103 + ->addSubmitButton(pht('Completely Break Everything')); 104 104 } else { 105 105 $dialog 106 106 ->appendParagraph( ··· 114 114 ->setTitle(pht('Information')) 115 115 ->appendChild( 116 116 pht( 117 - 'This application cannot be uninstalled, '. 118 - 'because it is required for Phabricator to work.')); 117 + 'This application is required and cannot be uninstalled.')); 119 118 } 120 119 } 121 120 return id(new AphrontDialogResponse())->setDialog($dialog);
+2 -2
src/applications/metamta/adapter/PhabricatorMailTestAdapter.php
··· 126 126 $guts['headers'] = $header_list; 127 127 128 128 $text_body = $message->getTextBody(); 129 - if (strlen($text_body)) { 129 + if (phutil_nonempty_string($text_body)) { 130 130 $guts['body'] = $text_body; 131 131 } 132 132 133 133 $html_body = $message->getHTMLBody(); 134 - if (strlen($html_body)) { 134 + if (phutil_nonempty_string($html_body)) { 135 135 $guts['html-body'] = $html_body; 136 136 } 137 137
+1 -1
src/applications/metamta/constants/MetaMTAReceivedMailStatus.php
··· 21 21 public static function getHumanReadableName($status) { 22 22 $map = array( 23 23 self::STATUS_DUPLICATE => pht('Duplicate Message'), 24 - self::STATUS_FROM_PHABRICATOR => pht('Phabricator Mail'), 24 + self::STATUS_FROM_PHABRICATOR => pht('Mail From Self'), 25 25 self::STATUS_NO_RECEIVERS => pht('No Receivers'), 26 26 self::STATUS_UNKNOWN_SENDER => pht('Unknown Sender'), 27 27 self::STATUS_DISABLED_SENDER => pht('Disabled Sender'),
+1 -1
src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php
··· 428 428 if ($actor_phid) { 429 429 $actor_str = $viewer->renderHandle($actor_phid); 430 430 } else { 431 - $actor_str = pht('Generated by Phabricator'); 431 + $actor_str = pht('Generated by Server'); 432 432 } 433 433 $properties->addProperty(pht('Actor'), $actor_str); 434 434
+16 -10
src/applications/metamta/engine/PhabricatorMailEmailEngine.php
··· 119 119 } 120 120 121 121 $body_limit = PhabricatorEnv::getEnvConfig('metamta.email-body-limit'); 122 + 123 + $body = phutil_string_cast($body); 122 124 if (strlen($body) > $body_limit) { 123 125 $body = id(new PhutilUTF8StringTruncator()) 124 126 ->setMaximumBytes($body_limit) ··· 143 145 144 146 if ($send_html) { 145 147 $html_body = $mail->getHTMLBody(); 146 - if (strlen($html_body)) { 148 + if (phutil_nonempty_string($html_body)) { 147 149 // NOTE: We just drop the entire HTML body if it won't fit. Safely 148 150 // truncating HTML is hard, and we already have the text body to fall 149 151 // back to. ··· 166 168 if (PhabricatorEnv::getEnvConfig('phabricator.silent')) { 167 169 $mail->setMessage( 168 170 pht( 169 - 'Phabricator is running in silent mode. See `%s` '. 171 + 'This software is running in silent mode. See `%s` '. 170 172 'in the configuration to change this setting.', 171 173 'phabricator.silent')); 172 174 ··· 226 228 $mail = $this->getMail(); 227 229 228 230 $reply_raw = $mail->getReplyTo(); 229 - if (!strlen($reply_raw)) { 231 + if (!phutil_nonempty_string($reply_raw)) { 230 232 return null; 231 233 } 232 234 ··· 241 243 242 244 // If we don't have a display name, fill in a default. 243 245 if (!strlen($reply_address->getDisplayName())) { 244 - $reply_address->setDisplayName(pht('Phabricator')); 246 + $reply_address->setDisplayName(PlatformSymbols::getPlatformServerName()); 245 247 } 246 248 247 249 return $reply_address; ··· 301 303 } 302 304 } 303 305 304 - $subject[] = trim($mail->getSubjectPrefix()); 306 + $subject_prefix = $mail->getSubjectPrefix(); 307 + $subject_prefix = phutil_string_cast($subject_prefix); 308 + $subject_prefix = trim($subject_prefix); 309 + 310 + $subject[] = $subject_prefix; 305 311 306 312 // If mail content must be encrypted, we replace the subject with 307 313 // a generic one. ··· 313 319 $subject[] = $encrypt_subject; 314 320 } else { 315 321 $vary_prefix = $mail->getVarySubjectPrefix(); 316 - if (strlen($vary_prefix)) { 322 + if (phutil_nonempty_string($vary_prefix)) { 317 323 if ($this->shouldVarySubject()) { 318 324 $subject[] = $vary_prefix; 319 325 } ··· 323 329 } 324 330 325 331 foreach ($subject as $key => $part) { 326 - if (!strlen($part)) { 332 + if (!phutil_nonempty_string($part)) { 327 333 unset($subject[$key]); 328 334 } 329 335 } ··· 403 409 $headers = array(); 404 410 405 411 $thread_id = $mail->getThreadID(); 406 - if (!strlen($thread_id)) { 412 + if (!phutil_nonempty_string($thread_id)) { 407 413 return $headers; 408 414 } 409 415 ··· 508 514 509 515 $address = new PhutilEmailAddress($raw_address); 510 516 511 - if (!strlen($address->getDisplayName())) { 512 - $address->setDisplayName(pht('Phabricator')); 517 + if (!phutil_nonempty_string($address->getDisplayName())) { 518 + $address->setDisplayName(PlatformSymbols::getPlatformServerName()); 513 519 } 514 520 515 521 return $address;
+1 -1
src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php
··· 6 6 protected function didConstruct() { 7 7 $this 8 8 ->setName('list-inbound') 9 - ->setSynopsis(pht('List inbound messages received by Phabricator.')) 9 + ->setSynopsis(pht('List inbound messages.')) 10 10 ->setExamples( 11 11 '**list-inbound**') 12 12 ->setArguments(
+1 -1
src/applications/metamta/management/PhabricatorMailManagementListOutboundWorkflow.php
··· 6 6 protected function didConstruct() { 7 7 $this 8 8 ->setName('list-outbound') 9 - ->setSynopsis(pht('List outbound messages sent by Phabricator.')) 9 + ->setSynopsis(pht('List outbound messages.')) 10 10 ->setExamples('**list-outbound**') 11 11 ->setArguments( 12 12 array(
+1
src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php
··· 81 81 } 82 82 83 83 private function stripQuotedText($body) { 84 + $body = phutil_string_cast($body); 84 85 85 86 // Look for "On <date>, <user> wrote:". This may be split across multiple 86 87 // lines. We need to be careful not to remove all of a message like this:
+17 -16
src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
··· 263 263 MetaMTAReceivedMailStatus::STATUS_UNKNOWN_SENDER, 264 264 pht( 265 265 'This email was sent from an email address ("%s") that is not '. 266 - 'associated with a Phabricator account. To interact with '. 267 - 'Phabricator via email, add this address to your account.', 266 + 'associated with a registered user account. To interact via '. 267 + 'email, add this address to your account.', 268 268 (string)$this->newFromAddress())); 269 269 } else { 270 270 throw new PhabricatorMetaMTAReceivedMailProcessingException( 271 271 MetaMTAReceivedMailStatus::STATUS_NO_RECEIVERS, 272 272 pht( 273 - 'Phabricator can not process this mail because no application '. 273 + 'This mail can not be processed because no application '. 274 274 'knows how to handle it. Check that the address you sent it to '. 275 - 'is correct.'. 276 - "\n\n". 277 - '(No concrete, enabled subclass of PhabricatorMailReceiver can '. 278 - 'accept this mail.)')); 275 + 'is correct.')); 279 276 } 280 277 } 281 278 } catch (PhabricatorMetaMTAReceivedMailProcessingException $ex) { ··· 348 345 349 346 private function getRawEmailAddresses($addresses) { 350 347 $raw_addresses = array(); 351 - foreach (explode(',', $addresses) as $address) { 352 - $raw_addresses[] = $this->getRawEmailAddress($address); 348 + 349 + if (phutil_nonempty_string($addresses)) { 350 + foreach (explode(',', $addresses) as $address) { 351 + $raw_addresses[] = $this->getRawEmailAddress($address); 352 + } 353 353 } 354 + 354 355 return array_filter($raw_addresses); 355 356 } 356 357 ··· 436 437 $status_code, 437 438 pht( 438 439 'Your message does not contain any body text or attachments, so '. 439 - 'Phabricator can not do anything useful with it. Make sure comment '. 440 + 'this server can not do anything useful with it. Make sure comment '. 440 441 'text appears at the top of your message: quoted replies, inline '. 441 442 'text, and signatures are discarded and ignored.')); 442 443 } ··· 484 485 $headers = implode("\n", $headers); 485 486 486 487 $body = pht(<<<EOBODY 487 - Your email to Phabricator was not processed, because an error occurred while 488 + Your email to %s was not processed, because an error occurred while 488 489 trying to handle it: 489 490 490 491 %s ··· 499 500 500 501 EOBODY 501 502 , 503 + PlatformSymbols::getPlatformServerName(), 502 504 wordwrap($description, 78), 503 505 $this->getRawTextBody(), 504 506 $headers); ··· 563 565 if ($sender->getIsDisabled()) { 564 566 $failure_reason = pht( 565 567 'Your account ("%s") is disabled, so you can not interact with '. 566 - 'Phabricator over email.', 568 + 'over email.', 567 569 $sender->getUsername()); 568 570 } else if ($sender->getIsStandardUser()) { 569 571 if (!$sender->getIsApproved()) { 570 572 $failure_reason = pht( 571 573 'Your account ("%s") has not been approved yet. You can not '. 572 - 'interact with Phabricator over email until your account is '. 573 - 'approved.', 574 + 'interact over email until your account is approved.', 574 575 $sender->getUsername()); 575 576 } else if (PhabricatorUserEmail::isEmailVerificationRequired() && 576 577 !$sender->getIsEmailVerified()) { 577 578 $failure_reason = pht( 578 579 'You have not verified the email address for your account ("%s"). '. 579 - 'You must verify your email address before you can interact '. 580 - 'with Phabricator over email.', 580 + 'You must verify your email address before you can interact over '. 581 + 'email.', 581 582 $sender->getUsername()); 582 583 } 583 584 }
+2 -2
src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php
··· 395 395 // We expect the HTML body was dropped completely after the text body was 396 396 // truncated. 397 397 $this->assertTrue( 398 - !strlen($html_body), 398 + !phutil_nonempty_string($html_body), 399 399 pht('HTML Body Removed')); 400 400 401 401 ··· 416 416 $html_body = $mailer->getHTMLBody(); 417 417 418 418 $this->assertEqual($string_1kb, $text_body); 419 - $this->assertTrue(!strlen($html_body)); 419 + $this->assertTrue(!phutil_nonempty_string($html_body)); 420 420 } 421 421 422 422 }
+2 -3
src/applications/metamta/util/PhabricatorMailUtil.php
··· 21 21 // If a mailbox prefix is configured and present, strip it off. 22 22 $prefix_key = 'metamta.single-reply-handler-prefix'; 23 23 $prefix = PhabricatorEnv::getEnvConfig($prefix_key); 24 - $len = strlen($prefix); 25 24 26 - if ($len) { 25 + if (phutil_nonempty_string($prefix)) { 27 26 $prefix = $prefix.'+'; 28 - $len = $len + 1; 27 + $len = strlen($prefix); 29 28 30 29 if (!strncasecmp($raw_address, $prefix, $len)) { 31 30 $raw_address = substr($raw_address, $len);
+1 -1
src/applications/settings/setting/PhabricatorEditorSetting.php
··· 42 42 } 43 43 44 44 public function validateTransactionValue($value) { 45 - if (!strlen($value)) { 45 + if (!phutil_nonempty_string($value)) { 46 46 return; 47 47 } 48 48
+4 -1
src/applications/settings/setting/PhabricatorSelectSetting.php
··· 47 47 } 48 48 49 49 final public function validateTransactionValue($value) { 50 + $value = phutil_string_cast($value); 50 51 if (!strlen($value)) { 51 52 return; 52 53 } ··· 66 67 } 67 68 68 69 public function getTransactionNewValue($value) { 70 + $value = phutil_string_cast($value); 71 + 69 72 if (!strlen($value)) { 70 73 return null; 71 74 } 72 75 73 - return (string)$value; 76 + return $value; 74 77 } 75 78 76 79 }
+1
src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php
··· 77 77 } 78 78 79 79 public function escapeStringForLikeClause($value) { 80 + $value = phutil_string_cast($value); 80 81 $value = addcslashes($value, '\%_'); 81 82 $value = $this->escapeUTF8String($value); 82 83 return $value;