Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2889987
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/repository/xaction/PhabricatorRepositoryEncodingTransaction.php b/src/applications/repository/xaction/PhabricatorRepositoryEncodingTransaction.php
index ef129da832..203b98abec 100644
--- a/src/applications/repository/xaction/PhabricatorRepositoryEncodingTransaction.php
+++ b/src/applications/repository/xaction/PhabricatorRepositoryEncodingTransaction.php
@@ -1,68 +1,68 @@
<?php
final class PhabricatorRepositoryEncodingTransaction
extends PhabricatorRepositoryTransactionType {
const TRANSACTIONTYPE = 'repo:encoding';
public function generateOldValue($object) {
return $object->getDetail('encoding');
}
public function applyInternalEffects($object, $value) {
$object->setDetail('encoding', $value);
}
public function getTitle() {
$old = $this->getOldValue();
$new = $this->getNewValue();
- if (strlen($old) && !strlen($new)) {
+ if ($old !== null && $new === null) {
return pht(
'%s removed the %s encoding configured for this repository.',
$this->renderAuthor(),
$this->renderOldValue());
- } else if (strlen($new) && !strlen($old)) {
+ } else if ($new !== null && $old === null) {
return pht(
'%s set the encoding for this repository to %s.',
$this->renderAuthor(),
$this->renderNewValue());
} else {
return pht(
'%s changed the repository encoding from %s to %s.',
$this->renderAuthor(),
$this->renderOldValue(),
$this->renderNewValue());
}
}
public function validateTransactions($object, array $xactions) {
$errors = array();
foreach ($xactions as $xaction) {
// Make sure the encoding is valid by converting to UTF-8. This tests
// that the user has mbstring installed, and also that they didn't
// type a garbage encoding name. Note that we're converting from
// UTF-8 to the target encoding, because mbstring is fine with
// converting from a nonsense encoding.
$encoding = $xaction->getNewValue();
if (!strlen($encoding)) {
continue;
}
try {
phutil_utf8_convert('.', $encoding, 'UTF-8');
} catch (Exception $ex) {
$errors[] = $this->newInvalidError(
pht(
'Repository encoding "%s" is not valid: %s',
$encoding,
$ex->getMessage()),
$xaction);
}
}
return $errors;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 12:55 (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1124799
Default Alt Text
(2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment