1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-02 03:32:42 +01:00

(stable) Promote 2015 Week 47

This commit is contained in:
epriestley 2015-11-21 07:51:20 -08:00
commit 4659bb6fe2
153 changed files with 3156 additions and 847 deletions

View file

@ -57,13 +57,6 @@
"type": "phutil-library",
"include": "(\\.php$)"
},
"phutil-xhpast": {
"type": "phutil-xhpast",
"include": "(\\.php$)",
"phutil-xhpast.deprecated.functions": {
"phutil_escape_html": "The phutil_escape_html() function is deprecated. Raw strings passed to phutil_tag() or hsprintf() are escaped automatically."
}
},
"spelling": {
"type": "spelling"
},
@ -73,15 +66,7 @@
"xhpast": {
"type": "xhpast",
"include": "(\\.php$)",
"severity": {
"16": "advice",
"34": "error"
},
"xhpast.blacklisted.function": {
"eval": "The eval() function should be avoided. It is potentially unsafe and makes debugging more difficult."
},
"xhpast.php-version": "5.2.3",
"xhpast.php-version.windows": "5.3.0"
"standard": "phutil.xhpast"
}
}
}

View file

@ -7,7 +7,7 @@
*/
return array(
'names' => array(
'core.pkg.css' => 'e94665e4',
'core.pkg.css' => 'e4f1ea81',
'core.pkg.js' => '47dc9ebb',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '2de124c9',
@ -125,8 +125,8 @@ return array(
'rsrc/css/phui/phui-badge.css' => 'f25c3476',
'rsrc/css/phui/phui-box.css' => 'a5bb366d',
'rsrc/css/phui/phui-button.css' => '16020a60',
'rsrc/css/phui/phui-crumbs-view.css' => 'd842f867',
'rsrc/css/phui/phui-document-pro.css' => '4f2b42e3',
'rsrc/css/phui/phui-crumbs-view.css' => '414406b5',
'rsrc/css/phui/phui-document-pro.css' => '7f3009ce',
'rsrc/css/phui/phui-document.css' => 'f841ad0a',
'rsrc/css/phui/phui-feed-story.css' => 'b7b26d23',
'rsrc/css/phui/phui-fontkit.css' => 'c9d63950',
@ -779,9 +779,9 @@ return array(
'phui-calendar-day-css' => 'd1cf6f93',
'phui-calendar-list-css' => 'c1c7f338',
'phui-calendar-month-css' => '476be7e0',
'phui-crumbs-view-css' => 'd842f867',
'phui-crumbs-view-css' => '414406b5',
'phui-document-view-css' => 'f841ad0a',
'phui-document-view-pro-css' => '4f2b42e3',
'phui-document-view-pro-css' => '7f3009ce',
'phui-feed-story-css' => 'b7b26d23',
'phui-font-icon-base-css' => 'ecbbb4c2',
'phui-fontkit-css' => 'c9d63950',

View file

@ -0,0 +1,17 @@
CREATE TABLE {$NAMESPACE}_search.search_editengineconfiguration (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
phid VARBINARY(64) NOT NULL,
engineKey VARCHAR(64) NOT NULL COLLATE {$COLLATE_TEXT},
builtinKey VARCHAR(64) COLLATE {$COLLATE_TEXT},
name VARCHAR(255) NOT NULL COLLATE {$COLLATE_TEXT},
viewPolicy VARBINARY(64) NOT NULL,
editPolicy VARBINARY(64) NOT NULL,
properties LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT},
isDisabled BOOL NOT NULL DEFAULT 0,
isDefault BOOL NOT NULL DEFAULT 0,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
UNIQUE KEY `key_phid` (phid),
UNIQUE KEY `key_engine` (engineKey, builtinKey),
KEY `key_default` (engineKey, isDefault, isDisabled)
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};

View file

@ -0,0 +1,19 @@
CREATE TABLE {$NAMESPACE}_search.search_editengineconfigurationtransaction (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
phid VARBINARY(64) NOT NULL,
authorPHID VARBINARY(64) NOT NULL,
objectPHID VARBINARY(64) NOT NULL,
viewPolicy VARBINARY(64) NOT NULL,
editPolicy VARBINARY(64) NOT NULL,
commentPHID VARBINARY(64) DEFAULT NULL,
commentVersion INT UNSIGNED NOT NULL,
transactionType VARCHAR(32) COLLATE {$COLLATE_TEXT} NOT NULL,
oldValue LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL,
newValue LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL,
contentSource LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL,
metadata LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
UNIQUE KEY `key_phid` (`phid`),
KEY `key_object` (`objectPHID`)
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_phame.phame_blog
ADD mailKey binary(20) NOT NULL;

View file

@ -0,0 +1,18 @@
<?php
$table = new PhameBlog();
$conn_w = $table->establishConnection('w');
$iterator = new LiskMigrationIterator($table);
foreach ($iterator as $blog) {
$id = $blog->getID();
echo pht('Adding mail key for Blog %d...', $id);
echo "\n";
queryfx(
$conn_w,
'UPDATE %T SET mailKey = %s WHERE id = %d',
$table->getTableName(),
Filesystem::readRandomCharacters(20),
$id);
}

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_phame.phame_blog
DROP joinPolicy;

View file

@ -0,0 +1,5 @@
ALTER TABLE {$NAMESPACE}_xhpastview.xhpastview_parsetree
ADD returnCode INT NOT NULL AFTER input;
ALTER TABLE {$NAMESPACE}_xhpastview.xhpastview_parsetree
ADD stderr longtext NOT NULL AFTER stdout;

View file

@ -0,0 +1,18 @@
CREATE TABLE {$NAMESPACE}_phame.phame_posttransaction_comment (
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
phid VARCHAR(64) NOT NULL,
transactionPHID VARCHAR(64),
authorPHID VARCHAR(64) NOT NULL,
viewPolicy VARCHAR(64) NOT NULL,
editPolicy VARCHAR(64) NOT NULL,
commentVersion INT UNSIGNED NOT NULL,
content LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT},
contentSource LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT},
isDeleted BOOL NOT NULL,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
UNIQUE KEY `key_phid` (phid),
UNIQUE KEY `key_version` (transactionPHID, commentVersion)
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};

View file

@ -0,0 +1,8 @@
USE {$NAMESPACE}_repository;
DELETE x FROM repository_coverage x
LEFT JOIN repository_coverage y
ON x.branchID = y.branchID
AND x.commitID = y.commitID
AND x.pathID = y.pathID
AND y.id > x.id
WHERE y.id IS NOT NULL;

View file

@ -0,0 +1,2 @@
RENAME TABLE {$NAMESPACE}_xhpastview.xhpastview_parsetree
TO {$NAMESPACE}_xhpast.xhpast_parsetree;

View file

@ -0,0 +1 @@
DROP DATABASE {$NAMESPACE}_xhpastview;

View file

@ -0,0 +1,5 @@
ALTER TABLE {$NAMESPACE}_daemon.daemon_log
DROP COLUMN envHash;
ALTER TABLE {$NAMESPACE}_daemon.daemon_log
DROP COLUMN envInfo;

View file

@ -0,0 +1,16 @@
CREATE TABLE {$NAMESPACE}_herald.edge (
src VARBINARY(64) NOT NULL,
type INT UNSIGNED NOT NULL,
dst VARBINARY(64) NOT NULL,
dateCreated INT UNSIGNED NOT NULL,
seq INT UNSIGNED NOT NULL,
dataID INT UNSIGNED,
PRIMARY KEY (src, type, dst),
KEY `src` (src, type, dateCreated, seq),
UNIQUE KEY `key_dst` (dst, type, src)
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
CREATE TABLE {$NAMESPACE}_herald.edgedata (
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
data LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT}
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};

View file

@ -0,0 +1,16 @@
CREATE TABLE {$NAMESPACE}_owners.edge (
src VARBINARY(64) NOT NULL,
type INT UNSIGNED NOT NULL,
dst VARBINARY(64) NOT NULL,
dateCreated INT UNSIGNED NOT NULL,
seq INT UNSIGNED NOT NULL,
dataID INT UNSIGNED,
PRIMARY KEY (src, type, dst),
KEY `src` (src, type, dateCreated, seq),
UNIQUE KEY `key_dst` (dst, type, src)
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
CREATE TABLE {$NAMESPACE}_owners.edgedata (
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
data LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT}
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};

View file

@ -1556,7 +1556,7 @@ phutil_register_library_map(array(
'PhabricatorActionListView' => 'view/layout/PhabricatorActionListView.php',
'PhabricatorActionView' => 'view/layout/PhabricatorActionView.php',
'PhabricatorActivitySettingsPanel' => 'applications/settings/panel/PhabricatorActivitySettingsPanel.php',
'PhabricatorAdministratorsPolicyRule' => 'applications/policy/rule/PhabricatorAdministratorsPolicyRule.php',
'PhabricatorAdministratorsPolicyRule' => 'applications/people/policyrule/PhabricatorAdministratorsPolicyRule.php',
'PhabricatorAjaxRequestExceptionHandler' => 'aphront/handler/PhabricatorAjaxRequestExceptionHandler.php',
'PhabricatorAlmanacApplication' => 'applications/almanac/application/PhabricatorAlmanacApplication.php',
'PhabricatorAmazonAuthProvider' => 'applications/auth/provider/PhabricatorAmazonAuthProvider.php',
@ -1579,8 +1579,6 @@ phutil_register_library_map(array(
'PhabricatorApplicationDatasource' => 'applications/meta/typeahead/PhabricatorApplicationDatasource.php',
'PhabricatorApplicationDetailViewController' => 'applications/meta/controller/PhabricatorApplicationDetailViewController.php',
'PhabricatorApplicationEditController' => 'applications/meta/controller/PhabricatorApplicationEditController.php',
'PhabricatorApplicationEditEngine' => 'applications/transactions/editengine/PhabricatorApplicationEditEngine.php',
'PhabricatorApplicationEditEngineAPIMethod' => 'applications/transactions/editengine/PhabricatorApplicationEditEngineAPIMethod.php',
'PhabricatorApplicationEditHTTPParameterHelpView' => 'applications/transactions/view/PhabricatorApplicationEditHTTPParameterHelpView.php',
'PhabricatorApplicationEmailCommandsController' => 'applications/meta/controller/PhabricatorApplicationEmailCommandsController.php',
'PhabricatorApplicationLaunchView' => 'applications/meta/view/PhabricatorApplicationLaunchView.php',
@ -2016,6 +2014,7 @@ phutil_register_library_map(array(
'PhabricatorDaemonManagementStatusWorkflow' => 'applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php',
'PhabricatorDaemonManagementStopWorkflow' => 'applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php',
'PhabricatorDaemonManagementWorkflow' => 'applications/daemon/management/PhabricatorDaemonManagementWorkflow.php',
'PhabricatorDaemonOverseerModule' => 'infrastructure/daemon/overseer/PhabricatorDaemonOverseerModule.php',
'PhabricatorDaemonReference' => 'infrastructure/daemon/control/PhabricatorDaemonReference.php',
'PhabricatorDaemonTaskGarbageCollector' => 'applications/daemon/garbagecollector/PhabricatorDaemonTaskGarbageCollector.php',
'PhabricatorDaemonTasksTableView' => 'applications/daemon/view/PhabricatorDaemonTasksTableView.php',
@ -2095,7 +2094,6 @@ phutil_register_library_map(array(
'PhabricatorDisabledUserController' => 'applications/auth/controller/PhabricatorDisabledUserController.php',
'PhabricatorDisplayPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php',
'PhabricatorDisqusAuthProvider' => 'applications/auth/provider/PhabricatorDisqusAuthProvider.php',
'PhabricatorDisqusConfigOptions' => 'applications/config/option/PhabricatorDisqusConfigOptions.php',
'PhabricatorDivinerApplication' => 'applications/diviner/application/PhabricatorDivinerApplication.php',
'PhabricatorDoorkeeperApplication' => 'applications/doorkeeper/application/PhabricatorDoorkeeperApplication.php',
'PhabricatorDraft' => 'applications/draft/storage/PhabricatorDraft.php',
@ -2111,6 +2109,24 @@ phutil_register_library_map(array(
'PhabricatorEdgeTestCase' => 'infrastructure/edges/__tests__/PhabricatorEdgeTestCase.php',
'PhabricatorEdgeType' => 'infrastructure/edges/type/PhabricatorEdgeType.php',
'PhabricatorEdgeTypeTestCase' => 'infrastructure/edges/type/__tests__/PhabricatorEdgeTypeTestCase.php',
'PhabricatorEditEngine' => 'applications/transactions/editengine/PhabricatorEditEngine.php',
'PhabricatorEditEngineAPIMethod' => 'applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php',
'PhabricatorEditEngineConfiguration' => 'applications/transactions/storage/PhabricatorEditEngineConfiguration.php',
'PhabricatorEditEngineConfigurationEditController' => 'applications/transactions/controller/PhabricatorEditEngineConfigurationEditController.php',
'PhabricatorEditEngineConfigurationEditEngine' => 'applications/transactions/editor/PhabricatorEditEngineConfigurationEditEngine.php',
'PhabricatorEditEngineConfigurationEditor' => 'applications/transactions/editor/PhabricatorEditEngineConfigurationEditor.php',
'PhabricatorEditEngineConfigurationListController' => 'applications/transactions/controller/PhabricatorEditEngineConfigurationListController.php',
'PhabricatorEditEngineConfigurationPHIDType' => 'applications/transactions/phid/PhabricatorEditEngineConfigurationPHIDType.php',
'PhabricatorEditEngineConfigurationQuery' => 'applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php',
'PhabricatorEditEngineConfigurationSaveController' => 'applications/transactions/controller/PhabricatorEditEngineConfigurationSaveController.php',
'PhabricatorEditEngineConfigurationSearchEngine' => 'applications/transactions/query/PhabricatorEditEngineConfigurationSearchEngine.php',
'PhabricatorEditEngineConfigurationTransaction' => 'applications/transactions/storage/PhabricatorEditEngineConfigurationTransaction.php',
'PhabricatorEditEngineConfigurationTransactionQuery' => 'applications/transactions/query/PhabricatorEditEngineConfigurationTransactionQuery.php',
'PhabricatorEditEngineConfigurationViewController' => 'applications/transactions/controller/PhabricatorEditEngineConfigurationViewController.php',
'PhabricatorEditEngineController' => 'applications/transactions/controller/PhabricatorEditEngineController.php',
'PhabricatorEditEngineListController' => 'applications/transactions/controller/PhabricatorEditEngineListController.php',
'PhabricatorEditEngineQuery' => 'applications/transactions/query/PhabricatorEditEngineQuery.php',
'PhabricatorEditEngineSearchEngine' => 'applications/transactions/query/PhabricatorEditEngineSearchEngine.php',
'PhabricatorEditField' => 'applications/transactions/editfield/PhabricatorEditField.php',
'PhabricatorEditType' => 'applications/transactions/edittype/PhabricatorEditType.php',
'PhabricatorEditor' => 'infrastructure/PhabricatorEditor.php',
@ -2295,6 +2311,7 @@ phutil_register_library_map(array(
'PhabricatorInlineCommentInterface' => 'infrastructure/diff/interface/PhabricatorInlineCommentInterface.php',
'PhabricatorInlineCommentPreviewController' => 'infrastructure/diff/PhabricatorInlineCommentPreviewController.php',
'PhabricatorInlineSummaryView' => 'infrastructure/diff/view/PhabricatorInlineSummaryView.php',
'PhabricatorInstructionsEditField' => 'applications/transactions/editfield/PhabricatorInstructionsEditField.php',
'PhabricatorInternationalizationManagementExtractWorkflow' => 'infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php',
'PhabricatorInternationalizationManagementWorkflow' => 'infrastructure/internationalization/management/PhabricatorInternationalizationManagementWorkflow.php',
'PhabricatorInvalidConfigSetupCheck' => 'applications/config/check/PhabricatorInvalidConfigSetupCheck.php',
@ -2309,7 +2326,7 @@ phutil_register_library_map(array(
'PhabricatorLegalpadApplication' => 'applications/legalpad/application/PhabricatorLegalpadApplication.php',
'PhabricatorLegalpadConfigOptions' => 'applications/legalpad/config/PhabricatorLegalpadConfigOptions.php',
'PhabricatorLegalpadDocumentPHIDType' => 'applications/legalpad/phid/PhabricatorLegalpadDocumentPHIDType.php',
'PhabricatorLegalpadSignaturePolicyRule' => 'applications/policy/rule/PhabricatorLegalpadSignaturePolicyRule.php',
'PhabricatorLegalpadSignaturePolicyRule' => 'applications/legalpad/policyrule/PhabricatorLegalpadSignaturePolicyRule.php',
'PhabricatorLibraryTestCase' => '__tests__/PhabricatorLibraryTestCase.php',
'PhabricatorLipsumArtist' => 'applications/lipsum/image/PhabricatorLipsumArtist.php',
'PhabricatorLipsumGenerateWorkflow' => 'applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php',
@ -2546,6 +2563,7 @@ phutil_register_library_map(array(
'PhabricatorOwnersPackageTransactionQuery' => 'applications/owners/query/PhabricatorOwnersPackageTransactionQuery.php',
'PhabricatorOwnersPath' => 'applications/owners/storage/PhabricatorOwnersPath.php',
'PhabricatorOwnersPathsController' => 'applications/owners/controller/PhabricatorOwnersPathsController.php',
'PhabricatorOwnersSchemaSpec' => 'applications/owners/storage/PhabricatorOwnersSchemaSpec.php',
'PhabricatorOwnersSearchField' => 'applications/owners/searchfield/PhabricatorOwnersSearchField.php',
'PhabricatorPHDConfigOptions' => 'applications/config/option/PhabricatorPHDConfigOptions.php',
'PhabricatorPHID' => 'applications/phid/storage/PhabricatorPHID.php',
@ -2641,13 +2659,18 @@ phutil_register_library_map(array(
'PhabricatorPhrictionApplication' => 'applications/phriction/application/PhabricatorPhrictionApplication.php',
'PhabricatorPhrictionConfigOptions' => 'applications/phriction/config/PhabricatorPhrictionConfigOptions.php',
'PhabricatorPhurlApplication' => 'applications/phurl/application/PhabricatorPhurlApplication.php',
'PhabricatorPhurlConfigOptions' => 'applications/config/option/PhabricatorPhurlConfigOptions.php',
'PhabricatorPhurlController' => 'applications/phurl/controller/PhabricatorPhurlController.php',
'PhabricatorPhurlDAO' => 'applications/phurl/storage/PhabricatorPhurlDAO.php',
'PhabricatorPhurlLinkRemarkupRule' => 'applications/phurl/remarkup/PhabricatorPhurlLinkRemarkupRule.php',
'PhabricatorPhurlRemarkupRule' => 'applications/phurl/remarkup/PhabricatorPhurlRemarkupRule.php',
'PhabricatorPhurlSchemaSpec' => 'applications/phurl/storage/PhabricatorPhurlSchemaSpec.php',
'PhabricatorPhurlShortURLController' => 'applications/phurl/controller/PhabricatorPhurlShortURLController.php',
'PhabricatorPhurlShortURLDefaultController' => 'applications/phurl/controller/PhabricatorPhurlShortURLDefaultController.php',
'PhabricatorPhurlURL' => 'applications/phurl/storage/PhabricatorPhurlURL.php',
'PhabricatorPhurlURLAccessController' => 'applications/phurl/controller/PhabricatorPhurlURLAccessController.php',
'PhabricatorPhurlURLCommentController' => 'applications/phurl/controller/PhabricatorPhurlURLCommentController.php',
'PhabricatorPhurlURLCreateCapability' => 'applications/phurl/capability/PhabricatorPhurlURLCreateCapability.php',
'PhabricatorPhurlURLEditController' => 'applications/phurl/controller/PhabricatorPhurlURLEditController.php',
'PhabricatorPhurlURLEditor' => 'applications/phurl/editor/PhabricatorPhurlURLEditor.php',
'PhabricatorPhurlURLListController' => 'applications/phurl/controller/PhabricatorPhurlURLListController.php',
@ -2767,7 +2790,7 @@ phutil_register_library_map(array(
'PhabricatorProjectViewController' => 'applications/project/controller/PhabricatorProjectViewController.php',
'PhabricatorProjectWatchController' => 'applications/project/controller/PhabricatorProjectWatchController.php',
'PhabricatorProjectsEditField' => 'applications/transactions/editfield/PhabricatorProjectsEditField.php',
'PhabricatorProjectsPolicyRule' => 'applications/policy/rule/PhabricatorProjectsPolicyRule.php',
'PhabricatorProjectsPolicyRule' => 'applications/project/policyrule/PhabricatorProjectsPolicyRule.php',
'PhabricatorProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorProtocolAdapter.php',
'PhabricatorPygmentSetupCheck' => 'applications/config/check/PhabricatorPygmentSetupCheck.php',
'PhabricatorQuery' => 'infrastructure/query/PhabricatorQuery.php',
@ -2954,6 +2977,7 @@ phutil_register_library_map(array(
'PhabricatorSetupIssue' => 'applications/config/issue/PhabricatorSetupIssue.php',
'PhabricatorSetupIssueUIExample' => 'applications/uiexample/examples/PhabricatorSetupIssueUIExample.php',
'PhabricatorSetupIssueView' => 'applications/config/view/PhabricatorSetupIssueView.php',
'PhabricatorShortSite' => 'aphront/site/PhabricatorShortSite.php',
'PhabricatorSimpleEditType' => 'applications/transactions/edittype/PhabricatorSimpleEditType.php',
'PhabricatorSite' => 'aphront/site/PhabricatorSite.php',
'PhabricatorSlowvoteApplication' => 'applications/slowvote/application/PhabricatorSlowvoteApplication.php',
@ -3176,7 +3200,7 @@ phutil_register_library_map(array(
'PhabricatorUserTitleField' => 'applications/people/customfield/PhabricatorUserTitleField.php',
'PhabricatorUserTransaction' => 'applications/people/storage/PhabricatorUserTransaction.php',
'PhabricatorUsersEditField' => 'applications/transactions/editfield/PhabricatorUsersEditField.php',
'PhabricatorUsersPolicyRule' => 'applications/policy/rule/PhabricatorUsersPolicyRule.php',
'PhabricatorUsersPolicyRule' => 'applications/people/policyrule/PhabricatorUsersPolicyRule.php',
'PhabricatorUsersSearchField' => 'applications/people/searchfield/PhabricatorUsersSearchField.php',
'PhabricatorVCSResponse' => 'applications/repository/response/PhabricatorVCSResponse.php',
'PhabricatorVeryWowEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorVeryWowEnglishTranslation.php',
@ -3224,13 +3248,13 @@ phutil_register_library_map(array(
'PhabricatorWorkingCopyDiscoveryTestCase' => 'applications/repository/engine/__tests__/PhabricatorWorkingCopyDiscoveryTestCase.php',
'PhabricatorWorkingCopyPullTestCase' => 'applications/repository/engine/__tests__/PhabricatorWorkingCopyPullTestCase.php',
'PhabricatorWorkingCopyTestCase' => 'applications/repository/engine/__tests__/PhabricatorWorkingCopyTestCase.php',
'PhabricatorXHPASTDAO' => 'applications/phpast/storage/PhabricatorXHPASTDAO.php',
'PhabricatorXHPASTParseTree' => 'applications/phpast/storage/PhabricatorXHPASTParseTree.php',
'PhabricatorXHPASTViewController' => 'applications/phpast/controller/PhabricatorXHPASTViewController.php',
'PhabricatorXHPASTViewDAO' => 'applications/phpast/storage/PhabricatorXHPASTViewDAO.php',
'PhabricatorXHPASTViewFrameController' => 'applications/phpast/controller/PhabricatorXHPASTViewFrameController.php',
'PhabricatorXHPASTViewFramesetController' => 'applications/phpast/controller/PhabricatorXHPASTViewFramesetController.php',
'PhabricatorXHPASTViewInputController' => 'applications/phpast/controller/PhabricatorXHPASTViewInputController.php',
'PhabricatorXHPASTViewPanelController' => 'applications/phpast/controller/PhabricatorXHPASTViewPanelController.php',
'PhabricatorXHPASTViewParseTree' => 'applications/phpast/storage/PhabricatorXHPASTViewParseTree.php',
'PhabricatorXHPASTViewRunController' => 'applications/phpast/controller/PhabricatorXHPASTViewRunController.php',
'PhabricatorXHPASTViewStreamController' => 'applications/phpast/controller/PhabricatorXHPASTViewStreamController.php',
'PhabricatorXHPASTViewTreeController' => 'applications/phpast/controller/PhabricatorXHPASTViewTreeController.php',
@ -3248,6 +3272,7 @@ phutil_register_library_map(array(
'PhameBasicTemplateBlogSkin' => 'applications/phame/skins/PhameBasicTemplateBlogSkin.php',
'PhameBlog' => 'applications/phame/storage/PhameBlog.php',
'PhameBlogController' => 'applications/phame/controller/blog/PhameBlogController.php',
'PhameBlogCreateCapability' => 'applications/phame/capability/PhameBlogCreateCapability.php',
'PhameBlogDeleteController' => 'applications/phame/controller/blog/PhameBlogDeleteController.php',
'PhameBlogEditController' => 'applications/phame/controller/blog/PhameBlogEditController.php',
'PhameBlogEditor' => 'applications/phame/editor/PhameBlogEditor.php',
@ -3255,23 +3280,28 @@ phutil_register_library_map(array(
'PhameBlogListController' => 'applications/phame/controller/blog/PhameBlogListController.php',
'PhameBlogLiveController' => 'applications/phame/controller/blog/PhameBlogLiveController.php',
'PhameBlogQuery' => 'applications/phame/query/PhameBlogQuery.php',
'PhameBlogReplyHandler' => 'applications/phame/mail/PhameBlogReplyHandler.php',
'PhameBlogSearchEngine' => 'applications/phame/query/PhameBlogSearchEngine.php',
'PhameBlogSite' => 'applications/phame/site/PhameBlogSite.php',
'PhameBlogSkin' => 'applications/phame/skins/PhameBlogSkin.php',
'PhameBlogTransaction' => 'applications/phame/storage/PhameBlogTransaction.php',
'PhameBlogTransactionQuery' => 'applications/phame/query/PhameBlogTransactionQuery.php',
'PhameBlogViewController' => 'applications/phame/controller/blog/PhameBlogViewController.php',
'PhameCelerityResources' => 'applications/phame/celerity/PhameCelerityResources.php',
'PhameConduitAPIMethod' => 'applications/phame/conduit/PhameConduitAPIMethod.php',
'PhameConstants' => 'applications/phame/constants/PhameConstants.php',
'PhameController' => 'applications/phame/controller/PhameController.php',
'PhameCreatePostConduitAPIMethod' => 'applications/phame/conduit/PhameCreatePostConduitAPIMethod.php',
'PhameDAO' => 'applications/phame/storage/PhameDAO.php',
'PhamePost' => 'applications/phame/storage/PhamePost.php',
'PhamePostCommentController' => 'applications/phame/controller/post/PhamePostCommentController.php',
'PhamePostController' => 'applications/phame/controller/post/PhamePostController.php',
'PhamePostDeleteController' => 'applications/phame/controller/post/PhamePostDeleteController.php',
'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php',
'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php',
'PhamePostFramedController' => 'applications/phame/controller/post/PhamePostFramedController.php',
'PhamePostListController' => 'applications/phame/controller/post/PhamePostListController.php',
'PhamePostMailReceiver' => 'applications/phame/mail/PhamePostMailReceiver.php',
'PhamePostNewController' => 'applications/phame/controller/post/PhamePostNewController.php',
'PhamePostNotLiveController' => 'applications/phame/controller/post/PhamePostNotLiveController.php',
'PhamePostPreviewController' => 'applications/phame/controller/post/PhamePostPreviewController.php',
@ -3280,6 +3310,7 @@ phutil_register_library_map(array(
'PhamePostReplyHandler' => 'applications/phame/mail/PhamePostReplyHandler.php',
'PhamePostSearchEngine' => 'applications/phame/query/PhamePostSearchEngine.php',
'PhamePostTransaction' => 'applications/phame/storage/PhamePostTransaction.php',
'PhamePostTransactionComment' => 'applications/phame/storage/PhamePostTransactionComment.php',
'PhamePostTransactionQuery' => 'applications/phame/query/PhamePostTransactionQuery.php',
'PhamePostUnpublishController' => 'applications/phame/controller/post/PhamePostUnpublishController.php',
'PhamePostView' => 'applications/phame/view/PhamePostView.php',
@ -3400,7 +3431,6 @@ phutil_register_library_map(array(
'PhortuneMerchantTransactionQuery' => 'applications/phortune/query/PhortuneMerchantTransactionQuery.php',
'PhortuneMerchantViewController' => 'applications/phortune/controller/PhortuneMerchantViewController.php',
'PhortuneMonthYearExpiryControl' => 'applications/phortune/control/PhortuneMonthYearExpiryControl.php',
'PhortuneNotImplementedException' => 'applications/phortune/exception/PhortuneNotImplementedException.php',
'PhortuneOrderTableView' => 'applications/phortune/view/PhortuneOrderTableView.php',
'PhortunePayPalPaymentProvider' => 'applications/phortune/provider/PhortunePayPalPaymentProvider.php',
'PhortunePaymentMethod' => 'applications/phortune/storage/PhortunePaymentMethod.php',
@ -3728,6 +3758,7 @@ phutil_register_library_map(array(
'PhabricatorCustomFieldInterface',
'PhabricatorApplicationTransactionInterface',
'AlmanacPropertyInterface',
'PhabricatorDestructibleInterface',
),
'AlmanacBindingEditController' => 'AlmanacServiceController',
'AlmanacBindingEditor' => 'PhabricatorApplicationTransactionEditor',
@ -5045,6 +5076,7 @@ phutil_register_library_map(array(
'PhabricatorFlaggableInterface',
'PhabricatorPolicyInterface',
'PhabricatorDestructibleInterface',
'PhabricatorSubscribableInterface',
),
'HeraldRuleController' => 'HeraldController',
'HeraldRuleEditor' => 'PhabricatorApplicationTransactionEditor',
@ -5490,7 +5522,7 @@ phutil_register_library_map(array(
'PasteCreateMailReceiver' => 'PhabricatorMailReceiver',
'PasteDefaultEditCapability' => 'PhabricatorPolicyCapability',
'PasteDefaultViewCapability' => 'PhabricatorPolicyCapability',
'PasteEditConduitAPIMethod' => 'PhabricatorApplicationEditEngineAPIMethod',
'PasteEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'PasteEmbedView' => 'AphrontView',
'PasteInfoConduitAPIMethod' => 'PasteConduitAPIMethod',
'PasteMailReceiver' => 'PhabricatorObjectMailReceiver',
@ -5534,8 +5566,6 @@ phutil_register_library_map(array(
'PhabricatorApplicationDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorApplicationDetailViewController' => 'PhabricatorApplicationsController',
'PhabricatorApplicationEditController' => 'PhabricatorApplicationsController',
'PhabricatorApplicationEditEngine' => 'Phobject',
'PhabricatorApplicationEditEngineAPIMethod' => 'ConduitAPIMethod',
'PhabricatorApplicationEditHTTPParameterHelpView' => 'AphrontView',
'PhabricatorApplicationEmailCommandsController' => 'PhabricatorApplicationsController',
'PhabricatorApplicationLaunchView' => 'AphrontTagView',
@ -6051,6 +6081,7 @@ phutil_register_library_map(array(
'PhabricatorDaemonManagementStatusWorkflow' => 'PhabricatorDaemonManagementWorkflow',
'PhabricatorDaemonManagementStopWorkflow' => 'PhabricatorDaemonManagementWorkflow',
'PhabricatorDaemonManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorDaemonOverseerModule' => 'PhutilDaemonOverseerModule',
'PhabricatorDaemonReference' => 'Phobject',
'PhabricatorDaemonTaskGarbageCollector' => 'PhabricatorGarbageCollector',
'PhabricatorDaemonTasksTableView' => 'AphrontView',
@ -6147,7 +6178,6 @@ phutil_register_library_map(array(
'PhabricatorDisabledUserController' => 'PhabricatorAuthController',
'PhabricatorDisplayPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorDisqusAuthProvider' => 'PhabricatorOAuth2AuthProvider',
'PhabricatorDisqusConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorDivinerApplication' => 'PhabricatorApplication',
'PhabricatorDoorkeeperApplication' => 'PhabricatorApplication',
'PhabricatorDraft' => 'PhabricatorDraftDAO',
@ -6163,6 +6193,31 @@ phutil_register_library_map(array(
'PhabricatorEdgeTestCase' => 'PhabricatorTestCase',
'PhabricatorEdgeType' => 'Phobject',
'PhabricatorEdgeTypeTestCase' => 'PhabricatorTestCase',
'PhabricatorEditEngine' => array(
'Phobject',
'PhabricatorPolicyInterface',
),
'PhabricatorEditEngineAPIMethod' => 'ConduitAPIMethod',
'PhabricatorEditEngineConfiguration' => array(
'PhabricatorSearchDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'PhabricatorEditEngineConfigurationEditController' => 'PhabricatorEditEngineController',
'PhabricatorEditEngineConfigurationEditEngine' => 'PhabricatorEditEngine',
'PhabricatorEditEngineConfigurationEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorEditEngineConfigurationListController' => 'PhabricatorEditEngineController',
'PhabricatorEditEngineConfigurationPHIDType' => 'PhabricatorPHIDType',
'PhabricatorEditEngineConfigurationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorEditEngineConfigurationSaveController' => 'PhabricatorEditEngineController',
'PhabricatorEditEngineConfigurationSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorEditEngineConfigurationTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorEditEngineConfigurationTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorEditEngineConfigurationViewController' => 'PhabricatorEditEngineController',
'PhabricatorEditEngineController' => 'PhabricatorApplicationTransactionController',
'PhabricatorEditEngineListController' => 'PhabricatorEditEngineController',
'PhabricatorEditEngineQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorEditEngineSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorEditField' => 'Phobject',
'PhabricatorEditType' => 'Phobject',
'PhabricatorEditor' => 'Phobject',
@ -6383,6 +6438,7 @@ phutil_register_library_map(array(
'PhabricatorInlineCommentInterface' => 'PhabricatorMarkupInterface',
'PhabricatorInlineCommentPreviewController' => 'PhabricatorController',
'PhabricatorInlineSummaryView' => 'AphrontView',
'PhabricatorInstructionsEditField' => 'PhabricatorEditField',
'PhabricatorInternationalizationManagementExtractWorkflow' => 'PhabricatorInternationalizationManagementWorkflow',
'PhabricatorInternationalizationManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorInvalidConfigSetupCheck' => 'PhabricatorSetupCheck',
@ -6665,6 +6721,7 @@ phutil_register_library_map(array(
'PhabricatorOwnersPackageTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorOwnersPath' => 'PhabricatorOwnersDAO',
'PhabricatorOwnersPathsController' => 'PhabricatorOwnersController',
'PhabricatorOwnersSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorOwnersSearchField' => 'PhabricatorSearchTokenizerField',
'PhabricatorPHDConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorPHID' => 'Phobject',
@ -6701,7 +6758,7 @@ phutil_register_library_map(array(
'PhabricatorPasteController' => 'PhabricatorController',
'PhabricatorPasteDAO' => 'PhabricatorLiskDAO',
'PhabricatorPasteEditController' => 'PhabricatorPasteController',
'PhabricatorPasteEditEngine' => 'PhabricatorApplicationEditEngine',
'PhabricatorPasteEditEngine' => 'PhabricatorEditEngine',
'PhabricatorPasteEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorPasteListController' => 'PhabricatorPasteController',
'PhabricatorPastePastePHIDType' => 'PhabricatorPHIDType',
@ -6770,11 +6827,14 @@ phutil_register_library_map(array(
'PhabricatorPhrictionApplication' => 'PhabricatorApplication',
'PhabricatorPhrictionConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorPhurlApplication' => 'PhabricatorApplication',
'PhabricatorPhurlConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorPhurlController' => 'PhabricatorController',
'PhabricatorPhurlDAO' => 'PhabricatorLiskDAO',
'PhabricatorPhurlLinkRemarkupRule' => 'PhutilRemarkupRule',
'PhabricatorPhurlRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'PhabricatorPhurlSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorPhurlShortURLController' => 'PhabricatorPhurlController',
'PhabricatorPhurlShortURLDefaultController' => 'PhabricatorPhurlController',
'PhabricatorPhurlURL' => array(
'PhabricatorPhurlDAO',
'PhabricatorPolicyInterface',
@ -6788,6 +6848,8 @@ phutil_register_library_map(array(
'PhabricatorSpacesInterface',
),
'PhabricatorPhurlURLAccessController' => 'PhabricatorPhurlController',
'PhabricatorPhurlURLCommentController' => 'PhabricatorPhurlController',
'PhabricatorPhurlURLCreateCapability' => 'PhabricatorPolicyCapability',
'PhabricatorPhurlURLEditController' => 'PhabricatorPhurlController',
'PhabricatorPhurlURLEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorPhurlURLListController' => 'PhabricatorPhurlController',
@ -7163,6 +7225,7 @@ phutil_register_library_map(array(
'PhabricatorSetupIssue' => 'Phobject',
'PhabricatorSetupIssueUIExample' => 'PhabricatorUIExample',
'PhabricatorSetupIssueView' => 'AphrontView',
'PhabricatorShortSite' => 'PhabricatorSite',
'PhabricatorSimpleEditType' => 'PhabricatorEditType',
'PhabricatorSite' => 'AphrontSite',
'PhabricatorSlowvoteApplication' => 'PhabricatorApplication',
@ -7479,13 +7542,13 @@ phutil_register_library_map(array(
'PhabricatorWorkingCopyDiscoveryTestCase' => 'PhabricatorWorkingCopyTestCase',
'PhabricatorWorkingCopyPullTestCase' => 'PhabricatorWorkingCopyTestCase',
'PhabricatorWorkingCopyTestCase' => 'PhabricatorTestCase',
'PhabricatorXHPASTDAO' => 'PhabricatorLiskDAO',
'PhabricatorXHPASTParseTree' => 'PhabricatorXHPASTDAO',
'PhabricatorXHPASTViewController' => 'PhabricatorController',
'PhabricatorXHPASTViewDAO' => 'PhabricatorLiskDAO',
'PhabricatorXHPASTViewFrameController' => 'PhabricatorXHPASTViewController',
'PhabricatorXHPASTViewFramesetController' => 'PhabricatorXHPASTViewController',
'PhabricatorXHPASTViewInputController' => 'PhabricatorXHPASTViewPanelController',
'PhabricatorXHPASTViewPanelController' => 'PhabricatorXHPASTViewController',
'PhabricatorXHPASTViewParseTree' => 'PhabricatorXHPASTViewDAO',
'PhabricatorXHPASTViewRunController' => 'PhabricatorXHPASTViewController',
'PhabricatorXHPASTViewStreamController' => 'PhabricatorXHPASTViewPanelController',
'PhabricatorXHPASTViewTreeController' => 'PhabricatorXHPASTViewPanelController',
@ -7511,6 +7574,7 @@ phutil_register_library_map(array(
'PhabricatorApplicationTransactionInterface',
),
'PhameBlogController' => 'PhameController',
'PhameBlogCreateCapability' => 'PhabricatorPolicyCapability',
'PhameBlogDeleteController' => 'PhameBlogController',
'PhameBlogEditController' => 'PhameBlogController',
'PhameBlogEditor' => 'PhabricatorApplicationTransactionEditor',
@ -7518,13 +7582,16 @@ phutil_register_library_map(array(
'PhameBlogListController' => 'PhameBlogController',
'PhameBlogLiveController' => 'PhameBlogController',
'PhameBlogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhameBlogReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PhameBlogSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhameBlogSite' => 'PhameSite',
'PhameBlogSkin' => 'PhabricatorController',
'PhameBlogTransaction' => 'PhabricatorApplicationTransaction',
'PhameBlogTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhameBlogViewController' => 'PhameBlogController',
'PhameCelerityResources' => 'CelerityResources',
'PhameConduitAPIMethod' => 'ConduitAPIMethod',
'PhameConstants' => 'Phobject',
'PhameController' => 'PhabricatorController',
'PhameCreatePostConduitAPIMethod' => 'PhameConduitAPIMethod',
'PhameDAO' => 'PhabricatorLiskDAO',
@ -7538,12 +7605,14 @@ phutil_register_library_map(array(
'PhabricatorSubscribableInterface',
'PhabricatorTokenReceiverInterface',
),
'PhamePostCommentController' => 'PhamePostController',
'PhamePostController' => 'PhameController',
'PhamePostDeleteController' => 'PhamePostController',
'PhamePostEditController' => 'PhamePostController',
'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor',
'PhamePostFramedController' => 'PhamePostController',
'PhamePostListController' => 'PhamePostController',
'PhamePostMailReceiver' => 'PhabricatorObjectMailReceiver',
'PhamePostNewController' => 'PhamePostController',
'PhamePostNotLiveController' => 'PhamePostController',
'PhamePostPreviewController' => 'PhamePostController',
@ -7552,6 +7621,7 @@ phutil_register_library_map(array(
'PhamePostReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PhamePostSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhamePostTransaction' => 'PhabricatorApplicationTransaction',
'PhamePostTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PhamePostTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhamePostUnpublishController' => 'PhamePostController',
'PhamePostView' => 'AphrontView',
@ -7708,7 +7778,6 @@ phutil_register_library_map(array(
'PhortuneMerchantTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhortuneMerchantViewController' => 'PhortuneMerchantController',
'PhortuneMonthYearExpiryControl' => 'AphrontFormControl',
'PhortuneNotImplementedException' => 'Exception',
'PhortuneOrderTableView' => 'AphrontView',
'PhortunePayPalPaymentProvider' => 'PhortunePaymentProvider',
'PhortunePaymentMethod' => array(

View file

@ -0,0 +1,44 @@
<?php
final class PhabricatorShortSite extends PhabricatorSite {
public function getDescription() {
return pht('Serves shortened URLs.');
}
public function getPriority() {
return 2500;
}
public function newSiteForRequest(AphrontRequest $request) {
$host = $request->getHost();
$uri = PhabricatorEnv::getEnvConfig('phurl.short-uri');
if (!strlen($uri)) {
return null;
}
$phurl_installed = PhabricatorApplication::isClassInstalled(
'PhabricatorPhurlApplication');
if (!$phurl_installed) {
return false;
}
if ($this->isHostMatch($host, array($uri))) {
return new PhabricatorShortSite();
}
return null;
}
public function getRoutingMaps() {
$app = PhabricatorApplication::getByClass('PhabricatorPhurlApplication');
$maps = array();
$maps[] = $this->newRoutingMap()
->setApplication($app)
->setRoutes($app->getShortRoutes());
return $maps;
}
}

View file

@ -6,7 +6,8 @@ final class AlmanacBinding
PhabricatorPolicyInterface,
PhabricatorCustomFieldInterface,
PhabricatorApplicationTransactionInterface,
AlmanacPropertyInterface {
AlmanacPropertyInterface,
PhabricatorDestructibleInterface {
protected $servicePHID;
protected $devicePHID;
@ -204,4 +205,14 @@ final class AlmanacBinding
return $timeline;
}
/* -( PhabricatorDestructibleInterface )----------------------------------- */
public function destroyObjectPermanently(
PhabricatorDestructionEngine $engine) {
$this->delete();
}
}

View file

@ -77,6 +77,8 @@ final class PhabricatorJIRAAuthProvider extends PhabricatorOAuth1AuthProvider {
const PROPERTY_JIRA_URI = 'oauth1:jira:uri';
const PROPERTY_PUBLIC_KEY = 'oauth1:jira:key:public';
const PROPERTY_PRIVATE_KEY = 'oauth1:jira:key:private';
const PROPERTY_REPORT_LINK = 'oauth1:jira:report:link';
const PROPERTY_REPORT_COMMENT = 'oauth1:jira:report:comment';
public function readFormValuesFromProvider() {
@ -100,6 +102,10 @@ final class PhabricatorJIRAAuthProvider extends PhabricatorOAuth1AuthProvider {
return array(
self::PROPERTY_JIRA_NAME => $name,
self::PROPERTY_JIRA_URI => $request->getStr(self::PROPERTY_JIRA_URI),
self::PROPERTY_REPORT_LINK =>
$request->getInt(self::PROPERTY_REPORT_LINK, 0),
self::PROPERTY_REPORT_COMMENT =>
$request->getInt(self::PROPERTY_REPORT_COMMENT, 0),
);
}
@ -175,6 +181,7 @@ final class PhabricatorJIRAAuthProvider extends PhabricatorOAuth1AuthProvider {
'JIRA 5 or earlier.'));
$is_setup = $this->isSetup();
$viewer = $request->getViewer();
$e_required = $request->isFormPost() ? null : true;
@ -249,11 +256,40 @@ final class PhabricatorJIRAAuthProvider extends PhabricatorOAuth1AuthProvider {
id(new AphrontFormStaticControl())
->setLabel(pht('Public Key'))
->setValue($pkey));
$form
->appendRemarkupInstructions(
pht(
'= Integration Options = '."\n".
'Configure how to record Revisions on JIRA tasks.'."\n\n".
'Note you\'ll have to restart the daemons for this to take '.
'effect.'))
->appendChild(
id(new AphrontFormCheckboxControl())
->addCheckbox(
self::PROPERTY_REPORT_LINK,
1,
new PHUIRemarkupView(
$viewer,
pht(
'Create **Issue Link** to the Revision, as an "implemented '.
'in" relationship.')),
$this->shouldCreateJIRALink()))
->appendChild(
id(new AphrontFormCheckboxControl())
->addCheckbox(
self::PROPERTY_REPORT_COMMENT,
1,
new PHUIRemarkupView(
$viewer,
pht(
'**Post a comment** in the JIRA task, similar to the '.
'emails Phabricator sends.')),
$this->shouldCreateJIRAComment()));
}
}
/**
* JIRA uses a setup step to generate public/private keys.
*/
@ -286,4 +322,14 @@ final class PhabricatorJIRAAuthProvider extends PhabricatorOAuth1AuthProvider {
return $adapter->newJIRAFuture($path, $method, $params);
}
public function shouldCreateJIRALink() {
$config = $this->getProviderConfig();
return $config->getProperty(self::PROPERTY_REPORT_LINK, true);
}
public function shouldCreateJIRAComment() {
$config = $this->getProviderConfig();
return $config->getProperty(self::PROPERTY_REPORT_COMMENT, true);
}
}

View file

@ -635,8 +635,12 @@ abstract class PhabricatorApplication
return array();
}
protected function getEditRoutePattern($base) {
protected function getEditRoutePattern($base = null) {
return $base.'(?:(?P<id>[0-9]\d*)/)?(?:(?P<editAction>parameters)/)?';
}
protected function getQueryRoutePattern($base = null) {
return $base.'(?:query/(?P<queryKey>[^/]+)/)?';
}
}

View file

@ -56,7 +56,6 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase {
$env->overrideEnvConfig('phabricator.base-uri', 'http://'.$host);
$env->overrideEnvConfig('policy.allow-public', false);
$env->overrideEnvConfig('auth.require-email-verification', false);
$env->overrideEnvConfig('auth.email-domains', array());
$env->overrideEnvConfig('security.require-multi-factor-auth', false);

View file

@ -68,6 +68,15 @@ final class PhabricatorCalendarApplication extends PhabricatorApplication {
);
}
public function getHelpDocumentationArticles(PhabricatorUser $viewer) {
return array(
array(
'name' => pht('Calendar User Guide'),
'href' => PhabricatorEnv::getDoclink('Calendar User Guide'),
),
);
}
public function getQuickCreateItems(PhabricatorUser $viewer) {
$items = array();

View file

@ -436,9 +436,9 @@ final class PhabricatorCalendarEventEditor
$body = parent::buildMailBody($object, $xactions);
if (strlen($description)) {
$body->addTextSection(
$body->addRemarkupSection(
pht('EVENT DESCRIPTION'),
$object->getDescription());
$description);
}
$body->addLinkSection(

View file

@ -19,20 +19,20 @@ final class ConduitQueryConduitAPIMethod extends ConduitAPIMethod {
}
protected function execute(ConduitAPIRequest $request) {
$classes = id(new PhutilClassMapQuery())
->setAncestorClass('ConduitAPIMethod')
$methods = id(new PhabricatorConduitMethodQuery())
->setViewer($request->getUser())
->execute();
$names_to_params = array();
foreach ($classes as $class) {
$names_to_params[$class->getAPIMethodName()] = array(
'description' => $class->getMethodDescription(),
'params' => $class->getParamTypes(),
'return' => $class->getReturnType(),
$map = array();
foreach ($methods as $method) {
$map[$method->getAPIMethodName()] = array(
'description' => $method->getMethodDescription(),
'params' => $method->getParamTypes(),
'return' => $method->getReturnType(),
);
}
return $names_to_params;
return $map;
}
}

View file

@ -115,6 +115,43 @@ final class PhabricatorConduitMethodQuery
return $methods;
}
protected function willFilterPage(array $methods) {
$application_phids = array();
foreach ($methods as $method) {
$application = $method->getApplication();
if ($application === null) {
continue;
}
$application_phids[] = $application->getPHID();
}
if ($application_phids) {
$applications = id(new PhabricatorApplicationQuery())
->setParentQuery($this)
->setViewer($this->getViewer())
->withPHIDs($application_phids)
->execute();
$applications = mpull($applications, null, 'getPHID');
} else {
$applications = array();
}
// Remove methods which belong to an application the viewer can not see.
foreach ($methods as $key => $method) {
$application = $method->getApplication();
if ($application === null) {
continue;
}
if (empty($applications[$application->getPHID()])) {
$this->didRejectResult($method);
unset($methods[$key]);
}
}
return $methods;
}
public function getQueryApplicationClass() {
return 'PhabricatorConduitApplication';
}

View file

@ -47,7 +47,6 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck {
}
$phd_user = PhabricatorEnv::getEnvConfig('phd.user');
$environment_hash = PhabricatorEnv::calculateEnvironmentHash();
$all_daemons = id(new PhabricatorDaemonLogQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE)
@ -91,107 +90,6 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck {
->addCommand('phabricator/ $ ./bin/phd restart');
}
}
if ($daemon->getEnvHash() != $environment_hash) {
$doc_href = PhabricatorEnv::getDocLink(
'Managing Daemons with phd');
$summary = pht(
'At least one daemon is currently running with different '.
'configuration than the Phabricator web application.');
$list_section = null;
$env_info = $daemon->getEnvInfo();
if ($env_info) {
$issues = PhabricatorEnv::compareEnvironmentInfo(
PhabricatorEnv::calculateEnvironmentInfo(),
$env_info);
if ($issues) {
foreach ($issues as $key => $issue) {
$issues[$key] = phutil_tag('li', array(), $issue);
}
$list_section = array(
pht(
'The configurations differ in the following %s way(s):',
phutil_count($issues)),
phutil_tag(
'ul',
array(),
$issues),
);
}
}
$message = pht(
'At least one daemon is currently running with a different '.
'configuration (config checksum %s) than the web application '.
'(config checksum %s).'.
"\n\n%s".
'This usually means that you have just made a configuration change '.
'from the web UI, but have not yet restarted the daemons. You '.
'need to restart the daemons after making configuration changes '.
'so they will pick up the new values: until you do, they will '.
'continue operating with the old settings.'.
"\n\n".
'(If you plan to make more changes, you can restart the daemons '.
'once after you finish making all of your changes.)'.
"\n\n".
'Use %s to restart daemons. You can find a list of running daemons '.
'in the %s, which will also help you identify which daemon (or '.
'daemons) have divergent configuration. For more information about '.
'managing the daemons, see %s in the documentation.'.
"\n\n".
'This can also happen if you use the %s environmental variable to '.
'choose a configuration file, but the daemons run with a different '.
'value than the web application. If restarting the daemons does '.
'not resolve this issue and you use %s to select configuration, '.
'check that it is set consistently.'.
"\n\n".
'A third possible cause is that you run several machines, and '.
'the %s configuration file differs between them. This file is '.
'updated when you edit configuration from the CLI with %s. If '.
'restarting the daemons does not resolve this issue and you '.
'run multiple machines, check that all machines have identical '.
'%s configuration files.'.
"\n\n".
'This issue is not severe, but usually indicates that something '.
'is not configured the way you expect, and may cause the daemons '.
'to exhibit different behavior than the web application does.',
phutil_tag('tt', array(), substr($daemon->getEnvHash(), 0, 12)),
phutil_tag('tt', array(), substr($environment_hash, 0, 12)),
$list_section,
phutil_tag('tt', array(), 'bin/phd restart'),
phutil_tag(
'a',
array(
'href' => '/daemon/',
'target' => '_blank',
),
pht('Daemon Console')),
phutil_tag(
'a',
array(
'href' => $doc_href,
'target' => '_blank',
),
pht('Managing Daemons with phd')),
phutil_tag('tt', array(), 'PHABRICATOR_ENV'),
phutil_tag('tt', array(), 'PHABRICATOR_ENV'),
phutil_tag('tt', array(), 'phabricator/conf/local/local.json'),
phutil_tag('tt', array(), 'bin/config'),
phutil_tag('tt', array(), 'phabricator/conf/local/local.json'));
$this->newIssue('daemons.need-restarting')
->setName(pht('Daemons and Web Have Different Config'))
->setSummary($summary)
->setMessage($message)
->addCommand('phabricator/ $ ./bin/phd restart');
break;
}
}
}

View file

@ -292,6 +292,10 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
'gcdaemon.ttl.task-archive' => $gc_reason,
'gcdaemon.ttl.general-cache' => $gc_reason,
'gcdaemon.ttl.conduit-logs' => $gc_reason,
'phd.variant-config' => pht(
'This configuration is no longer relevant because daemons '.
'restart automatically on configuration changes.'),
);
return $ancient_config;

View file

@ -1,35 +0,0 @@
<?php
final class PhabricatorDisqusConfigOptions
extends PhabricatorApplicationConfigOptions {
public function getName() {
return pht('Integration with Disqus');
}
public function getDescription() {
return pht('Disqus authentication and integration options.');
}
public function getFontIcon() {
return 'fa-comment';
}
public function getGroup() {
return 'core';
}
public function getOptions() {
return array(
$this->newOption('disqus.shortname', 'string', null)
->setSummary(pht('Shortname for Disqus comment widget.'))
->setDescription(
pht(
"Website shortname to use for Disqus comment widget in Phame. ".
"For more information, see:\n\n".
"[[http://docs.disqus.com/help/4/ | Disqus Quick Start Guide]]\n".
"[[http://docs.disqus.com/help/68/ | Information on Shortnames]]")),
);
}
}

View file

@ -73,13 +73,6 @@ final class PhabricatorPHDConfigOptions
"trace mode. See also '%s'.",
'phd debug',
'phd.verbose')),
$this->newOption('phd.variant-config', 'list<string>', array())
->setDescription(
pht(
'Specify config keys that can safely vary between the web tier '.
'and the daemons. Primarily, this is a way to suppress the '.
'"Daemons and Web Have Different Config" setup issue on a per '.
'config key basis.')),
$this->newOption('phd.garbage-collection', 'wild', array())
->setLocked(true)
->setLockedMessage(

View file

@ -0,0 +1,35 @@
<?php
final class PhabricatorPhurlConfigOptions
extends PhabricatorApplicationConfigOptions {
public function getName() {
return pht('Phurl');
}
public function getDescription() {
return pht('Options for Phurl.');
}
public function getFontIcon() {
return 'fa-link';
}
public function getGroup() {
return 'apps';
}
public function getOptions() {
return array(
$this->newOption('phurl.short-uri', 'string', null)
->setLocked(true)
->setSummary(pht('URI that Phurl will use to shorten URLs.'))
->setDescription(
pht(
'Set the URI that Phurl will use to share shortened URLs.'))
->addExample(
'https://some-very-short-domain.museum/',
pht('Valid Setting')),
);
}
}

View file

@ -623,9 +623,8 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
switch ($xaction->getTransactionType()) {
case ConpherenceTransaction::TYPE_PICTURE:
return array($xaction->getNewValue()->getPHID());
case ConpherenceTransaction::TYPE_PICTURE_CROP:
return array($xaction->getNewValue());
return array($xaction->getNewValue());
}
return parent::extractFilePHIDsFromCustomTransaction($object, $xaction);

View file

@ -58,14 +58,6 @@ final class PhabricatorDaemonLogViewController
}
$header->addTag($tag);
$env_hash = PhabricatorEnv::calculateEnvironmentHash();
if ($log->getEnvHash() != $env_hash) {
$tag = id(new PHUITagView())
->setType(PHUITagView::TYPE_STATE)
->setBackgroundColor(PHUITagView::COLOR_YELLOW)
->setName(pht('Stale Config'));
$header->addTag($tag);
}
$properties = $this->buildPropertyListView($log);

View file

@ -42,8 +42,6 @@ final class PhabricatorDaemonEventListener extends PhabricatorEventListener {
->setHost(php_uname('n'))
->setPID(getmypid())
->setRunningAsUser($current_user['name'])
->setEnvHash(PhabricatorEnv::calculateEnvironmentHash())
->setEnvInfo(PhabricatorEnv::calculateEnvironmentInfo())
->setStatus(PhabricatorDaemonLog::STATUS_RUNNING)
->setArgv($event->getValue('argv'))
->setExplicitArgv($event->getValue('explicitArgv'))

View file

@ -17,8 +17,6 @@ final class PhabricatorDaemonLog extends PhabricatorDaemonDAO
protected $runningAsUser;
protected $argv;
protected $explicitArgv = array();
protected $envHash;
protected $envInfo;
protected $status;
protected function getConfiguration() {
@ -26,14 +24,12 @@ final class PhabricatorDaemonLog extends PhabricatorDaemonDAO
self::CONFIG_SERIALIZATION => array(
'argv' => self::SERIALIZATION_JSON,
'explicitArgv' => self::SERIALIZATION_JSON,
'envInfo' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'daemon' => 'text255',
'host' => 'text255',
'pid' => 'uint32',
'runningAsUser' => 'text255?',
'envHash' => 'bytes40',
'status' => 'text8',
'daemonID' => 'text64',
),

View file

@ -17,7 +17,6 @@ final class PhabricatorDaemonLogListView extends AphrontView {
throw new PhutilInvalidStateException('setUser');
}
$env_hash = PhabricatorEnv::calculateEnvironmentHash();
$list = new PHUIObjectItemListView();
$list->setFlush(true);
foreach ($this->daemonLogs as $log) {
@ -33,15 +32,8 @@ final class PhabricatorDaemonLogListView extends AphrontView {
$status = $log->getStatus();
switch ($status) {
case PhabricatorDaemonLog::STATUS_RUNNING:
if ($env_hash != $log->getEnvHash()) {
$item->setStatusIcon('fa-warning yellow');
$item->addAttribute(pht(
'This daemon is running with an out of date configuration and '.
'should be restarted.'));
} else {
$item->setStatusIcon('fa-rocket green');
$item->addAttribute(pht('This daemon is running.'));
}
$item->setStatusIcon('fa-rocket green');
$item->addAttribute(pht('This daemon is running.'));
break;
case PhabricatorDaemonLog::STATUS_DEAD:
$item->setStatusIcon('fa-warning red');

View file

@ -387,7 +387,6 @@ final class DifferentialChangesetViewController extends DifferentialController {
$inlines = array();
foreach ($messages as $message) {
$description = $message->getProperty('description');
$description = '%%%'.$description.'%%%';
$inlines[] = id(clone $template)
->setSyntheticAuthor(pht('Lint: %s', $message->getName()))

View file

@ -1298,15 +1298,6 @@ final class DifferentialTransactionEditor
return true;
}
protected function extractFilePHIDsFromCustomTransaction(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {}
return parent::extractFilePHIDsFromCustomTransaction($object, $xaction);
}
protected function expandCustomRemarkupBlockTransactions(
PhabricatorLiskDAO $object,
array $xactions,

View file

@ -20,11 +20,17 @@ final class DiffusionUpdateCoverageConduitAPIMethod
}
protected function defineParamTypes() {
$modes = array(
'overwrite',
'update',
);
return array(
'repositoryPHID' => 'required phid',
'branch' => 'required string',
'commit' => 'required string',
'coverage' => 'required map<string, string>',
'mode' => 'optional '.$this->formatStringConstants($modes),
);
}
@ -77,16 +83,31 @@ final class DiffusionUpdateCoverageConduitAPIMethod
$table_name = 'repository_coverage';
$conn->openTransaction();
queryfx(
$conn,
'DELETE FROM %T WHERE branchID = %d',
$table_name,
$branch->getID());
$mode = $request->getValue('mode');
switch ($mode) {
case '':
case 'overwrite':
// sets the coverage for the whole branch, deleting all previous
// coverage information
queryfx(
$conn,
'DELETE FROM %T WHERE branchID = %d',
$table_name,
$branch->getID());
break;
case 'update':
// sets the coverage for the provided files on the specified commit
break;
default:
$conn->killTransaction();
throw new Exception(pht('Invalid mode "%s".', $mode));
}
foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
queryfx(
$conn,
'INSERT INTO %T (branchID, pathID, commitID, coverage) VALUES %Q',
'INSERT INTO %T (branchID, pathID, commitID, coverage) VALUES %Q'.
' ON DUPLICATE KEY UPDATE coverage=VALUES(coverage)',
$table_name,
$chunk);
}

View file

@ -30,8 +30,7 @@ final class DiffusionBrowseTableView extends DiffusionView {
$rows = array();
$show_edit = false;
foreach ($this->paths as $path) {
$history_link = $this->linkHistory($path->getPath());
$full_path = $base_path.$path->getPath();
$dir_slash = null;
$file_type = $path->getFileType();
@ -40,11 +39,13 @@ final class DiffusionBrowseTableView extends DiffusionView {
$dir_slash = '/';
$browse_link = phutil_tag('strong', array(), $this->linkBrowse(
$base_path.$path->getPath().$dir_slash,
$full_path.$dir_slash,
array(
'type' => $file_type,
'name' => $browse_text,
)));
$history_path = $full_path.'/';
} else if ($file_type == DifferentialChangeType::FILE_SUBMODULE) {
$browse_text = $path->getPath().'/';
$browse_link = phutil_tag('strong', array(), $this->linkBrowse(
@ -55,16 +56,22 @@ final class DiffusionBrowseTableView extends DiffusionView {
'hash' => $path->getHash(),
'external' => $path->getExternalURI(),
)));
$history_path = $full_path.'/';
} else {
$browse_text = $path->getPath();
$browse_link = $this->linkBrowse(
$base_path.$path->getPath(),
$full_path,
array(
'type' => $file_type,
'name' => $browse_text,
));
$history_path = $full_path;
}
$history_link = $this->linkHistory($history_path);
$dict = array(
'lint' => celerity_generate_unique_node_id(),
'commit' => celerity_generate_unique_node_id(),
@ -73,7 +80,7 @@ final class DiffusionBrowseTableView extends DiffusionView {
'details' => celerity_generate_unique_node_id(),
);
$need_pull[$base_path.$path->getPath().$dir_slash] = $dict;
$need_pull[$full_path.$dir_slash] = $dict;
foreach ($dict as $k => $uniq) {
$dict[$k] = phutil_tag('span', array('id' => $uniq), '');
}

View file

@ -40,6 +40,14 @@ final class DoorkeeperJIRAFeedWorker extends DoorkeeperFeedWorker {
return;
}
$do_anything = ($this->shouldPostComment() || $this->shouldPostLink());
if (!$do_anything) {
$this->log(
"%s\n",
pht('JIRA integration is configured not to post anything.'));
return;
}
$xobjs = id(new DoorkeeperExternalObjectQuery())
->setViewer($viewer)
->withPHIDs($jira_issue_phids)
@ -60,7 +68,6 @@ final class DoorkeeperJIRAFeedWorker extends DoorkeeperFeedWorker {
return;
}
$story_text = $this->renderStoryText();
$xobjs = mgroup($xobjs, 'getApplicationDomain');
foreach ($xobjs as $domain => $xobj_list) {
@ -84,13 +91,16 @@ final class DoorkeeperJIRAFeedWorker extends DoorkeeperFeedWorker {
foreach ($xobj_list as $xobj) {
foreach ($accounts as $account) {
try {
$provider->newJIRAFuture(
$account,
'rest/api/2/issue/'.$xobj->getObjectID().'/comment',
'POST',
array(
'body' => $story_text,
))->resolveJSON();
$jira_key = $xobj->getObjectID();
if ($this->shouldPostComment()) {
$this->postComment($account, $jira_key);
}
if ($this->shouldPostLink()) {
$this->postLink($account, $jira_key);
}
break;
} catch (HTTPFutureResponseStatus $ex) {
phlog($ex);
@ -169,14 +179,70 @@ final class DoorkeeperJIRAFeedWorker extends DoorkeeperFeedWorker {
return $try_users;
}
private function shouldPostComment() {
return $this->getProvider()->shouldCreateJIRAComment();
}
private function shouldPostLink() {
return $this->getProvider()->shouldCreateJIRALink();
}
private function postComment($account, $jira_key) {
$provider = $this->getProvider();
$provider->newJIRAFuture(
$account,
'rest/api/2/issue/'.$jira_key.'/comment',
'POST',
array(
'body' => $this->renderStoryText(),
))->resolveJSON();
}
private function renderStoryText() {
$object = $this->getStoryObject();
$publisher = $this->getPublisher();
$text = $publisher->getStoryText($object);
$uri = $publisher->getObjectURI($object);
return $text."\n\n".$uri;
if ($this->shouldPostLink()) {
return $text;
} else {
// include the link in the comment
return $text."\n\n".$publisher->getObjectURI($object);
}
}
private function postLink($account, $jira_key) {
$provider = $this->getProvider();
$object = $this->getStoryObject();
$publisher = $this->getPublisher();
$icon_uri = celerity_get_resource_uri('rsrc/favicons/favicon-16x16.png');
$provider->newJIRAFuture(
$account,
'rest/api/2/issue/'.$jira_key.'/remotelink',
'POST',
// format documented at http://bit.ly/1K5T0Li
array(
'globalId' => $object->getPHID(),
'application' => array(
'type' => 'com.phacility.phabricator',
'name' => 'Phabricator',
),
'relationship' => 'implemented in',
'object' => array(
'url' => $publisher->getObjectURI($object),
'title' => $publisher->getObjectTitle($object),
'icon' => array(
'url16x16' => $icon_uri,
'title' => 'Phabricator',
),
'status' => array(
'resolved' => $publisher->isObjectClosed($object),
),
),
))->resolveJSON();
}
}

View file

@ -47,10 +47,10 @@ final class PhabricatorHeraldApplication extends PhabricatorApplication {
public function getRoutes() {
return array(
'/H(?P<id>[1-9]\d*)' => 'HeraldRuleViewController',
'/herald/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'HeraldRuleListController',
'new/' => 'HeraldNewController',
'rule/(?P<id>[1-9]\d*)/' => 'HeraldRuleViewController',
'edit/(?:(?P<id>[1-9]\d*)/)?' => 'HeraldRuleController',
'disable/(?P<id>[1-9]\d*)/(?P<action>\w+)/'
=> 'HeraldDisableController',

View file

@ -25,7 +25,7 @@ final class HeraldDisableController extends HeraldController {
HeraldManageGlobalRulesCapability::CAPABILITY);
}
$view_uri = $this->getApplicationURI("rule/{$id}/");
$view_uri = '/'.$rule->getMonogram();
$is_disable = ($action === 'disable');

View file

@ -22,7 +22,7 @@ final class HeraldRuleController extends HeraldController {
if (!$rule) {
return new Aphront404Response();
}
$cancel_uri = $this->getApplicationURI("rule/{$id}/");
$cancel_uri = '/'.$rule->getMonogram();
} else {
$new_uri = $this->getApplicationURI('new/');
@ -128,7 +128,7 @@ final class HeraldRuleController extends HeraldController {
list($e_name, $errors) = $this->saveRule($adapter, $rule, $request);
if (!$errors) {
$id = $rule->getID();
$uri = $this->getApplicationURI("rule/{$id}/");
$uri = '/'.$rule->getMonogram();
return id(new AphrontRedirectResponse())->setURI($uri);
}
}

View file

@ -67,7 +67,7 @@ final class HeraldRuleViewController extends HeraldController {
$view = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($rule)
->setObjectURI($this->getApplicationURI("rule/{$id}/"));
->setObjectURI('/'.$rule->getMonogram());
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,

View file

@ -32,12 +32,12 @@ final class HeraldRulePHIDType extends PhabricatorPHIDType {
foreach ($handles as $phid => $handle) {
$rule = $objects[$phid];
$id = $rule->getID();
$name = $rule->getName();
$monogram = $rule->getMonogram();
$name = $rule->getName();
$handle->setName("H{$id}");
$handle->setFullName("H{$id} {$name}");
$handle->setURI("/herald/rule/{$id}/");
$handle->setName($monogram);
$handle->setFullName("{$monogram} {$name}");
$handle->setURI("/{$monogram}");
}
}

View file

@ -173,12 +173,12 @@ final class HeraldRuleSearchEngine extends PhabricatorApplicationSearchEngine {
$list = id(new PHUIObjectItemListView())
->setUser($viewer);
foreach ($rules as $rule) {
$id = $rule->getID();
$monogram = $rule->getMonogram();
$item = id(new PHUIObjectItemView())
->setObjectName("H{$id}")
->setObjectName($monogram)
->setHeader($rule->getName())
->setHref($this->getApplicationURI("rule/{$id}/"));
->setHref("/{$monogram}");
if ($rule->isPersonalRule()) {
$item->addIcon('fa-user', pht('Personal Rule'));

View file

@ -5,7 +5,8 @@ final class HeraldRule extends HeraldDAO
PhabricatorApplicationTransactionInterface,
PhabricatorFlaggableInterface,
PhabricatorPolicyInterface,
PhabricatorDestructibleInterface {
PhabricatorDestructibleInterface,
PhabricatorSubscribableInterface {
const TABLE_RULE_APPLIED = 'herald_ruleapplied';
@ -320,8 +321,25 @@ final class HeraldRule extends HeraldDAO
}
/* -( PhabricatorSubscribableInterface )----------------------------------- */
public function isAutomaticallySubscribed($phid) {
return $this->isPersonalRule() && $phid == $this->getAuthorPHID();
}
public function shouldShowSubscribersProperty() {
return true;
}
public function shouldAllowSubscription($phid) {
return true;
}
/* -( PhabricatorDestructibleInterface )----------------------------------- */
public function destroyObjectPermanently(
PhabricatorDestructionEngine $engine) {

View file

@ -33,6 +33,7 @@ final class HeraldSchemaSpec extends PhabricatorConfigSchemaSpec {
'unique' => true,
),
));
$this->buildEdgeSchemata(new HeraldRule());
}
}

View file

@ -66,7 +66,6 @@ final class PhabricatorLegalpadSignaturePolicyRule
->setViewer($viewer)
->withPHIDs($value)
->execute();
return mpull($handles, 'getFullName', 'getPHID');
}

View file

@ -839,9 +839,9 @@ final class ManiphestTransaction
case self::TYPE_MERGED_FROM:
return pht(
'%s merged %d task(s) %s into %s.',
'%s merged %s task(s) %s into %s.',
$this->renderHandleLink($author_phid),
count($new),
phutil_count($new),
$this->renderHandleList($new),
$this->renderHandleLink($object_phid));

View file

@ -126,7 +126,7 @@ abstract class PhabricatorObjectMailReceiver extends PhabricatorMailReceiver {
$expect_hash = self::computeMailHash($object->getMailKey(), $check_phid);
if ($expect_hash != $parts['hash']) {
if (!phutil_hashes_are_identical($expect_hash, $parts['hash'])) {
throw new PhabricatorMetaMTAReceivedMailProcessingException(
MetaMTAReceivedMailStatus::STATUS_HASH_MISMATCH,
pht(

View file

@ -43,16 +43,16 @@ final class PhabricatorMetaMTAMailBody extends Phobject {
return $this;
}
public function addRemarkupSection($text) {
public function addRemarkupSection($header, $text) {
try {
$engine = PhabricatorMarkupEngine::newMarkupEngine(array());
$engine->setConfig('viewer', $this->getViewer());
$engine->setMode(PhutilRemarkupEngine::MODE_TEXT);
$styled_text = $engine->markupText($text);
$this->sections[] = $styled_text;
$this->addPlaintextSection($header, $styled_text);
} catch (Exception $ex) {
phlog($ex);
$this->sections[] = $text;
$this->addTextSection($header, $text);
}
try {
@ -63,14 +63,10 @@ final class PhabricatorMetaMTAMailBody extends Phobject {
'uri.base',
PhabricatorEnv::getProductionURI('/'));
$html = $mail_engine->markupText($text);
$this->htmlSections[] = $html;
$this->addHTMLSection($header, $html);
} catch (Exception $ex) {
phlog($ex);
$this->htmlSections[] = phutil_escape_html_newlines(
phutil_tag(
'div',
array(),
$text));
$this->addHTMLSection($header, $text);
}
return $this;
@ -121,12 +117,16 @@ final class PhabricatorMetaMTAMailBody extends Phobject {
}
public function addHTMLSection($header, $html_fragment) {
if ($header !== null) {
$header = phutil_tag('strong', array(), $header);
}
$this->htmlSections[] = array(
phutil_tag(
'div',
array(),
array(
phutil_tag('strong', array(), $header),
$header,
phutil_tag('div', array(), $html_fragment),
)),
);
@ -212,5 +212,4 @@ final class PhabricatorMetaMTAMailBody extends Phobject {
private function indent($text) {
return rtrim(" ".str_replace("\n", "\n ", $text));
}
}

View file

@ -205,18 +205,6 @@ final class PhabricatorOwnersPackageTransactionEditor
return $errors;
}
protected function extractFilePHIDsFromCustomTransaction(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION:
return array($xaction->getNewValue());
}
return parent::extractFilePHIDsFromCustomTransaction($object, $xaction);
}
protected function shouldSendMail(
PhabricatorLiskDAO $object,
array $xactions) {

View file

@ -208,4 +208,16 @@ final class PhabricatorOwnersPackageTransaction
return parent::renderChangeDetails($viewer);
}
public function getRemarkupBlocks() {
$blocks = parent::getRemarkupBlocks();
switch ($this->getTransactionType()) {
case self::TYPE_DESCRIPTION:
$blocks[] = $this->getNewValue();
break;
}
return $blocks;
}
}

View file

@ -0,0 +1,10 @@
<?php
final class PhabricatorOwnersSchemaSpec
extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildEdgeSchemata(new PhabricatorOwnersPackage());
}
}

View file

@ -1,7 +1,7 @@
<?php
final class PasteEditConduitAPIMethod
extends PhabricatorApplicationEditEngineAPIMethod {
extends PhabricatorEditEngineAPIMethod {
public function getAPIMethodName() {
return 'paste.edit';

View file

@ -1,7 +1,17 @@
<?php
final class PhabricatorPasteEditEngine
extends PhabricatorApplicationEditEngine {
extends PhabricatorEditEngine {
const ENGINECONST = 'paste.paste';
public function getEngineName() {
return pht('Pastes');
}
public function getEngineApplicationClass() {
return 'PhabricatorPasteApplication';
}
protected function newEditableObject() {
return PhabricatorPaste::initializeNewPaste($this->getViewer());
@ -24,7 +34,7 @@ final class PhabricatorPasteEditEngine
return $object->getMonogram();
}
protected function getObjectCreateShortText($object) {
protected function getObjectCreateShortText() {
return pht('Create Paste');
}

View file

@ -54,6 +54,7 @@ final class PhabricatorPhameApplication extends PhabricatorApplication {
'framed/(?P<id>\d+)/' => 'PhamePostFramedController',
'new/' => 'PhamePostNewController',
'move/(?P<id>\d+)/' => 'PhamePostNewController',
'comment/(?P<id>[1-9]\d*)/' => 'PhamePostCommentController',
),
'blog/' => array(
'(?:(?P<filter>user|all)/)?' => 'PhameBlogListController',
@ -102,4 +103,13 @@ final class PhabricatorPhameApplication extends PhabricatorApplication {
);
}
protected function getCustomCapabilities() {
return array(
PhameBlogCreateCapability::CAPABILITY => array(
'default' => PhabricatorPolicies::POLICY_USER,
'caption' => pht('Default create policy for blogs.'),
),
);
}
}

View file

@ -0,0 +1,16 @@
<?php
final class PhameBlogCreateCapability
extends PhabricatorPolicyCapability {
const CAPABILITY = 'phame.blog.default.create';
public function getCapabilityName() {
return pht('Can Create Blogs');
}
public function describeCapabilityRejection() {
return pht('You do not have permission to create a blog.');
}
}

View file

@ -73,7 +73,8 @@ final class PhameCreatePostConduitAPIMethod extends PhameConduitAPIMethod {
->withPHIDs(array($blog_phid))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_JOIN,
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
@ -85,7 +86,7 @@ final class PhameCreatePostConduitAPIMethod extends PhameConduitAPIMethod {
$is_draft = $request->getValue('isDraft', false);
if (!$is_draft) {
$post->setDatePublished(time());
$post->setVisibility(PhamePost::VISIBILITY_PUBLISHED);
$post->setVisibility(PhameConstants::VISIBILITY_PUBLISHED);
}
$post->setTitle($title);
$phame_title = $request->getValue(

View file

@ -65,9 +65,9 @@ final class PhameQueryPostsConduitAPIMethod extends PhameConduitAPIMethod {
$published = $request->getValue('published', null);
if ($published === true) {
$query->withVisibility(PhamePost::VISIBILITY_PUBLISHED);
$query->withVisibility(PhameConstants::VISIBILITY_PUBLISHED);
} else if ($published === false) {
$query->withVisibility(PhamePost::VISIBILITY_DRAFT);
$query->withVisibility(PhameConstants::VISIBILITY_DRAFT);
}
$published_after = $request->getValue('publishedAfter', null);

View file

@ -0,0 +1,23 @@
<?php
final class PhameConstants extends Phobject {
const VISIBILITY_DRAFT = 0;
const VISIBILITY_PUBLISHED = 1;
public static function getPhamePostStatusMap() {
return array(
self::VISIBILITY_PUBLISHED => pht('Published'),
self::VISIBILITY_DRAFT => pht('Draft'),
);
}
public static function getPhamePostStatusName($status) {
$map = array(
self::VISIBILITY_PUBLISHED => pht('Published'),
self::VISIBILITY_DRAFT => pht('Draft'),
);
return idx($map, $status, pht('Unknown'));
}
}

View file

@ -92,15 +92,22 @@ abstract class PhameController extends PhabricatorController {
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$can_create = $this->hasApplicationCapability(
PhameBlogCreateCapability::CAPABILITY);
$crumbs->addAction(
id(new PHUIListItemView())
->setName(pht('New Blog'))
->setHref($this->getApplicationURI('/blog/new'))
->setIcon('fa-plus-square'));
->setHref($this->getApplicationURI('/blog/new/'))
->setIcon('fa-plus-square')
->setDisabled(!$can_create)
->setWorkflow(!$can_create));
$crumbs->addAction(
id(new PHUIListItemView())
->setName(pht('New Post'))
->setHref($this->getApplicationURI('/post/new'))
->setHref($this->getApplicationURI('/post/new/'))
->setIcon('fa-pencil'));
return $crumbs;
}

View file

@ -28,36 +28,41 @@ final class PhameBlogEditController
$blog->getPHID(),
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
$v_projects = array_reverse($v_projects);
$v_cc = PhabricatorSubscribersQuery::loadSubscribersForPHID(
$blog->getPHID());
} else {
$this->requireApplicationCapability(
PhameBlogCreateCapability::CAPABILITY);
$blog = PhameBlog::initializeNewBlog($viewer);
$submit_button = pht('Create Blog');
$page_title = pht('Create Blog');
$cancel_uri = $this->getApplicationURI();
$v_projects = array();
$v_cc = array();
}
$name = $blog->getName();
$description = $blog->getDescription();
$name = $blog->getName();
$description = $blog->getDescription();
$custom_domain = $blog->getDomain();
$skin = $blog->getSkin();
$can_view = $blog->getViewPolicy();
$can_edit = $blog->getEditPolicy();
$can_join = $blog->getJoinPolicy();
$skin = $blog->getSkin();
$can_view = $blog->getViewPolicy();
$can_edit = $blog->getEditPolicy();
$e_name = true;
$e_custom_domain = null;
$e_view_policy = null;
$validation_exception = null;
if ($request->isFormPost()) {
$name = $request->getStr('name');
$description = $request->getStr('description');
$name = $request->getStr('name');
$description = $request->getStr('description');
$custom_domain = nonempty($request->getStr('custom_domain'), null);
$skin = $request->getStr('skin');
$can_view = $request->getStr('can_view');
$can_edit = $request->getStr('can_edit');
$can_join = $request->getStr('can_join');
$v_projects = $request->getArr('projects');
$skin = $request->getStr('skin');
$can_view = $request->getStr('can_view');
$can_edit = $request->getStr('can_edit');
$v_projects = $request->getArr('projects');
$v_cc = $request->getArr('cc');
$xactions = array(
id(new PhameBlogTransaction())
@ -79,8 +84,8 @@ final class PhameBlogEditController
->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY)
->setNewValue($can_edit),
id(new PhameBlogTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY)
->setNewValue($can_join),
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
->setNewValue(array('=' => $v_cc)),
);
$proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
@ -136,6 +141,13 @@ final class PhameBlogEditController
->setID('blog-description')
->setUser($viewer)
->setDisableMacros(true))
->appendControl(
id(new AphrontFormTokenizerControl())
->setLabel(pht('Subscribers'))
->setName('cc')
->setValue($v_cc)
->setUser($viewer)
->setDatasource(new PhabricatorMetaMTAMailableDatasource()))
->appendChild(
id(new AphrontFormPolicyControl())
->setUser($viewer)
@ -153,14 +165,6 @@ final class PhameBlogEditController
->setPolicies($policies)
->setValue($can_edit)
->setName('can_edit'))
->appendChild(
id(new AphrontFormPolicyControl())
->setUser($viewer)
->setCapability(PhabricatorPolicyCapability::CAN_JOIN)
->setPolicyObject($blog)
->setPolicies($policies)
->setValue($can_join)
->setName('can_join'))
->appendControl(
id(new AphrontFormTokenizerControl())
->setLabel(pht('Projects'))

View file

@ -21,7 +21,7 @@ final class PhameBlogFeedController extends PhameBlogController {
$posts = id(new PhamePostQuery())
->setViewer($viewer)
->withBlogPHIDs(array($blog->getPHID()))
->withVisibility(PhamePost::VISIBILITY_PUBLISHED)
->withVisibility(PhameConstants::VISIBILITY_PUBLISHED)
->execute();
$blog_uri = PhabricatorEnv::getProductionURI(

View file

@ -39,8 +39,11 @@ final class PhameBlogViewController extends PhameBlogController {
->appendChild($post_list);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Blogs'), $this->getApplicationURI('blog/'));
$crumbs->addTextCrumb($blog->getName(), $this->getApplicationURI());
$crumbs->addTextCrumb(
pht('Blogs'),
$this->getApplicationURI('blog/'));
$crumbs->addTextCrumb(
$blog->getName());
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
@ -100,10 +103,6 @@ final class PhameBlogViewController extends PhameBlogController {
pht('Editable By'),
$descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$properties->addProperty(
pht('Joinable By'),
$descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
$engine = id(new PhabricatorMarkupEngine())
->setViewer($viewer)
->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)
@ -136,18 +135,13 @@ final class PhameBlogViewController extends PhameBlogController {
$blog,
PhabricatorPolicyCapability::CAN_EDIT);
$can_join = PhabricatorPolicyFilter::hasCapability(
$viewer,
$blog,
PhabricatorPolicyCapability::CAN_JOIN);
$actions->addAction(
id(new PhabricatorActionView())
->setIcon('fa-plus')
->setHref($this->getApplicationURI('post/edit/?blog='.$blog->getID()))
->setName(pht('Write Post'))
->setDisabled(!$can_join)
->setWorkflow(!$can_join));
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
$actions->addAction(
id(new PhabricatorActionView())

View file

@ -0,0 +1,63 @@
<?php
final class PhamePostCommentController
extends PhamePostController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
if (!$request->isFormPost()) {
return new Aphront400Response();
}
$post = id(new PhamePostQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if (!$post) {
return new Aphront404Response();
}
$is_preview = $request->isPreviewRequest();
$draft = PhabricatorDraft::buildFromRequest($request);
$view_uri = $this->getApplicationURI('post/view/'.$post->getID().'/');
$xactions = array();
$xactions[] = id(new PhamePostTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
->attachComment(
id(new PhamePostTransactionComment())
->setContent($request->getStr('comment')));
$editor = id(new PhamePostEditor())
->setActor($viewer)
->setContinueOnNoEffect($request->isContinueRequest())
->setContentSourceFromRequest($request)
->setIsPreview($is_preview);
try {
$xactions = $editor->applyTransactions($post, $xactions);
} catch (PhabricatorApplicationTransactionNoEffectException $ex) {
return id(new PhabricatorApplicationTransactionNoEffectResponse())
->setCancelURI($view_uri)
->setException($ex);
}
if ($draft) {
$draft->replaceOrDelete();
}
if ($request->isAjax() && $is_preview) {
return id(new PhabricatorApplicationTransactionResponse())
->setViewer($viewer)
->setTransactions($xactions)
->setIsPreview($is_preview);
} else {
return id(new AphrontRedirectResponse())
->setURI($view_uri);
}
}
}

View file

@ -27,6 +27,8 @@ final class PhamePostEditController extends PhamePostController {
$post->getPHID(),
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
$v_projects = array_reverse($v_projects);
$v_cc = PhabricatorSubscribersQuery::loadSubscribersForPHID(
$post->getPHID());
} else {
$blog = id(new PhameBlogQuery())
->setViewer($viewer)
@ -34,36 +36,38 @@ final class PhamePostEditController extends PhamePostController {
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_JOIN,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$blog) {
return new Aphront404Response();
}
$v_projects = array();
$v_cc = array();
$post = PhamePost::initializePost($viewer, $blog);
$cancel_uri = $this->getApplicationURI('/blog/view/'.$blog->getID().'/');
$submit_button = pht('Save Draft');
$page_title = pht('Create Post');
$submit_button = pht('Create Post');
$page_title = pht('Create Post');
}
$title = $post->getTitle();
$phame_title = $post->getPhameTitle();
$body = $post->getBody();
$comments_widget = $post->getCommentsWidget();
$title = $post->getTitle();
$phame_title = $post->getPhameTitle();
$body = $post->getBody();
$visibility = $post->getVisibility();
$e_title = true;
$e_phame_title = true;
$validation_exception = null;
if ($request->isFormPost()) {
$title = $request->getStr('title');
$phame_title = $request->getStr('phame_title');
$phame_title = PhabricatorSlug::normalize($phame_title);
$body = $request->getStr('body');
$comments_widget = $request->getStr('comments_widget');
$v_projects = $request->getArr('projects');
$title = $request->getStr('title');
$phame_title = $request->getStr('phame_title');
$phame_title = PhabricatorSlug::normalize($phame_title);
$body = $request->getStr('body');
$v_projects = $request->getArr('projects');
$v_cc = $request->getArr('cc');
$visibility = $request->getInt('visibility');
$xactions = array(
id(new PhamePostTransaction())
@ -76,8 +80,12 @@ final class PhamePostEditController extends PhamePostController {
->setTransactionType(PhamePostTransaction::TYPE_BODY)
->setNewValue($body),
id(new PhamePostTransaction())
->setTransactionType(PhamePostTransaction::TYPE_COMMENTS_WIDGET)
->setNewValue($comments_widget),
->setTransactionType(PhamePostTransaction::TYPE_VISIBILITY)
->setNewValue($visibility),
id(new PhamePostTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
->setNewValue(array('=' => $v_cc)),
);
$proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
@ -134,6 +142,12 @@ final class PhamePostEditController extends PhamePostController {
'with underscores for spaces. '.
'Formatting is enforced.'))
->setError($e_phame_title))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Visibility'))
->setName('visibility')
->setvalue($visibility)
->setOptions(PhameConstants::getPhamePostStatusMap()))
->appendChild(
id(new PhabricatorRemarkupControl())
->setLabel(pht('Body'))
@ -143,18 +157,19 @@ final class PhamePostEditController extends PhamePostController {
->setID('post-body')
->setUser($viewer)
->setDisableMacros(true))
->appendControl(
id(new AphrontFormTokenizerControl())
->setLabel(pht('Subscribers'))
->setName('cc')
->setValue($v_cc)
->setUser($viewer)
->setDatasource(new PhabricatorMetaMTAMailableDatasource()))
->appendControl(
id(new AphrontFormTokenizerControl())
->setLabel(pht('Projects'))
->setName('projects')
->setValue($v_projects)
->setDatasource(new PhabricatorProjectDatasource()))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Comments Widget'))
->setName('comments_widget')
->setvalue($comments_widget)
->setOptions($post->getCommentsWidgetOptionsForSelect()))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton($cancel_uri)

View file

@ -30,7 +30,7 @@ final class PhamePostNewController extends PhamePostController {
->withIDs(array($request->getInt('blog')))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_JOIN,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
@ -52,7 +52,7 @@ final class PhamePostNewController extends PhamePostController {
->setViewer($viewer)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_JOIN,
PhabricatorPolicyCapability::CAN_EDIT,
))
->execute();
@ -65,7 +65,7 @@ final class PhamePostNewController extends PhamePostController {
$notification = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NODATA)
->appendChild(
pht('You do not have permission to join any blogs. Create a blog '.
pht('You do not have permission to post to any blogs. Create a blog '.
'first, then you can post to it.'));
} else {

View file

@ -21,9 +21,17 @@ final class PhamePostPublishController extends PhamePostController {
$view_uri = $this->getApplicationURI('/post/view/'.$post->getID().'/');
if ($request->isFormPost()) {
$post->setVisibility(PhamePost::VISIBILITY_PUBLISHED);
$post->setDatePublished(time());
$post->save();
$xactions = array();
$xactions[] = id(new PhamePostTransaction())
->setTransactionType(PhamePostTransaction::TYPE_VISIBILITY)
->setNewValue(PhameConstants::VISIBILITY_PUBLISHED);
id(new PhamePostEditor())
->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
->applyTransactions($post, $xactions);
return id(new AphrontRedirectResponse())->setURI($view_uri);
}

View file

@ -19,9 +19,17 @@ final class PhamePostUnpublishController extends PhamePostController {
}
if ($request->isFormPost()) {
$post->setVisibility(PhamePost::VISIBILITY_DRAFT);
$post->setDatePublished(0);
$post->save();
$xactions = array();
$xactions[] = id(new PhamePostTransaction())
->setTransactionType(PhamePostTransaction::TYPE_VISIBILITY)
->setNewValue(PhameConstants::VISIBILITY_DRAFT);
id(new PhamePostEditor())
->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
->applyTransactions($post, $xactions);
return id(new AphrontRedirectResponse())
->setURI($this->getApplicationURI('/post/view/'.$post->getID().'/'));

View file

@ -14,7 +14,18 @@ final class PhamePostViewController extends PhamePostController {
return new Aphront404Response();
}
$blog = $post->getBlog();
$crumbs = $this->buildApplicationCrumbs();
if ($blog) {
$crumbs->addTextCrumb(
$blog->getName(),
$this->getApplicationURI('blog/view/'.$blog->getID().'/'));
} else {
$crumbs->addTextCrumb(
pht('[No Blog]'),
null);
}
$crumbs->addTextCrumb(
$post->getTitle(),
$this->getApplicationURI('post/view/'.$post->getID().'/'));
@ -76,13 +87,24 @@ final class PhamePostViewController extends PhamePostController {
),
$engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY)));
$timeline = $this->buildTransactionTimeline(
$post,
id(new PhamePostTransactionQuery())
->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT)));
$timeline = phutil_tag_div('phui-document-view-pro-box', $timeline);
$add_comment = $this->buildCommentForm($post);
return $this->newPage()
->setTitle($post->getTitle())
->addClass('pro-white-background')
->setPageObjectPHIDs(array($post->getPHID()))
->setCrumbs($crumbs)
->appendChild(
array(
$document,
$timeline,
$add_comment,
));
}
@ -123,6 +145,7 @@ final class PhamePostViewController extends PhamePostController {
id(new PhabricatorActionView())
->setIcon('fa-eye')
->setHref($this->getApplicationURI('post/publish/'.$id.'/'))
->setDisabled(!$can_edit)
->setName(pht('Preview / Publish')));
} else {
$actions->addAction(
@ -130,6 +153,7 @@ final class PhamePostViewController extends PhamePostController {
->setIcon('fa-eye-slash')
->setHref($this->getApplicationURI('post/unpublish/'.$id.'/'))
->setName(pht('Unpublish'))
->setDisabled(!$can_edit)
->setWorkflow(true));
}
@ -190,4 +214,27 @@ final class PhamePostViewController extends PhamePostController {
return $properties;
}
private function buildCommentForm(PhamePost $post) {
$viewer = $this->getViewer();
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$add_comment_header = $is_serious
? pht('Add Comment')
: pht('Derp Text');
$draft = PhabricatorDraft::newFromUserAndKey(
$viewer, $post->getPHID());
$box = id(new PhabricatorApplicationTransactionCommentView())
->setUser($viewer)
->setObjectPHID($post->getPHID())
->setDraft($draft)
->setHeaderText($add_comment_header)
->setAction($this->getApplicationURI('post/comment/'.$post->getID().'/'))
->setSubmitButtonName(pht('Add Comment'));
return phutil_tag_div('phui-document-view-pro-box', $box);
}
}

View file

@ -20,7 +20,6 @@ final class PhameBlogEditor
$types[] = PhameBlogTransaction::TYPE_SKIN;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
$types[] = PhabricatorTransactions::TYPE_JOIN_POLICY;
return $types;
}
@ -94,6 +93,7 @@ final class PhameBlogEditor
$errors = parent::validateTransaction($object, $type, $xactions);
switch ($type) {
case PhameBlogTransaction::TYPE_NAME:
$missing = $this->validateIsEmptyTextField(
@ -112,6 +112,9 @@ final class PhameBlogEditor
}
break;
case PhameBlogTransaction::TYPE_DOMAIN:
if (!$xactions) {
continue;
}
$custom_domain = last($xactions)->getNewValue();
if (empty($custom_domain)) {
continue;
@ -158,15 +161,66 @@ final class PhameBlogEditor
protected function shouldSendMail(
PhabricatorLiskDAO $object,
array $xactions) {
return false;
return true;
}
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return false;
return true;
}
protected function getMailTo(PhabricatorLiskDAO $object) {
$phids = array();
$phids[] = $this->requireActor()->getPHID();
$phids[] = $object->getCreatorPHID();
return $phids;
}
protected function buildMailTemplate(PhabricatorLiskDAO $object) {
$phid = $object->getPHID();
$name = $object->getName();
return id(new PhabricatorMetaMTAMail())
->setSubject($name)
->addHeader('Thread-Topic', $phid);
}
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
return id(new PhameBlogReplyHandler())
->setMailReceiver($object);
}
protected function buildMailBody(
PhabricatorLiskDAO $object,
array $xactions) {
$body = parent::buildMailBody($object, $xactions);
$body->addLinkSection(
pht('BLOG DETAIL'),
PhabricatorEnv::getProductionURI($object->getViewURI()));
return $body;
}
public function getMailTagsMap() {
return array(
PhameBlogTransaction::MAILTAG_DETAILS =>
pht("A blog's details change."),
PhameBlogTransaction::MAILTAG_SUBSCRIBERS =>
pht("A blog's subscribers change."),
PhameBlogTransaction::MAILTAG_OTHER =>
pht('Other blog activity not listed above occurs.'),
);
}
protected function getMailSubjectPrefix() {
return '[Phame]';
}
protected function supportsSearch() {
return false;
}

View file

@ -17,7 +17,8 @@ final class PhamePostEditor
$types[] = PhamePostTransaction::TYPE_TITLE;
$types[] = PhamePostTransaction::TYPE_PHAME_TITLE;
$types[] = PhamePostTransaction::TYPE_BODY;
$types[] = PhamePostTransaction::TYPE_COMMENTS_WIDGET;
$types[] = PhamePostTransaction::TYPE_VISIBILITY;
$types[] = PhabricatorTransactions::TYPE_COMMENT;
return $types;
}
@ -33,8 +34,8 @@ final class PhamePostEditor
return $object->getPhameTitle();
case PhamePostTransaction::TYPE_BODY:
return $object->getBody();
case PhamePostTransaction::TYPE_COMMENTS_WIDGET:
return $object->getCommentsWidget();
case PhamePostTransaction::TYPE_VISIBILITY:
return $object->getVisibility();
}
}
@ -46,7 +47,7 @@ final class PhamePostEditor
case PhamePostTransaction::TYPE_TITLE:
case PhamePostTransaction::TYPE_PHAME_TITLE:
case PhamePostTransaction::TYPE_BODY:
case PhamePostTransaction::TYPE_COMMENTS_WIDGET:
case PhamePostTransaction::TYPE_VISIBILITY:
return $xaction->getNewValue();
}
}
@ -62,8 +63,13 @@ final class PhamePostEditor
return $object->setPhameTitle($xaction->getNewValue());
case PhamePostTransaction::TYPE_BODY:
return $object->setBody($xaction->getNewValue());
case PhamePostTransaction::TYPE_COMMENTS_WIDGET:
return $object->setCommentsWidget($xaction->getNewValue());
case PhamePostTransaction::TYPE_VISIBILITY:
if ($xaction->getNewValue() == PhameConstants::VISIBILITY_DRAFT) {
$object->setDatePublished(0);
} else {
$object->setDatePublished(time());
}
return $object->setVisibility($xaction->getNewValue());
}
return parent::applyCustomInternalTransaction($object, $xaction);
@ -77,7 +83,7 @@ final class PhamePostEditor
case PhamePostTransaction::TYPE_TITLE:
case PhamePostTransaction::TYPE_PHAME_TITLE:
case PhamePostTransaction::TYPE_BODY:
case PhamePostTransaction::TYPE_COMMENTS_WIDGET:
case PhamePostTransaction::TYPE_VISIBILITY:
return;
}
@ -109,6 +115,9 @@ final class PhamePostEditor
}
break;
case PhamePostTransaction::TYPE_PHAME_TITLE:
if (!$xactions) {
continue;
}
$missing = $this->validateIsEmptyTextField(
$object->getPhameTitle(),
$xactions);
@ -171,8 +180,11 @@ final class PhamePostEditor
$blog_phid = $object->getBlogPHID();
if ($blog_phid) {
$phids[] = PhabricatorSubscribersQuery::loadSubscribersForPHID(
$cc_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
$blog_phid);
foreach ($cc_phids as $cc) {
$phids[] = $cc;
}
}
return $phids;
}
@ -197,6 +209,10 @@ final class PhamePostEditor
$body = parent::buildMailBody($object, $xactions);
if ($this->getIsNewObject()) {
$body->addRemarkupSection(null, $object->getBody());
}
$body->addLinkSection(
pht('POST DETAIL'),
PhabricatorEnv::getProductionURI($object->getViewURI()));

View file

@ -0,0 +1,21 @@
<?php
final class PhameBlogReplyHandler
extends PhabricatorApplicationTransactionReplyHandler {
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PhameBlog)) {
throw new Exception(
pht('Mail receiver is not a %s.', 'PhameBlog'));
}
}
public function getObjectPrefix() {
return PhabricatorPhameBlogPHIDType::TYPECONST;
}
protected function shouldCreateCommentFromMailBody() {
return false;
}
}

View file

@ -0,0 +1,28 @@
<?php
final class PhamePostMailReceiver
extends PhabricatorObjectMailReceiver {
public function isEnabled() {
return PhabricatorApplication::isClassInstalled(
'PhabricatorPhameApplication');
}
protected function getObjectPattern() {
return 'POST[1-9]\d*';
}
protected function loadObject($pattern, PhabricatorUser $viewer) {
$id = (int)substr($pattern, 4);
return id(new PhamePostQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
}
protected function getTransactionReplyHandler() {
return new PhamePostReplyHandler();
}
}

View file

@ -14,8 +14,4 @@ final class PhamePostReplyHandler
return PhabricatorPhamePostPHIDType::TYPECONST;
}
protected function shouldCreateCommentFromMailBody() {
return false;
}
}

View file

@ -0,0 +1,10 @@
<?php
final class PhameBlogTransactionQuery
extends PhabricatorApplicationTransactionQuery {
public function getTemplateApplicationTransaction() {
return new PhameBlogTransaction();
}
}

View file

@ -32,8 +32,8 @@ final class PhamePostSearchEngine
->setLabel(pht('Visibility'))
->setOptions(array(
'' => pht('All'),
PhamePost::VISIBILITY_PUBLISHED => pht('Live'),
PhamePost::VISIBILITY_DRAFT => pht('Draft'),
PhameConstants::VISIBILITY_PUBLISHED => pht('Published'),
PhameConstants::VISIBILITY_DRAFT => pht('Draft'),
)),
);
}
@ -45,7 +45,7 @@ final class PhamePostSearchEngine
protected function getBuiltinQueryNames() {
$names = array(
'all' => pht('All Posts'),
'live' => pht('Live Posts'),
'live' => pht('Published Posts'),
'draft' => pht('Draft Posts'),
);
return $names;
@ -60,10 +60,10 @@ final class PhamePostSearchEngine
return $query;
case 'live':
return $query->setParameter(
'visibility', PhamePost::VISIBILITY_PUBLISHED);
'visibility', PhameConstants::VISIBILITY_PUBLISHED);
case 'draft':
return $query->setParameter(
'visibility', PhamePost::VISIBILITY_DRAFT);
'visibility', PhameConstants::VISIBILITY_DRAFT);
}
return parent::buildSavedQueryFromBuiltin($query_key);
@ -81,15 +81,20 @@ final class PhamePostSearchEngine
foreach ($posts as $post) {
$id = $post->getID();
$blog = $viewer->renderHandle($post->getBlogPHID())->render();
$blog = $post->getBlog();
if ($blog) {
$blog_name = $viewer->renderHandle($post->getBlogPHID())->render();
$blog_name = pht('Blog: %s', $blog_name);
} else {
$blog_name = pht('[No Blog]');
}
$item = id(new PHUIObjectItemView())
->setUser($viewer)
->setObject($post)
->setHeader($post->getTitle())
->setStatusIcon('fa-star')
->setHref($this->getApplicationURI("/post/view/{$id}/"))
->addAttribute(
pht('Blog: %s', $blog));
->addAttribute($blog_name);
if ($post->isDraft()) {
$item->setStatusIcon('fa-star-o grey');
$item->setDisabled(true);

View file

@ -20,7 +20,7 @@ final class PhameBlog extends PhameDAO
protected $creatorPHID;
protected $viewPolicy;
protected $editPolicy;
protected $joinPolicy;
protected $mailKey;
private static $requestBlog;
@ -34,10 +34,10 @@ final class PhameBlog extends PhameDAO
'name' => 'text64',
'description' => 'text',
'domain' => 'text128?',
'mailKey' => 'bytes20',
// T6203/NULLABILITY
// These policies should always be non-null.
'joinPolicy' => 'policy?',
'editPolicy' => 'policy?',
'viewPolicy' => 'policy?',
),
@ -55,6 +55,13 @@ final class PhameBlog extends PhameDAO
) + parent::getConfiguration();
}
public function save() {
if (!$this->getMailKey()) {
$this->setMailKey(Filesystem::readRandomCharacters(20));
}
return parent::save();
}
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPhameBlogPHIDType::TYPECONST);
@ -64,8 +71,7 @@ final class PhameBlog extends PhameDAO
$blog = id(new PhameBlog())
->setCreatorPHID($actor->getPHID())
->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy())
->setEditPolicy(PhabricatorPolicies::POLICY_USER)
->setJoinPolicy(PhabricatorPolicies::POLICY_USER);
->setEditPolicy(PhabricatorPolicies::POLICY_USER);
return $blog;
}
@ -214,6 +220,11 @@ final class PhameBlog extends PhameDAO
return $base;
}
public function getViewURI() {
$uri = '/phame/blog/view/'.$this->getID().'/';
return PhabricatorEnv::getProductionURI($uri);
}
/* -( PhabricatorPolicyInterface Implementation )-------------------------- */
@ -222,7 +233,6 @@ final class PhameBlog extends PhameDAO
return array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
PhabricatorPolicyCapability::CAN_JOIN,
);
}
@ -233,14 +243,11 @@ final class PhameBlog extends PhameDAO
return $this->getViewPolicy();
case PhabricatorPolicyCapability::CAN_EDIT:
return $this->getEditPolicy();
case PhabricatorPolicyCapability::CAN_JOIN:
return $this->getJoinPolicy();
}
}
public function hasAutomaticCapability($capability, PhabricatorUser $user) {
$can_edit = PhabricatorPolicyCapability::CAN_EDIT;
$can_join = PhabricatorPolicyCapability::CAN_JOIN;
switch ($capability) {
case PhabricatorPolicyCapability::CAN_VIEW:
@ -248,15 +255,6 @@ final class PhameBlog extends PhameDAO
if (PhabricatorPolicyFilter::hasCapability($user, $this, $can_edit)) {
return true;
}
if (PhabricatorPolicyFilter::hasCapability($user, $this, $can_join)) {
return true;
}
break;
case PhabricatorPolicyCapability::CAN_JOIN:
// Users who can edit a blog can always post to it.
if (PhabricatorPolicyFilter::hasCapability($user, $this, $can_edit)) {
return true;
}
break;
}
@ -268,10 +266,7 @@ final class PhameBlog extends PhameDAO
switch ($capability) {
case PhabricatorPolicyCapability::CAN_VIEW:
return pht(
'Users who can edit or post on a blog can always view it.');
case PhabricatorPolicyCapability::CAN_JOIN:
return pht(
'Users who can edit a blog can always post on it.');
'Users who can edit a blog can always view it.');
}
return null;

View file

@ -8,6 +8,10 @@ final class PhameBlogTransaction
const TYPE_DOMAIN = 'phame.blog.domain';
const TYPE_SKIN = 'phame.blog.skin';
const MAILTAG_DETAILS = 'phame-blog-details';
const MAILTAG_SUBSCRIBERS = 'phame-blog-subscribers';
const MAILTAG_OTHER = 'phame-blog-other';
public function getApplicationName() {
return 'phame';
}
@ -44,6 +48,26 @@ final class PhameBlogTransaction
return parent::getIcon();
}
public function getMailTags() {
$tags = parent::getMailTags();
switch ($this->getTransactionType()) {
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
$tags[] = self::MAILTAG_SUBSCRIBERS;
break;
case self::TYPE_NAME:
case self::TYPE_DESCRIPTION:
case self::TYPE_DOMAIN:
case self::TYPE_SKIN:
$tags[] = self::MAILTAG_DETAILS;
break;
default:
$tags[] = self::MAILTAG_OTHER;
break;
}
return $tags;
}
public function getTitle() {
$author_phid = $this->getAuthorPHID();
$object_phid = $this->getObjectPHID();
@ -53,7 +77,7 @@ final class PhameBlogTransaction
$type = $this->getTransactionType();
switch ($type) {
case self:TYPE_NAME:
case self::TYPE_NAME:
if ($old === null) {
return pht(
'%s created this blog.',

View file

@ -13,9 +13,6 @@ final class PhamePost extends PhameDAO
const MARKUP_FIELD_BODY = 'markup:body';
const MARKUP_FIELD_SUMMARY = 'markup:summary';
const VISIBILITY_DRAFT = 0;
const VISIBILITY_PUBLISHED = 1;
protected $bloggerPHID;
protected $title;
protected $phameTitle;
@ -37,7 +34,7 @@ final class PhamePost extends PhameDAO
->setBlogPHID($blog->getPHID())
->setBlog($blog)
->setDatePublished(0)
->setVisibility(self::VISIBILITY_DRAFT);
->setVisibility(PhameConstants::VISIBILITY_PUBLISHED);
return $post;
}
@ -66,7 +63,7 @@ final class PhamePost extends PhameDAO
}
public function isDraft() {
return $this->getVisibility() == self::VISIBILITY_DRAFT;
return $this->getVisibility() == PhameConstants::VISIBILITY_DRAFT;
}
public function getHumanName() {
@ -79,20 +76,6 @@ final class PhamePost extends PhameDAO
return $name;
}
public function setCommentsWidget($widget) {
$config_data = $this->getConfigData();
$config_data['comments_widget'] = $widget;
return $this;
}
public function getCommentsWidget() {
$config_data = $this->getConfigData();
if (empty($config_data)) {
return 'none';
}
return idx($config_data, 'comments_widget', 'none');
}
protected function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
@ -165,31 +148,6 @@ final class PhamePost extends PhameDAO
);
}
public static function getVisibilityOptionsForSelect() {
return array(
self::VISIBILITY_DRAFT => pht('Draft: visible only to me.'),
self::VISIBILITY_PUBLISHED => pht(
'Published: visible to the whole world.'),
);
}
public function getCommentsWidgetOptionsForSelect() {
$current = $this->getCommentsWidget();
$options = array();
if ($current == 'facebook' ||
PhabricatorFacebookAuthProvider::getFacebookApplicationID()) {
$options['facebook'] = pht('Facebook');
}
if ($current == 'disqus' ||
PhabricatorEnv::getEnvConfig('disqus.shortname')) {
$options['disqus'] = pht('Disqus');
}
$options['none'] = pht('None');
return $options;
}
/* -( PhabricatorPolicyInterface Implementation )-------------------------- */
@ -209,18 +167,23 @@ final class PhamePost extends PhameDAO
case PhabricatorPolicyCapability::CAN_VIEW:
if (!$this->isDraft() && $this->getBlog()) {
return $this->getBlog()->getViewPolicy();
} else if ($this->getBlog()) {
return $this->getBlog()->getEditPolicy();
} else {
return PhabricatorPolicies::POLICY_NOONE;
}
break;
case PhabricatorPolicyCapability::CAN_EDIT:
return PhabricatorPolicies::POLICY_NOONE;
if ($this->getBlog()) {
return $this->getBlog()->getEditPolicy();
} else {
return PhabricatorPolicies::POLICY_NOONE;
}
}
}
public function hasAutomaticCapability($capability, PhabricatorUser $user) {
// A blog post's author can always view it, and is the only user allowed
// to edit it.
// A blog post's author can always view it.
switch ($capability) {
case PhabricatorPolicyCapability::CAN_VIEW:

View file

@ -6,7 +6,7 @@ final class PhamePostTransaction
const TYPE_TITLE = 'phame.post.title';
const TYPE_PHAME_TITLE = 'phame.post.phame.title';
const TYPE_BODY = 'phame.post.body';
const TYPE_COMMENTS_WIDGET = 'phame.post.comments.widget';
const TYPE_VISIBILITY = 'phame.post.visibility';
const MAILTAG_CONTENT = 'phame-post-content';
const MAILTAG_COMMENT = 'phame-post-comment';
@ -20,6 +20,10 @@ final class PhamePostTransaction
return PhabricatorPhamePostPHIDType::TYPECONST;
}
public function getApplicationTransactionCommentObject() {
return new PhamePostTransactionComment();
}
public function getRemarkupBlocks() {
$blocks = parent::getRemarkupBlocks();
@ -54,7 +58,7 @@ final class PhamePostTransaction
break;
case self::TYPE_PHAME_TITLE:
case self::TYPE_BODY:
case self::TYPE_COMMENTS_WIDGET:
case self::TYPE_VISIBILITY:
return 'fa-pencil';
break;
}
@ -65,7 +69,6 @@ final class PhamePostTransaction
$tags = parent::getMailTags();
switch ($this->getTransactionType()) {
case self::TYPE_COMMENTS_WIDGET:
case PhabricatorTransactions::TYPE_COMMENT:
$tags[] = self::MAILTAG_COMMENT;
break;
@ -108,18 +111,23 @@ final class PhamePostTransaction
'%s updated the blog post.',
$this->renderHandleLink($author_phid));
break;
case self::TYPE_VISIBILITY:
if ($new == PhameConstants::VISIBILITY_DRAFT) {
return pht(
'%s marked this post as a draft.',
$this->renderHandleLink($author_phid));
} else {
return pht(
'%s published this post.',
$this->renderHandleLink($author_phid));
}
break;
case self::TYPE_PHAME_TITLE:
return pht(
'%s updated the post\'s Phame title to "%s".',
$this->renderHandleLink($author_phid),
rtrim($new, '/'));
break;
case self::TYPE_COMMENTS_WIDGET:
return pht(
'%s updated the post\'s comment widget to "%s".',
$this->renderHandleLink($author_phid),
$new);
break;
}
return parent::getTitle();
@ -153,37 +161,57 @@ final class PhamePostTransaction
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
case self::TYPE_VISIBILITY:
if ($new == PhameConstants::VISIBILITY_DRAFT) {
return pht(
'%s marked %s as a draft.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
} else {
return pht(
'%s published %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
}
break;
case self::TYPE_PHAME_TITLE:
return pht(
'%s updated the Phame title for %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
case self::TYPE_COMMENTS_WIDGET:
return pht(
'%s updated the comments widget for %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
}
return parent::getTitleForFeed();
}
public function getBodyForFeed(PhabricatorFeedStory $story) {
$new = $this->getNewValue();
$body = null;
$text = null;
switch ($this->getTransactionType()) {
case self::TYPE_TITLE:
if ($this->getOldValue() === null) {
$post = $story->getPrimaryObject();
$text = $post->getBody();
}
break;
case self::TYPE_VISIBILITY:
if ($this->getNewValue() == PhameConstants::VISIBILITY_PUBLISHED) {
$post = $story->getPrimaryObject();
$text = $post->getBody();
}
break;
case self::TYPE_BODY:
return phutil_escape_html_newlines(
id(new PhutilUTF8StringTruncator())
->setMaximumGlyphs(128)
->truncateString($new));
$text = $this->getNewValue();
break;
}
if (strlen($text)) {
return phutil_escape_html_newlines(
id(new PhutilUTF8StringTruncator())
->setMaximumGlyphs(128)
->truncateString($text));
}
return parent::getBodyForFeed($story);
}
@ -201,7 +229,6 @@ final class PhamePostTransaction
return parent::getColor();
}
public function hasChangeDetails() {
switch ($this->getTransactionType()) {
case self::TYPE_BODY:

View file

@ -0,0 +1,10 @@
<?php
final class PhamePostTransactionComment
extends PhabricatorApplicationTransactionComment {
public function getApplicationTransactionObject() {
return new PhamePostTransaction();
}
}

View file

@ -101,24 +101,6 @@ final class PhamePostView extends AphrontView {
$this->getSummary());
}
public function renderComments() {
$post = $this->getPost();
switch ($post->getCommentsWidget()) {
case 'facebook':
$comments = $this->renderFacebookComments();
break;
case 'disqus':
$comments = $this->renderDisqusComments();
break;
case 'none':
default:
$comments = null;
break;
}
return $comments;
}
public function render() {
return phutil_tag(
'div',
@ -129,7 +111,6 @@ final class PhamePostView extends AphrontView {
$this->renderTitle(),
$this->renderDatePublished(),
$this->renderBody(),
$this->renderComments(),
));
}
@ -146,96 +127,4 @@ final class PhamePostView extends AphrontView {
));
}
private function renderFacebookComments() {
$fb_id = PhabricatorFacebookAuthProvider::getFacebookApplicationID();
if (!$fb_id) {
return null;
}
$fb_root = phutil_tag('div',
array(
'id' => 'fb-root',
),
'');
$c_uri = '//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$fb_id;
$fb_js = CelerityStaticResourceResponse::renderInlineScript(
jsprintf(
'(function(d, s, id) {'.
' var js, fjs = d.getElementsByTagName(s)[0];'.
' if (d.getElementById(id)) return;'.
' js = d.createElement(s); js.id = id;'.
' js.src = %s;'.
' fjs.parentNode.insertBefore(js, fjs);'.
'}(document, \'script\', \'facebook-jssdk\'));',
$c_uri));
$uri = $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle());
require_celerity_resource('phame-css');
$fb_comments = phutil_tag('div',
array(
'class' => 'fb-comments',
'data-href' => $uri,
'data-num-posts' => 5,
),
'');
return phutil_tag(
'div',
array(
'class' => 'phame-comments-facebook',
),
array(
$fb_root,
$fb_js,
$fb_comments,
));
}
private function renderDisqusComments() {
$disqus_shortname = PhabricatorEnv::getEnvConfig('disqus.shortname');
if (!$disqus_shortname) {
return null;
}
$post = $this->getPost();
$disqus_thread = phutil_tag('div',
array(
'id' => 'disqus_thread',
));
// protip - try some var disqus_developer = 1; action to test locally
$disqus_js = CelerityStaticResourceResponse::renderInlineScript(
jsprintf(
' var disqus_shortname = %s;'.
' var disqus_identifier = %s;'.
' var disqus_url = %s;'.
' var disqus_title = %s;'.
'(function() {'.
' var dsq = document.createElement("script");'.
' dsq.type = "text/javascript";'.
' dsq.async = true;'.
' dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";'.
'(document.getElementsByTagName("head")[0] ||'.
' document.getElementsByTagName("body")[0]).appendChild(dsq);'.
'})();',
$disqus_shortname,
$post->getPHID(),
$this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()),
$post->getTitle()));
return phutil_tag(
'div',
array(
'class' => 'phame-comments-disqus',
),
array(
$disqus_thread,
$disqus_js,
));
}
}

View file

@ -120,19 +120,31 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
$images = $this->getNewImages();
$images = mpull($images, null, 'getPHID');
switch ($xaction->getTransactionType()) {
case PholioTransaction::TYPE_IMAGE_FILE:
$new = $xaction->getNewValue();
$phids = array();
foreach ($new as $key => $images) {
$phids[] = mpull($images, 'getFilePHID');
$file_phids = array();
foreach ($xaction->getNewValue() as $image_phid) {
$image = idx($images, $image_phid);
if (!$image) {
continue;
}
$file_phids[] = $image->getFilePHID();
}
return array_mergev($phids);
return $file_phids;
case PholioTransaction::TYPE_IMAGE_REPLACE:
return array($xaction->getNewValue()->getFilePHID());
$image_phid = $xaction->getNewValue();
$image = idx($images, $image_phid);
if ($image) {
return array($image->getFilePHID());
}
break;
}
return array();
return parent::extractFilePHIDsFromCustomTransaction($object, $xaction);
}

View file

@ -145,7 +145,7 @@ final class PhortuneCartEditor
"%s",
$issues);
$body->addRemarkupSection($overview);
$body->addRemarkupSection(null, $overview);
$body->addLinkSection(
pht('PAY NOW'),

View file

@ -1,12 +0,0 @@
<?php
final class PhortuneNotImplementedException extends Exception {
public function __construct(PhortunePaymentProvider $provider) {
return parent::__construct(
pht(
"Provider '%s' does not implement this method.",
get_class($provider)));
}
}

View file

@ -109,7 +109,7 @@ abstract class PhortunePaymentProvider extends Phobject {
abstract public function canRunConfigurationTest();
public function runConfigurationTest() {
throw new PhortuneNotImplementedException($this);
throw new PhutilMethodNotImplementedException();
}
@ -169,7 +169,7 @@ abstract class PhortunePaymentProvider extends Phobject {
* @task addmethod
*/
public function translateCreatePaymentMethodErrorCode($error_code) {
throw new PhortuneNotImplementedException($this);
throw new PhutilMethodNotImplementedException();
}
@ -177,7 +177,7 @@ abstract class PhortunePaymentProvider extends Phobject {
* @task addmethod
*/
public function getCreatePaymentMethodErrorMessage($error_code) {
throw new PhortuneNotImplementedException($this);
throw new PhutilMethodNotImplementedException();
}
@ -185,7 +185,7 @@ abstract class PhortunePaymentProvider extends Phobject {
* @task addmethod
*/
public function validateCreatePaymentMethodToken(array $token) {
throw new PhortuneNotImplementedException($this);
throw new PhutilMethodNotImplementedException();
}
@ -196,7 +196,7 @@ abstract class PhortunePaymentProvider extends Phobject {
AphrontRequest $request,
PhortunePaymentMethod $method,
array $token) {
throw new PhortuneNotImplementedException($this);
throw new PhutilMethodNotImplementedException();
}
@ -206,12 +206,12 @@ abstract class PhortunePaymentProvider extends Phobject {
public function renderCreatePaymentMethodForm(
AphrontRequest $request,
array $errors) {
throw new PhortuneNotImplementedException($this);
throw new PhutilMethodNotImplementedException();
}
public function getDefaultPaymentMethodDisplayName(
PhortunePaymentMethod $method) {
throw new PhortuneNotImplementedException($this);
throw new PhutilMethodNotImplementedException();
}
@ -290,7 +290,7 @@ abstract class PhortunePaymentProvider extends Phobject {
public function processControllerRequest(
PhortuneProviderActionController $controller,
AphrontRequest $request) {
throw new PhortuneNotImplementedException($this);
throw new PhutilMethodNotImplementedException();
}
}

View file

@ -3,7 +3,6 @@
abstract class PhabricatorXHPASTViewController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView();
$page->setApplicationName('XHPASTView');

View file

@ -14,7 +14,7 @@ final class PhabricatorXHPASTViewFrameController
phutil_tag(
'iframe',
array(
'src' => '/xhpast/frameset/'.$id.'/',
'src' => "/xhpast/frameset/{$id}/",
'frameborder' => '0',
'style' => 'width: 100%; height: 800px;',
'',

View file

@ -10,17 +10,15 @@ final class PhabricatorXHPASTViewFramesetController
public function handleRequest(AphrontRequest $request) {
$id = $request->getURIData('id');
$response = new AphrontWebpageResponse();
$response->setFrameable(true);
$response->setContent(phutil_tag(
'frameset',
array('cols' => '33%, 34%, 33%'),
array(
phutil_tag('frame', array('src' => "/xhpast/input/{$id}/")),
phutil_tag('frame', array('src' => "/xhpast/tree/{$id}/")),
phutil_tag('frame', array('src' => "/xhpast/stream/{$id}/")),
)));
return $response;
return id(new AphrontWebpageResponse())
->setFrameable(true)
->setContent(phutil_tag(
'frameset',
array('cols' => '33%, 34%, 33%'),
array(
phutil_tag('frame', array('src' => "/xhpast/input/{$id}/")),
phutil_tag('frame', array('src' => "/xhpast/tree/{$id}/")),
phutil_tag('frame', array('src' => "/xhpast/stream/{$id}/")),
)));
}
}

View file

@ -12,8 +12,9 @@ abstract class PhabricatorXHPASTViewPanelController
public function willProcessRequest(array $data) {
$this->id = $data['id'];
$this->storageTree = id(new PhabricatorXHPASTViewParseTree())
$this->storageTree = id(new PhabricatorXHPASTParseTree())
->load($this->id);
if (!$this->storageTree) {
throw new Exception(pht('No such AST!'));
}
@ -65,10 +66,9 @@ li span {
'</html>',
$content);
$response = new AphrontWebpageResponse();
$response->setFrameable(true);
$response->setContent($content);
return $response;
return id(new AphrontWebpageResponse())
->setFrameable(true)
->setContent($content);
}
}

View file

@ -13,17 +13,21 @@ final class PhabricatorXHPASTViewRunController
$resolved = $future->resolve();
// This is just to let it throw exceptions if stuff is broken.
$parse_tree = XHPASTTree::newFromDataAndResolvedExecFuture(
$source,
$resolved);
try {
XHPASTTree::newFromDataAndResolvedExecFuture($source, $resolved);
} catch (XHPASTSyntaxErrorException $ex) {
// This is possibly expected.
}
list($err, $stdout, $stderr) = $resolved;
$storage_tree = new PhabricatorXHPASTViewParseTree();
$storage_tree->setInput($source);
$storage_tree->setStdout($stdout);
$storage_tree->setAuthorPHID($viewer->getPHID());
$storage_tree->save();
$storage_tree = id(new PhabricatorXHPASTParseTree())
->setInput($source)
->setReturnCode($err)
->setStdout($stdout)
->setStderr($stderr)
->setAuthorPHID($viewer->getPHID())
->save();
return id(new AphrontRedirectResponse())
->setURI('/xhpast/view/'.$storage_tree->getID().'/');

View file

@ -6,11 +6,17 @@ final class PhabricatorXHPASTViewStreamController
public function handleRequest(AphrontRequest $request) {
$storage = $this->getStorageTree();
$input = $storage->getInput();
$err = $storage->getReturnCode();
$stdout = $storage->getStdout();
$stderr = $storage->getStderr();
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
$input,
array(0, $stdout, ''));
try {
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
$input,
array($err, $stdout, $stderr));
} catch (XHPASTSyntaxErrorException $ex) {
return $this->buildXHPASTViewPanelResponse($ex->getMessage());
}
$tokens = array();
foreach ($tree->getRawTokenStream() as $id => $token) {

View file

@ -10,18 +10,23 @@ final class PhabricatorXHPASTViewTreeController
public function handleRequest(AphrontRequest $request) {
$storage = $this->getStorageTree();
$input = $storage->getInput();
$err = $storage->getReturnCode();
$stdout = $storage->getStdout();
$stderr = $storage->getStderr();
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
$input,
array(0, $stdout, ''));
try {
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
$input,
array($err, $stdout, $stderr));
} catch (XHPASTSyntaxErrorException $ex) {
return $this->buildXHPASTViewPanelResponse($ex->getMessage());
}
$tree = phutil_tag('ul', array(), $this->buildTree($tree->getRootNode()));
return $this->buildXHPASTViewPanelResponse($tree);
}
protected function buildTree($root) {
try {
$name = $root->getTypeName();
$title = $root->getDescription();

View file

@ -0,0 +1,8 @@
<?php
abstract class PhabricatorXHPASTDAO extends PhabricatorLiskDAO {
public function getApplicationName() {
return 'xhpast';
}
}

View file

@ -1,18 +1,21 @@
<?php
final class PhabricatorXHPASTViewParseTree extends PhabricatorXHPASTViewDAO {
final class PhabricatorXHPASTParseTree extends PhabricatorXHPASTDAO {
protected $authorPHID;
protected $input;
protected $returnCode;
protected $stdout;
protected $stderr;
protected function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'authorPHID' => 'phid?',
'input' => 'text',
'returnCode' => 'sint32',
'stdout' => 'text',
'stderr' => 'text',
),
) + parent::getConfiguration();
}

Some files were not shown because too many files have changed in this diff Show more