mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Merge branch 'master' of github.com:facebook/phabricator
This commit is contained in:
commit
90e10f4d0c
41 changed files with 130 additions and 85 deletions
|
@ -14,6 +14,10 @@
|
|||
"aphront" : "Aphront (Web Stack)",
|
||||
"console" : "DarkConsole (Debugging Console)",
|
||||
"storage" : "Storage"
|
||||
}
|
||||
},
|
||||
"engines" : [
|
||||
["DivinerArticleEngine", {}],
|
||||
["DivinerXHPEngine", {}]
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -226,6 +226,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorObjectSelectorDialog' => 'view/control/objectselector',
|
||||
'PhabricatorPHID' => 'applications/phid/storage/phid',
|
||||
'PhabricatorPHIDAllocateController' => 'applications/phid/controller/allocate',
|
||||
'PhabricatorPHIDConstants' => 'applications/phid/constants',
|
||||
'PhabricatorPHIDController' => 'applications/phid/controller/base',
|
||||
'PhabricatorPHIDDAO' => 'applications/phid/storage/base',
|
||||
'PhabricatorPHIDListController' => 'applications/phid/controller/list',
|
||||
|
|
|
@ -38,7 +38,8 @@ class DifferentialAttachController extends DifferentialController {
|
|||
|
||||
if ($request->isFormPost()) {
|
||||
$phids = explode(';', $request->getStr('phids'));
|
||||
$old_phids = $revision->getAttachedPHIDs('TASK');
|
||||
$old_phids = $revision->getAttachedPHIDs(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_TASK);
|
||||
|
||||
if (($phids || $old_phids) && ($phids != $old_phids)) {
|
||||
$tasks = id(new ManiphestTask())->loadAllWhere(
|
||||
|
@ -59,22 +60,24 @@ class DifferentialAttachController extends DifferentialController {
|
|||
$transaction->setAuthorPHID($user->getPHID());
|
||||
$transaction->setTransactionType($type);
|
||||
$new = $task->getAttached();
|
||||
if (empty($new['DREV'])) {
|
||||
$new['DREV'] = array();
|
||||
if (empty($new[PhabricatorPHIDConstants::PHID_TYPE_DREV])) {
|
||||
$new[PhabricatorPHIDConstants::PHID_TYPE_DREV] = array();
|
||||
}
|
||||
$rev_phid = $revision->getPHID();
|
||||
if (in_array($task->getPHID(), $phids)) {
|
||||
if (in_array($rev_phid, $task->getAttachedPHIDs('DREV'))) {
|
||||
if (in_array($rev_phid, $task->getAttachedPHIDs(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_DREV))) {
|
||||
// TODO: maybe the transaction editor should be responsible for
|
||||
// this?
|
||||
continue;
|
||||
}
|
||||
$new['DREV'][$rev_phid] = array();
|
||||
$new[PhabricatorPHIDConstants::PHID_TYPE_DREV][$rev_phid] = array();
|
||||
} else {
|
||||
if (!in_array($rev_phid, $task->getAttachedPHIDs('DREV'))) {
|
||||
if (!in_array($rev_phid, $task->getAttachedPHIDs(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_DREV))) {
|
||||
continue;
|
||||
}
|
||||
unset($new['DREV'][$rev_phid]);
|
||||
unset($new[PhabricatorPHIDConstants::PHID_TYPE_DREV][$rev_phid]);
|
||||
}
|
||||
$transaction->setNewValue($new);
|
||||
$editor->applyTransactions($task, array($transaction));
|
||||
|
|
|
@ -15,6 +15,7 @@ phutil_require_module('phabricator', 'applications/maniphest/constants/transacti
|
|||
phutil_require_module('phabricator', 'applications/maniphest/editor/transaction');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/task');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/transaction');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'view/control/objectselector');
|
||||
|
||||
|
|
|
@ -234,7 +234,8 @@ class DifferentialRevisionViewController extends DifferentialController {
|
|||
$umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
|
||||
$properties['Unit'] = $ustar.' '.$umsg;
|
||||
|
||||
$tasks = $revision->getAttachedPHIDs('TASK');
|
||||
$tasks = $revision->getAttachedPHIDs(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_TASK);
|
||||
if ($tasks) {
|
||||
$links = array();
|
||||
foreach ($tasks as $task_phid) {
|
||||
|
|
|
@ -21,6 +21,7 @@ phutil_require_module('phabricator', 'applications/differential/view/revisioncom
|
|||
phutil_require_module('phabricator', 'applications/differential/view/revisiondetail');
|
||||
phutil_require_module('phabricator', 'applications/differential/view/revisionupdatehistory');
|
||||
phutil_require_module('phabricator', 'applications/draft/storage/draft');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
|
|
|
@ -62,7 +62,8 @@ class DifferentialRevision extends DifferentialDAO {
|
|||
}
|
||||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID('DREV');
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_DREV);
|
||||
}
|
||||
|
||||
public function loadDiffs() {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
phutil_require_module('phabricator', 'applications/differential/storage/base');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/comment');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/diff');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/phid');
|
||||
phutil_require_module('phabricator', 'storage/queryfx');
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@ class PhabricatorFile extends PhabricatorFileDAO {
|
|||
|
||||
const STORAGE_FORMAT_RAW = 'raw';
|
||||
|
||||
const PHID_TYPE = 'FILE';
|
||||
|
||||
// TODO: We need to reconcile this with MySQL packet size.
|
||||
const FILE_SIZE_BYTE_LIMIT = 12582912;
|
||||
|
||||
|
@ -43,7 +41,8 @@ class PhabricatorFile extends PhabricatorFileDAO {
|
|||
}
|
||||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID(self::PHID_TYPE);
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_FILE);
|
||||
}
|
||||
|
||||
public static function newFromPHPUpload($spec, array $params = array()) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
phutil_require_module('phabricator', 'applications/files/storage/base');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/storageblob');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/phid');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
|
||||
|
|
|
@ -107,8 +107,8 @@ class ManiphestTaskDetailController extends ManiphestController {
|
|||
$dict['Projects'] = '<em>None</em>';
|
||||
}
|
||||
|
||||
if (idx($attached, 'DREV')) {
|
||||
$revs = idx($attached, 'DREV');
|
||||
if (idx($attached, PhabricatorPHIDConstants::PHID_TYPE_DREV)) {
|
||||
$revs = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_DREV);
|
||||
$rev_links = array();
|
||||
foreach ($revs as $rev => $info) {
|
||||
$rev_links[] = $handles[$rev]->renderLink();
|
||||
|
@ -117,8 +117,8 @@ class ManiphestTaskDetailController extends ManiphestController {
|
|||
$dict['Revisions'] = $rev_links;
|
||||
}
|
||||
|
||||
if (idx($attached, 'FILE')) {
|
||||
$revs = idx($attached, 'FILE');
|
||||
if (idx($attached, PhabricatorPHIDConstants::PHID_TYPE_FILE)) {
|
||||
$revs = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_FILE);
|
||||
$rev_links = array();
|
||||
foreach ($revs as $rev => $info) {
|
||||
$rev_links[] = $handles[$rev]->renderLink();
|
||||
|
|
|
@ -14,6 +14,7 @@ phutil_require_module('phabricator', 'applications/maniphest/controller/base');
|
|||
phutil_require_module('phabricator', 'applications/maniphest/storage/task');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/transaction');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/view/transactionlist');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||
|
|
|
@ -24,7 +24,7 @@ class ManiphestTaskSelectorSearchController extends ManiphestController {
|
|||
|
||||
$query = new PhabricatorSearchQuery();
|
||||
$query->setQuery($request->getStr('query'));
|
||||
$query->setParameter('type', 'TASK');
|
||||
$query->setParameter('type', PhabricatorPHIDConstants::PHID_TYPE_TASK);
|
||||
|
||||
switch ($request->getStr('filter')) {
|
||||
case 'assigned':
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
phutil_require_module('phabricator', 'aphront/response/ajax');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/view/selector');
|
||||
phutil_require_module('phabricator', 'applications/search/execute/mysql');
|
||||
|
|
|
@ -76,10 +76,10 @@ class ManiphestTransactionSaveController extends ManiphestController {
|
|||
}
|
||||
if ($phid) {
|
||||
$new = $task->getAttached();
|
||||
if (empty($new['FILE'])) {
|
||||
$new['FILE'] = array();
|
||||
if (empty($new[PhabricatorPHIDConstants::PHID_TYPE_FILE])) {
|
||||
$new[PhabricatorPHIDConstants::PHID_TYPE_FILE] = array();
|
||||
}
|
||||
$new['FILE'][$phid] = array();
|
||||
$new[PhabricatorPHIDConstants::PHID_TYPE_FILE][$phid] = array();
|
||||
}
|
||||
|
||||
$transaction->setNewValue($new);
|
||||
|
|
|
@ -14,6 +14,7 @@ phutil_require_module('phabricator', 'applications/maniphest/controller/base');
|
|||
phutil_require_module('phabricator', 'applications/maniphest/editor/transaction');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/task');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/transaction');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
|
|
@ -48,7 +48,8 @@ class ManiphestTask extends ManiphestDAO {
|
|||
}
|
||||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID('TASK');
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_TASK);
|
||||
}
|
||||
|
||||
public function getCCPHIDs() {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/base');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/phid');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
|
|
@ -266,7 +266,8 @@ class ManiphestTransactionDetailView extends AphrontView {
|
|||
$old_raw = nonempty($old, array());
|
||||
$new_raw = nonempty($new, array());
|
||||
|
||||
foreach (array('DREV', 'FILE') as $type) {
|
||||
foreach (array(PhabricatorPHIDConstants::PHID_TYPE_DREV,
|
||||
PhabricatorPHIDConstants::PHID_TYPE_FILE) as $type) {
|
||||
$old = array_keys(idx($old_raw, $type, array()));
|
||||
$new = array_keys(idx($new_raw, $type, array()));
|
||||
if ($old != $new) {
|
||||
|
@ -281,11 +282,11 @@ class ManiphestTransactionDetailView extends AphrontView {
|
|||
$rem_desc = $this->renderHandles($removed);
|
||||
|
||||
switch ($type) {
|
||||
case 'DREV':
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_DREV:
|
||||
$singular = 'Differential Revision';
|
||||
$plural = 'Differential Revisions';
|
||||
break;
|
||||
case 'FILE':
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_FILE:
|
||||
$singular = 'file';
|
||||
$plural = 'files';
|
||||
break;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
phutil_require_module('phabricator', 'applications/maniphest/constants/priority');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'view/base');
|
||||
phutil_require_module('phabricator', 'view/utils');
|
||||
|
|
|
@ -18,15 +18,14 @@
|
|||
|
||||
class PhabricatorMetaMTAMailingList extends PhabricatorMetaMTADAO {
|
||||
|
||||
const TYPE_MAILING_LIST = 'MLST';
|
||||
|
||||
protected $name;
|
||||
protected $phid;
|
||||
protected $email;
|
||||
protected $uri;
|
||||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID(self::TYPE_MAILING_LIST);
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_MLST);
|
||||
}
|
||||
|
||||
public function getConfiguration() {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/metamta/storage/base');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/phid');
|
||||
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
class PhabricatorUser extends PhabricatorUserDAO {
|
||||
|
||||
const PHID_TYPE = 'USER';
|
||||
|
||||
const SESSION_TABLE = 'phabricator_session';
|
||||
|
||||
protected $phid;
|
||||
|
@ -49,7 +47,8 @@ class PhabricatorUser extends PhabricatorUserDAO {
|
|||
}
|
||||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID(self::PHID_TYPE);
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_USER);
|
||||
}
|
||||
|
||||
public function setPassword($password) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/people/storage/base');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/phid');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'storage/queryfx');
|
||||
|
|
30
src/applications/phid/constants/PhabricatorPHIDConstants.php
Normal file
30
src/applications/phid/constants/PhabricatorPHIDConstants.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?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.
|
||||
*/
|
||||
|
||||
final class PhabricatorPHIDConstants {
|
||||
|
||||
const PHID_TYPE_USER = 'USER';
|
||||
const PHID_TYPE_MLST = 'MLST';
|
||||
const PHID_TYPE_DREV = 'DREV';
|
||||
const PHID_TYPE_TASK = 'TASK';
|
||||
const PHID_TYPE_FILE = 'FILE';
|
||||
const PHID_TYPE_PROJ = 'PROJ';
|
||||
const PHID_TYPE_UNKNOWN = '????';
|
||||
const PHID_TYPE_MAGIC = '!!!!';
|
||||
|
||||
}
|
10
src/applications/phid/constants/__init__.php
Normal file
10
src/applications/phid/constants/__init__.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
phutil_require_source('PhabricatorPHIDConstants.php');
|
|
@ -95,7 +95,7 @@ class PhabricatorObjectHandle {
|
|||
public function renderLink() {
|
||||
|
||||
switch ($this->getType()) {
|
||||
case 'USER':
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_USER:
|
||||
$name = $this->getName();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
class PhabricatorObjectHandleData {
|
||||
|
||||
const TYPE_UNKNOWN = '????';
|
||||
|
||||
private $phids;
|
||||
|
||||
public function __construct(array $phids) {
|
||||
|
@ -38,7 +36,7 @@ class PhabricatorObjectHandleData {
|
|||
|
||||
foreach ($types as $type => $phids) {
|
||||
switch ($type) {
|
||||
case '!!!!':
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_MAGIC:
|
||||
// Black magic!
|
||||
foreach ($phids as $phid) {
|
||||
$handle = new PhabricatorObjectHandle();
|
||||
|
@ -55,7 +53,7 @@ class PhabricatorObjectHandleData {
|
|||
$handles[$phid] = $handle;
|
||||
}
|
||||
break;
|
||||
case 'USER':
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_USER:
|
||||
$class = 'PhabricatorUser';
|
||||
PhutilSymbolLoader::loadClass($class);
|
||||
$object = newv($class, array());
|
||||
|
@ -86,7 +84,7 @@ class PhabricatorObjectHandleData {
|
|||
$handles[$phid] = $handle;
|
||||
}
|
||||
break;
|
||||
case 'MLST':
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_MLST:
|
||||
$class = 'PhabricatorMetaMTAMailingList';
|
||||
|
||||
PhutilSymbolLoader::loadClass($class);
|
||||
|
@ -111,7 +109,7 @@ class PhabricatorObjectHandleData {
|
|||
$handles[$phid] = $handle;
|
||||
}
|
||||
break;
|
||||
case 'DREV':
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_DREV:
|
||||
$class = 'DifferentialRevision';
|
||||
PhutilSymbolLoader::loadClass($class);
|
||||
$object = newv($class, array());
|
||||
|
@ -134,7 +132,7 @@ class PhabricatorObjectHandleData {
|
|||
$handles[$phid] = $handle;
|
||||
}
|
||||
break;
|
||||
case 'TASK':
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_TASK:
|
||||
$class = 'ManiphestTask';
|
||||
PhutilSymbolLoader::loadClass($class);
|
||||
$object = newv($class, array());
|
||||
|
@ -157,7 +155,7 @@ class PhabricatorObjectHandleData {
|
|||
$handles[$phid] = $handle;
|
||||
}
|
||||
break;
|
||||
case 'FILE':
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_FILE:
|
||||
$class = 'PhabricatorFile';
|
||||
PhutilSymbolLoader::loadClass($class);
|
||||
$object = newv($class, array());
|
||||
|
@ -179,7 +177,7 @@ class PhabricatorObjectHandleData {
|
|||
$handles[$phid] = $handle;
|
||||
}
|
||||
break;
|
||||
case 'PROJ':
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_PROJ:
|
||||
$class = 'PhabricatorProject';
|
||||
PhutilSymbolLoader::loadClass($class);
|
||||
$object = newv($class, array());
|
||||
|
@ -222,7 +220,7 @@ class PhabricatorObjectHandleData {
|
|||
if (preg_match('/^PHID-([^-]{4})-/', $phid, $matches)) {
|
||||
return $matches[1];
|
||||
}
|
||||
return self::TYPE_UNKNOWN;
|
||||
return PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle');
|
||||
|
||||
phutil_require_module('phutil', 'symbols');
|
||||
|
|
|
@ -29,7 +29,8 @@ class PhabricatorProject extends PhabricatorProjectDAO {
|
|||
}
|
||||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID('PROJ');
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_PROJ);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/phid');
|
||||
phutil_require_module('phabricator', 'applications/project/storage/base');
|
||||
|
||||
|
|
|
@ -67,8 +67,8 @@ class PhabricatorSearchController extends PhabricatorSearchBaseController {
|
|||
|
||||
$options = array(
|
||||
'' => 'All Documents',
|
||||
'DREV' => 'Differential Revisions',
|
||||
'TASK' => 'Maniphest Tasks',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_DREV => 'Differential Revisions',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_TASK => 'Maniphest Tasks',
|
||||
);
|
||||
|
||||
$status_options = array(
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
phutil_require_module('phabricator', 'aphront/response/404');
|
||||
phutil_require_module('phabricator', 'aphront/response/redirect');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'applications/search/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/search/execute/mysql');
|
||||
|
|
|
@ -22,7 +22,7 @@ class PhabricatorSearchDifferentialIndexer
|
|||
public static function indexRevision(DifferentialRevision $rev) {
|
||||
$doc = new PhabricatorSearchAbstractDocument();
|
||||
$doc->setPHID($rev->getPHID());
|
||||
$doc->setDocumentType('DREV');
|
||||
$doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_DREV);
|
||||
$doc->setDocumentTitle($rev->getTitle());
|
||||
$doc->setDocumentCreated($rev->getDateCreated());
|
||||
$doc->setDocumentModified($rev->getDateModified());
|
||||
|
@ -37,7 +37,7 @@ class PhabricatorSearchDifferentialIndexer
|
|||
$doc->addRelationship(
|
||||
PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
|
||||
$rev->getAuthorPHID(),
|
||||
'USER',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_USER,
|
||||
$rev->getDateCreated());
|
||||
|
||||
if ($rev->getStatus() != DifferentialRevisionStatus::COMMITTED &&
|
||||
|
@ -45,7 +45,7 @@ class PhabricatorSearchDifferentialIndexer
|
|||
$doc->addRelationship(
|
||||
PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
|
||||
$rev->getPHID(),
|
||||
'DREV',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_DREV,
|
||||
time());
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class PhabricatorSearchDifferentialIndexer
|
|||
$doc->addRelationship(
|
||||
PhabricatorSearchRelationship::RELATIONSHIP_TOUCH,
|
||||
$touch,
|
||||
'USER',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_USER,
|
||||
$time);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ class PhabricatorSearchDifferentialIndexer
|
|||
$doc->addRelationship(
|
||||
PhabricatorSearchRelationship::RELATIONSHIP_OWNER,
|
||||
$phid,
|
||||
'USER',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_USER,
|
||||
$rev->getDateModified()); // Bogus timestamp.
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
phutil_require_module('phabricator', 'applications/differential/constants/revisionstatus');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/inlinecomment');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'applications/search/constants/field');
|
||||
phutil_require_module('phabricator', 'applications/search/constants/relationship');
|
||||
|
|
|
@ -22,7 +22,7 @@ class PhabricatorSearchManiphestIndexer
|
|||
public static function indexTask(ManiphestTask $task) {
|
||||
$doc = new PhabricatorSearchAbstractDocument();
|
||||
$doc->setPHID($task->getPHID());
|
||||
$doc->setDocumentType('TASK');
|
||||
$doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_TASK);
|
||||
$doc->setDocumentTitle($task->getTitle());
|
||||
$doc->setDocumentCreated($task->getDateCreated());
|
||||
$doc->setDocumentModified($task->getDateModified());
|
||||
|
@ -34,14 +34,14 @@ class PhabricatorSearchManiphestIndexer
|
|||
$doc->addRelationship(
|
||||
PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
|
||||
$task->getAuthorPHID(),
|
||||
'USER',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_USER,
|
||||
$task->getDateCreated());
|
||||
|
||||
if ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) {
|
||||
$doc->addRelationship(
|
||||
PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
|
||||
$task->getPHID(),
|
||||
'TASK',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_TASK,
|
||||
time());
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ class PhabricatorSearchManiphestIndexer
|
|||
$doc->addRelationship(
|
||||
PhabricatorSearchRelationship::RELATIONSHIP_PROJECT,
|
||||
$phid,
|
||||
'PROJ',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_PROJ,
|
||||
$task->getDateModified()); // Bogus.
|
||||
}
|
||||
|
||||
|
@ -95,13 +95,13 @@ class PhabricatorSearchManiphestIndexer
|
|||
$doc->addRelationship(
|
||||
PhabricatorSearchRelationship::RELATIONSHIP_OWNER,
|
||||
$owner->getNewValue(),
|
||||
'USER',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_USER,
|
||||
$owner->getDateCreated());
|
||||
} else {
|
||||
$doc->addRelationship(
|
||||
PhabricatorSearchRelationship::RELATIONSHIP_OWNER,
|
||||
'PHID-!!!!-UP-FOR-GRABS',
|
||||
'!!!!',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_MAGIC,
|
||||
$owner
|
||||
? $owner->getDateCreated()
|
||||
: $task->getDateCreated());
|
||||
|
@ -111,7 +111,7 @@ class PhabricatorSearchManiphestIndexer
|
|||
$doc->addRelationship(
|
||||
PhabricatorSearchRelationship::RELATIONSHIP_TOUCH,
|
||||
$touch,
|
||||
'USER',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_USER,
|
||||
$time);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/transaction');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'applications/search/constants/field');
|
||||
phutil_require_module('phabricator', 'applications/search/constants/relationship');
|
||||
|
|
|
@ -36,21 +36,15 @@ abstract class AphrontDatabaseConnection {
|
|||
abstract public function escapeStringForLikeClause($string);
|
||||
|
||||
public function queryData($pattern/*, $arg, $arg, ... */) {
|
||||
if (false) {
|
||||
// Workaround for the HPHP workaround: ensure we include this module
|
||||
// since we really are using the function.
|
||||
queryfx($this, $pattern);
|
||||
}
|
||||
|
||||
$args = func_get_args();
|
||||
array_unshift($args, $this);
|
||||
return hphp_workaround_call_user_func_array('queryfx_all', $args);
|
||||
return call_user_func_array('queryfx_all', $args);
|
||||
}
|
||||
|
||||
public function query($pattern/*, $arg, $arg, ... */) {
|
||||
$args = func_get_args();
|
||||
array_unshift($args, $this);
|
||||
return hphp_workaround_call_user_func_array('queryfx', $args);
|
||||
return call_user_func_array('queryfx', $args);
|
||||
}
|
||||
|
||||
// TODO: Probably need to reset these when we catch a connection exception
|
||||
|
|
|
@ -20,14 +20,8 @@
|
|||
* @group storage
|
||||
*/
|
||||
function queryfx(AphrontDatabaseConnection $conn, $sql/*, ... */) {
|
||||
if (false) {
|
||||
// Workaround for the HPHP workaround: ensure we include this module
|
||||
// since we really are using the function.
|
||||
qsprintf($conn, $sql);
|
||||
}
|
||||
|
||||
$argv = func_get_args();
|
||||
$query = hphp_workaround_call_user_func_array('qsprintf', $argv);
|
||||
$query = call_user_func_array('qsprintf', $argv);
|
||||
$conn->executeRawQuery($query);
|
||||
}
|
||||
|
||||
|
@ -36,7 +30,7 @@ function queryfx(AphrontDatabaseConnection $conn, $sql/*, ... */) {
|
|||
*/
|
||||
function vqueryfx($conn, $sql, $argv) {
|
||||
array_unshift($argv, $conn, $sql);
|
||||
hphp_workaround_call_user_func_array('queryfx', $argv);
|
||||
call_user_func_array('queryfx', $argv);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +38,7 @@ function vqueryfx($conn, $sql, $argv) {
|
|||
*/
|
||||
function queryfx_all($conn, $sql/*, ... */) {
|
||||
$argv = func_get_args();
|
||||
hphp_workaround_call_user_func_array('queryfx', $argv);
|
||||
call_user_func_array('queryfx', $argv);
|
||||
return $conn->selectAllResults();
|
||||
}
|
||||
|
||||
|
@ -53,7 +47,7 @@ function queryfx_all($conn, $sql/*, ... */) {
|
|||
*/
|
||||
function queryfx_one($conn, $sql/*, ... */) {
|
||||
$argv = func_get_args();
|
||||
$ret = hphp_workaround_call_user_func_array('queryfx_all', $argv);
|
||||
$ret = call_user_func_array('queryfx_all', $argv);
|
||||
if (count($ret) > 1) {
|
||||
throw new AphrontQueryCountException(
|
||||
'Query returned more than one row.');
|
||||
|
@ -65,6 +59,6 @@ function queryfx_one($conn, $sql/*, ... */) {
|
|||
|
||||
function vqueryfx_all($conn, $sql, array $argv) {
|
||||
array_unshift($argv, $conn, $sql);
|
||||
hphp_workaround_call_user_func_array('queryfx', $argv);
|
||||
call_user_func_array('queryfx', $argv);
|
||||
return $conn->selectAllResults();
|
||||
}
|
||||
|
|
|
@ -176,12 +176,3 @@ function phabricator_fatal_config_error($msg) {
|
|||
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Workaround for HipHop bug, see Facebook Task #503624.
|
||||
*/
|
||||
function hphp_workaround_call_user_func_array($func, array $array) {
|
||||
$f = new ReflectionFunction($func);
|
||||
return $f->invokeArgs($array);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue