private static function parseRevisionIDFromURI($uri) { $path = id(new PhutilURI($uri))->getPath(); $matches = null; if (preg_match('#^/D(\\d+)$#', $path, $matches)) { $id = (int) $matches[1]; // Make sure the URI is the same as our URI. Basically, we want to ignore // commits from other Phabricator installs. if ($uri == PhabricatorEnv::getProductionURI('/D' . $id)) { return $id; } $allowed_uris = PhabricatorEnv::getAllowedURIs('/D' . $id); foreach ($allowed_uris as $allowed_uri) { if ($uri == $allowed_uri) { return $id; } } } return null; }