diff --git a/resources/sql/init/initialize.sql b/resources/sql/init/initialize.sql index 05308bf8a9..b827c261df 100644 --- a/resources/sql/init/initialize.sql +++ b/resources/sql/init/initialize.sql @@ -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 */; diff --git a/resources/sql/patches/012.dropphidtype.sql b/resources/sql/patches/012.dropphidtype.sql new file mode 100644 index 0000000000..53f08454d9 --- /dev/null +++ b/resources/sql/patches/012.dropphidtype.sql @@ -0,0 +1 @@ +DROP TABLE phabricator_phid.phid_type; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 49289e0c21..b9e568b827 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php index 0ddfdcf971..5c9a32892c 100755 --- a/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php @@ -59,8 +59,6 @@ class AphrontDefaultApplicationConfiguration '/phid/' => array( '$' => 'PhabricatorPHIDLookupController', 'list/$' => 'PhabricatorPHIDListController', - 'type/$' => 'PhabricatorPHIDTypeListController', - 'type/edit/(?:(?P\d+)/)?$' => 'PhabricatorPHIDTypeEditController', 'new/$' => 'PhabricatorPHIDAllocateController', ), '/people/' => array( diff --git a/src/applications/phid/constants/PhabricatorPHIDConstants.php b/src/applications/phid/constants/PhabricatorPHIDConstants.php index 30aa59dc1c..f3e3867a8d 100644 --- a/src/applications/phid/constants/PhabricatorPHIDConstants.php +++ b/src/applications/phid/constants/PhabricatorPHIDConstants.php @@ -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, + ); + } } diff --git a/src/applications/phid/controller/allocate/PhabricatorPHIDAllocateController.php b/src/applications/phid/controller/allocate/PhabricatorPHIDAllocateController.php index 910f17ab3b..1775149c9b 100644 --- a/src/applications/phid/controller/allocate/PhabricatorPHIDAllocateController.php +++ b/src/applications/phid/controller/allocate/PhabricatorPHIDAllocateController.php @@ -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); diff --git a/src/applications/phid/controller/allocate/__init__.php b/src/applications/phid/controller/allocate/__init__.php index d007a63f53..feca31e6ad 100644 --- a/src/applications/phid/controller/allocate/__init__.php +++ b/src/applications/phid/controller/allocate/__init__.php @@ -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'); diff --git a/src/applications/phid/controller/base/PhabricatorPHIDController.php b/src/applications/phid/controller/base/PhabricatorPHIDController.php index 1bb234fb5f..357164d4f0 100644 --- a/src/applications/phid/controller/base/PhabricatorPHIDController.php +++ b/src/applications/phid/controller/base/PhabricatorPHIDController.php @@ -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('#'); diff --git a/src/applications/phid/controller/typeedit/PhabricatorPHIDTypeEditController.php b/src/applications/phid/controller/typeedit/PhabricatorPHIDTypeEditController.php deleted file mode 100644 index 11a1477fc7..0000000000 --- a/src/applications/phid/controller/typeedit/PhabricatorPHIDTypeEditController.php +++ /dev/null @@ -1,135 +0,0 @@ -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', - )); - } - -} diff --git a/src/applications/phid/controller/typeedit/__init__.php b/src/applications/phid/controller/typeedit/__init__.php deleted file mode 100644 index 0805e99ff0..0000000000 --- a/src/applications/phid/controller/typeedit/__init__.php +++ /dev/null @@ -1,21 +0,0 @@ -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', - )); - } - -} diff --git a/src/applications/phid/controller/typelist/__init__.php b/src/applications/phid/controller/typelist/__init__.php deleted file mode 100644 index 81a4d0557d..0000000000 --- a/src/applications/phid/controller/typelist/__init__.php +++ /dev/null @@ -1,18 +0,0 @@ -