Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/conduit/method/path/getowners/ConduitAPI_path_getowners_Method.php b/src/applications/conduit/method/path/getowners/ConduitAPI_path_getowners_Method.php
index 50f34cc211..f507ccc474 100644
--- a/src/applications/conduit/method/path/getowners/ConduitAPI_path_getowners_Method.php
+++ b/src/applications/conduit/method/path/getowners/ConduitAPI_path_getowners_Method.php
@@ -1,84 +1,78 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ConduitAPI_path_getowners_Method extends ConduitAPIMethod {
public function getMethodDescription() {
- return "Find owners package given its name";
+ return "Find the Owners package that contains a given path.";
}
public function defineParamTypes() {
return array(
'repositoryCallsign' => 'required nonempty string',
'path' => 'required nonempty string'
);
}
public function defineReturnType() {
- return 'array of packages containing phid, primary_owner (phid=>username),'.
- 'owners(array of phid=>username)';
+ return
+ "array(".
+ "array(".
+ "'phid' => phid, ".
+ "'primaryOwner' => phid, ".
+ "'owners' => array(phid)))";
}
public function defineErrorTypes() {
return array(
'ERR_REP_NOT_FOUND' => 'The repository callsign is not recognized',
- 'ERR_PATH_NOT_FOUND' => 'The specified path is not known to any package',
+ 'ERR_PATH_NOT_FOUND' => 'The specified path is not in any package',
);
}
protected function execute(ConduitAPIRequest $request) {
$repository = id(new PhabricatorRepository())->loadOneWhere('callsign = %s',
$request->getValue('repositoryCallsign'));
if (empty($repository)) {
throw new ConduitException('ERR_REP_NOT_FOUND');
}
$packages = PhabricatorOwnersPackage::loadOwningPackages(
$repository, $request->getValue('path'));
if (empty($packages)) {
throw new ConduitException('ERR_PATH_NOT_FOUND');
}
- $owner = new PhabricatorOwnersOwner();
- $user = new PhabricatorUser();
$result = array();
foreach ($packages as $package) {
- $p_result = array();
- $p_result['phid'] = $package->getID();
- $primary_owner_phid = $package->getPrimaryOwnerPHID();
- if (!empty($primary_owner_phid)) {
- $p_user = $user->loadOneWhere('phid = %s',
- $primary_owner_phid);
- $p_result['primaryOwner'] = $p_user->getPhid();
- }
-
- $p_owners = $owner->loadAllForPackages(array($package));
- $p_users = $user->loadAllWhere('phid IN (%Ls)',
- mpull($p_owners, 'getUserPHID'));
-
- $p_result['owners'] = array_values(mpull($p_users, 'getPhid'));
-
- $result[] = $p_result;
+ $p_owners =
+ id(new PhabricatorOwnersOwner())->loadAllForPackages(array($package));
+
+ $result[] = array(
+ 'phid' => $package->getPHID(),
+ 'primaryOwner' => $package->getPrimaryOwnerPHID(),
+ 'owners' => array_values(mpull($p_owners, 'getUserPHID')),
+ );
}
return $result;
}
}
diff --git a/src/applications/conduit/method/path/getowners/__init__.php b/src/applications/conduit/method/path/getowners/__init__.php
index 0ca5823ef3..04e759ac75 100644
--- a/src/applications/conduit/method/path/getowners/__init__.php
+++ b/src/applications/conduit/method/path/getowners/__init__.php
@@ -1,19 +1,18 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/conduit/method/base');
phutil_require_module('phabricator', 'applications/conduit/protocol/exception');
phutil_require_module('phabricator', 'applications/owners/storage/owner');
phutil_require_module('phabricator', 'applications/owners/storage/package');
-phutil_require_module('phabricator', 'applications/people/storage/user');
phutil_require_module('phabricator', 'applications/repository/storage/repository');
phutil_require_module('phutil', 'utils');
phutil_require_source('ConduitAPI_path_getowners_Method.php');

File Metadata

Mime Type
text/x-diff
Expires
Wed, Jul 2, 8:27 PM (21 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
165131
Default Alt Text
(4 KB)

Event Timeline