Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/editor/PhabricatorRepositoryEditor.php
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | final class PhabricatorRepositoryEditor | ||||
protected function applyFinalEffects( | protected function applyFinalEffects( | ||||
PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
array $xactions) { | array $xactions) { | ||||
// If the repository does not have a local path yet, assign it one based | // If the repository does not have a local path yet, assign it one based | ||||
// on its ID. We can't do this earlier because we won't have an ID yet. | // on its ID. We can't do this earlier because we won't have an ID yet. | ||||
$local_path = $object->getLocalPath(); | $local_path = $object->getLocalPath(); | ||||
if (!strlen($local_path)) { | if (!phutil_nonempty_string($local_path)) { | ||||
valerio.bozzolan: ✅ I verified the above line
The `$local_path` assumes strings like `/var/repo/9/` or null. | |||||
$local_key = 'repository.default-local-path'; | $local_key = 'repository.default-local-path'; | ||||
$local_root = PhabricatorEnv::getEnvConfig($local_key); | $local_root = PhabricatorEnv::getEnvConfig($local_key); | ||||
$local_root = rtrim($local_root, '/'); | $local_root = rtrim($local_root, '/'); | ||||
$id = $object->getID(); | $id = $object->getID(); | ||||
$local_path = "{$local_root}/{$id}/"; | $local_path = "{$local_root}/{$id}/"; | ||||
Show All 30 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
✅ I verified the above line
The $local_path assumes strings like /var/repo/9/ or null.
The function phutil_nonempty_string() will report any alien type, and that is OK.