mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-17 10:11:10 +01:00
Removed "PHID Types" storage object and interface components
Summary: Removed because code wasn't used or really needed. Test Plan: * Tested that "PHID List" and "PHID Lookup" pages work correctly. * Tested that new PHIDs can be allocated with the predefined set of types Reviewed By: epriestley Reviewers: epriestley CC: epriestley Differential Revision: 88
This commit is contained in:
parent
c795aaea29
commit
123fdabb75
14 changed files with 19 additions and 286 deletions
|
@ -841,7 +841,7 @@ CREATE TABLE `directory_item` (
|
|||
|
||||
LOCK TABLES `directory_item` WRITE;
|
||||
/*!40000 ALTER TABLE `directory_item` DISABLE KEYS */;
|
||||
INSERT INTO `directory_item` VALUES (1,'Repositories','Configure tracked source code repositories.','/repository/',1,0,NULL,0,0),(5,'libphutil Docs','Developer documentation for libphutil.','http://phutil.com/libphutil/docs/',2,0,'',1295312416,1295320996),(12,'Files','Blob store for files.','/file/',5,0,'',1295321244,1295816742),(13,'Differential','Code review tool.','/differential/',4,0,'',1295321263,1295321263),(14,'PHID Manager','Manage PHIDs and types.','/phid/',6,0,'',1295762315,1295888577),(15,'People','User directory.','/people/',4,3000,'',1295830520,1295830528),(16,'Conduit Console','Web console for Conduit API.','/conduit/',6,0,'',1295888593,1295888593),(17,'MetaMTA','Yo dawg, we heard you like MTAs...','/mail/',6,0,'',1296006261,1296056065),(18,'XHProf','PHP profiling tool.','/xhprof/',6,0,NULL,1296684238,1296684238),(20,'Maniphest','Construct lists of lists.','/maniphest/',4,0,NULL,1297190663,1297190663);
|
||||
INSERT INTO `directory_item` VALUES (1,'Repositories','Configure tracked source code repositories.','/repository/',1,0,NULL,0,0),(5,'libphutil Docs','Developer documentation for libphutil.','http://phutil.com/libphutil/docs/',2,0,'',1295312416,1295320996),(12,'Files','Blob store for files.','/file/',5,0,'',1295321244,1295816742),(13,'Differential','Code review tool.','/differential/',4,0,'',1295321263,1295321263),(14,'PHID Manager','Manage PHIDs.','/phid/',6,0,'',1295762315,1295888577),(15,'People','User directory.','/people/',4,3000,'',1295830520,1295830528),(16,'Conduit Console','Web console for Conduit API.','/conduit/',6,0,'',1295888593,1295888593),(17,'MetaMTA','Yo dawg, we heard you like MTAs...','/mail/',6,0,'',1296006261,1296056065),(18,'XHProf','PHP profiling tool.','/xhprof/',6,0,NULL,1296684238,1296684238),(20,'Maniphest','Construct lists of lists.','/maniphest/',4,0,NULL,1297190663,1297190663);
|
||||
/*!40000 ALTER TABLE `directory_item` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
|
1
resources/sql/patches/012.dropphidtype.sql
Normal file
1
resources/sql/patches/012.dropphidtype.sql
Normal file
|
@ -0,0 +1 @@
|
|||
DROP TABLE phabricator_phid.phid_type;
|
|
@ -318,9 +318,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPHIDDAO' => 'applications/phid/storage/base',
|
||||
'PhabricatorPHIDListController' => 'applications/phid/controller/list',
|
||||
'PhabricatorPHIDLookupController' => 'applications/phid/controller/lookup',
|
||||
'PhabricatorPHIDType' => 'applications/phid/storage/type',
|
||||
'PhabricatorPHIDTypeEditController' => 'applications/phid/controller/typeedit',
|
||||
'PhabricatorPHIDTypeListController' => 'applications/phid/controller/typelist',
|
||||
'PhabricatorPeopleController' => 'applications/people/controller/base',
|
||||
'PhabricatorPeopleEditController' => 'applications/people/controller/edit',
|
||||
'PhabricatorPeopleListController' => 'applications/people/controller/list',
|
||||
|
@ -654,9 +651,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPHIDDAO' => 'PhabricatorLiskDAO',
|
||||
'PhabricatorPHIDListController' => 'PhabricatorPHIDController',
|
||||
'PhabricatorPHIDLookupController' => 'PhabricatorPHIDController',
|
||||
'PhabricatorPHIDType' => 'PhabricatorPHIDDAO',
|
||||
'PhabricatorPHIDTypeEditController' => 'PhabricatorPHIDController',
|
||||
'PhabricatorPHIDTypeListController' => 'PhabricatorPHIDController',
|
||||
'PhabricatorPeopleController' => 'PhabricatorController',
|
||||
'PhabricatorPeopleEditController' => 'PhabricatorPeopleController',
|
||||
'PhabricatorPeopleListController' => 'PhabricatorPeopleController',
|
||||
|
|
|
@ -59,8 +59,6 @@ class AphrontDefaultApplicationConfiguration
|
|||
'/phid/' => array(
|
||||
'$' => 'PhabricatorPHIDLookupController',
|
||||
'list/$' => 'PhabricatorPHIDListController',
|
||||
'type/$' => 'PhabricatorPHIDTypeListController',
|
||||
'type/edit/(?:(?P<id>\d+)/)?$' => 'PhabricatorPHIDTypeEditController',
|
||||
'new/$' => 'PhabricatorPHIDAllocateController',
|
||||
),
|
||||
'/people/' => array(
|
||||
|
|
|
@ -29,4 +29,18 @@ final class PhabricatorPHIDConstants {
|
|||
const PHID_TYPE_REPO = 'REPO';
|
||||
const PHID_TYPE_CMIT = 'CMIT';
|
||||
|
||||
public static function getTypes() {
|
||||
return array(
|
||||
self::PHID_TYPE_USER,
|
||||
self::PHID_TYPE_MLST,
|
||||
self::PHID_TYPE_DREV,
|
||||
self::PHID_TYPE_TASK,
|
||||
self::PHID_TYPE_FILE,
|
||||
self::PHID_TYPE_PROJ,
|
||||
self::PHID_TYPE_UNKNOWN,
|
||||
self::PHID_TYPE_MAGIC,
|
||||
self::PHID_TYPE_REPO,
|
||||
self::PHID_TYPE_CMIT,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ class PhabricatorPHIDAllocateController
|
|||
->setURI('/phid/?phid='.phutil_escape_uri($phid));
|
||||
}
|
||||
|
||||
$types = id(new PhabricatorPHIDType())->loadAll();
|
||||
$types = PhabricatorPHIDConstants::getTypes();
|
||||
|
||||
$options = array();
|
||||
foreach ($types as $type) {
|
||||
$options[$type->getType()] = $type->getType().': '.$type->getName();
|
||||
$options[$type] = $type;
|
||||
}
|
||||
asort($options);
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
|
||||
phutil_require_module('phabricator', 'aphront/response/redirect');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'applications/phid/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/phid');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/type');
|
||||
phutil_require_module('phabricator', 'view/form/base');
|
||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
|
|
@ -34,10 +34,6 @@ abstract class PhabricatorPHIDController extends PhabricatorController {
|
|||
'href' => '/phid/list/',
|
||||
'name' => 'PHID List',
|
||||
),
|
||||
'types' => array(
|
||||
'href' => '/phid/type/',
|
||||
'name' => 'PHID Types',
|
||||
),
|
||||
),
|
||||
idx($data, 'tab'));
|
||||
$page->setGlyph('#');
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
<?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 PhabricatorPHIDTypeEditController
|
||||
extends PhabricatorPHIDController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = idx($data, 'id');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
|
||||
if ($this->id) {
|
||||
$type = id(new PhabricatorPHIDType())->load($this->id);
|
||||
if (!$type) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
} else {
|
||||
$type = new PhabricatorPHIDType();
|
||||
}
|
||||
|
||||
$e_type = true;
|
||||
$e_name = true;
|
||||
$errors = array();
|
||||
|
||||
$request = $this->getRequest();
|
||||
if ($request->isFormPost()) {
|
||||
$type->setName($request->getStr('name'));
|
||||
if (!$type->getID()) {
|
||||
$type->setType($request->getStr('type'));
|
||||
}
|
||||
$type->setDescription($request->getStr('description'));
|
||||
|
||||
if (!strlen($type->getType())) {
|
||||
$errors[] = 'Type code is required.';
|
||||
$e_type = 'Required';
|
||||
}
|
||||
|
||||
if (!strlen($type->getName())) {
|
||||
$errors[] = 'Type name is required.';
|
||||
$e_name = 'Required';
|
||||
}
|
||||
|
||||
if (!$errors) {
|
||||
$type->save();
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/phid/type/');
|
||||
}
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle('Form Errors')
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$form = new AphrontFormView();
|
||||
$form->setUser($request->getUser());
|
||||
|
||||
if ($type->getID()) {
|
||||
$form->setAction('/phid/type/edit/'.$type->getID().'/');
|
||||
} else {
|
||||
$form->setAction('/phid/type/edit/');
|
||||
}
|
||||
|
||||
if ($type->getID()) {
|
||||
$type_immutable = true;
|
||||
} else {
|
||||
$type_immutable = false;
|
||||
}
|
||||
|
||||
|
||||
$form
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Type')
|
||||
->setName('type')
|
||||
->setValue($type->getType())
|
||||
->setError($e_type)
|
||||
->setCaption(
|
||||
'Four character type identifier. This can not be changed once '.
|
||||
'it is created.')
|
||||
->setDisabled($type_immutable))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Name')
|
||||
->setName('name')
|
||||
->setValue($type->getName())
|
||||
->setError($e_name))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextAreaControl())
|
||||
->setLabel('Description')
|
||||
->setName('description')
|
||||
->setValue($type->getDescription()))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Save')
|
||||
->addCancelButton('/phid/type/'));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
if ($type->getID()) {
|
||||
$panel->setHeader('Edit PHID Type');
|
||||
} else {
|
||||
$panel->setHeader('Create New PHID Type');
|
||||
}
|
||||
|
||||
$panel->appendChild($form);
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
array($error_view, $panel),
|
||||
array(
|
||||
'title' => 'Edit PHID Type',
|
||||
));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'aphront/response/404');
|
||||
phutil_require_module('phabricator', 'aphront/response/redirect');
|
||||
phutil_require_module('phabricator', 'applications/phid/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/type');
|
||||
phutil_require_module('phabricator', 'view/form/base');
|
||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('PhabricatorPHIDTypeEditController.php');
|
|
@ -1,59 +0,0 @@
|
|||
<?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 PhabricatorPHIDTypeListController
|
||||
extends PhabricatorPHIDController {
|
||||
|
||||
public function processRequest() {
|
||||
$items = id(new PhabricatorPHIDType())->loadAll();
|
||||
|
||||
$rows = array();
|
||||
foreach ($items as $item) {
|
||||
$rows[] = array(
|
||||
$item->getID(),
|
||||
phutil_escape_html($item->getType()),
|
||||
phutil_escape_html($item->getName()),
|
||||
);
|
||||
}
|
||||
|
||||
$table = new AphrontTableView($rows);
|
||||
$table->setHeaders(
|
||||
array(
|
||||
'ID',
|
||||
'Type Code',
|
||||
'Name',
|
||||
));
|
||||
$table->setColumnClasses(
|
||||
array(
|
||||
null,
|
||||
null,
|
||||
'wide',
|
||||
));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->appendChild($table);
|
||||
$panel->setHeader('PHID Types');
|
||||
$panel->setCreateButton('New Type', '/phid/type/edit/');
|
||||
|
||||
return $this->buildStandardPageResponse($panel, array(
|
||||
'title' => 'PHID Types',
|
||||
'tab' => 'types',
|
||||
));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/phid/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/type');
|
||||
phutil_require_module('phabricator', 'view/control/table');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('PhabricatorPHIDTypeListController.php');
|
|
@ -1,25 +0,0 @@
|
|||
<?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 PhabricatorPHIDType extends PhabricatorPHIDDAO {
|
||||
|
||||
protected $type;
|
||||
protected $name;
|
||||
protected $description;
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/base');
|
||||
|
||||
|
||||
phutil_require_source('PhabricatorPHIDType.php');
|
Loading…
Reference in a new issue