1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Promote 2023.49 to stable

This commit is contained in:
Aviv Eyal 2023-12-08 18:17:57 +02:00
commit 43c969cd27
182 changed files with 1034 additions and 1438 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@
# Diviner # Diviner
/docs/ /docs/
/.divinercache/ /.divinercache/
/webroot/rsrc/externals/javelin/docs/.divinercache/
/src/.cache/ /src/.cache/
# libphutil # libphutil

View file

@ -8,7 +8,7 @@ be read by default.
To specify a path when starting Aphlict, use the `--config` flag: To specify a path when starting Aphlict, use the `--config` flag:
phabricator/ $ ./bin/aphlict start --config path/to/config.json phorge/ $ ./bin/aphlict start --config path/to/config.json
Specifying a configuration file explicitly overrides default configuration. Specifying a configuration file explicitly overrides default configuration.

View file

@ -7,12 +7,12 @@
*/ */
return array( return array(
'names' => array( 'names' => array(
'conpherence.pkg.css' => '76ed87e3', 'conpherence.pkg.css' => '2f25eb4f',
'conpherence.pkg.js' => '020aebcf', 'conpherence.pkg.js' => '020aebcf',
'core.pkg.css' => '1a5169fe', 'core.pkg.css' => 'c0bdb5b4',
'core.pkg.js' => '2eeda9e0', 'core.pkg.js' => '2eeda9e0',
'dark-console.pkg.js' => '187792c2', 'dark-console.pkg.js' => '187792c2',
'differential.pkg.css' => '525f9a1d', 'differential.pkg.css' => '2431def2',
'differential.pkg.js' => '46fcb3af', 'differential.pkg.js' => '46fcb3af',
'diffusion.pkg.css' => '42c75c37', 'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => '78c9885d', 'diffusion.pkg.js' => '78c9885d',
@ -38,21 +38,20 @@ return array(
'rsrc/css/aphront/typeahead.css' => '8779483d', 'rsrc/css/aphront/typeahead.css' => '8779483d',
'rsrc/css/application/almanac/almanac.css' => '2e050f4f', 'rsrc/css/application/almanac/almanac.css' => '2e050f4f',
'rsrc/css/application/auth/auth.css' => 'c2f23d74', 'rsrc/css/application/auth/auth.css' => 'c2f23d74',
'rsrc/css/application/base/main-menu-view.css' => '89fc16b6', 'rsrc/css/application/base/main-menu-view.css' => '5d673247',
'rsrc/css/application/base/notification-menu.css' => '4df1ee30', 'rsrc/css/application/base/notification-menu.css' => '4df1ee30',
'rsrc/css/application/base/phui-theme.css' => '35883b37', 'rsrc/css/application/base/phui-theme.css' => '35883b37',
'rsrc/css/application/base/standard-page-view.css' => 'e08c7462', 'rsrc/css/application/base/standard-page-view.css' => 'e08c7462',
'rsrc/css/application/chatlog/chatlog.css' => 'abdc76ee',
'rsrc/css/application/conduit/conduit-api.css' => 'ce2cfc41', 'rsrc/css/application/conduit/conduit-api.css' => 'ce2cfc41',
'rsrc/css/application/config/config-options.css' => '16c920ae', 'rsrc/css/application/config/config-options.css' => '16c920ae',
'rsrc/css/application/config/config-template.css' => 'e689dbbd', 'rsrc/css/application/config/config-template.css' => 'e689dbbd',
'rsrc/css/application/config/setup-issue.css' => '5eed85b2', 'rsrc/css/application/config/setup-issue.css' => '93231115',
'rsrc/css/application/config/unhandled-exception.css' => '9ecfc00d', 'rsrc/css/application/config/unhandled-exception.css' => '9ecfc00d',
'rsrc/css/application/conpherence/color.css' => 'b17746b0', 'rsrc/css/application/conpherence/color.css' => 'b17746b0',
'rsrc/css/application/conpherence/durable-column.css' => '2d57072b', 'rsrc/css/application/conpherence/durable-column.css' => '2d57072b',
'rsrc/css/application/conpherence/header-pane.css' => 'c9a3db8e', 'rsrc/css/application/conpherence/header-pane.css' => 'c9a3db8e',
'rsrc/css/application/conpherence/menu.css' => '67f4680d', 'rsrc/css/application/conpherence/menu.css' => '67f4680d',
'rsrc/css/application/conpherence/message-pane.css' => 'd244db1e', 'rsrc/css/application/conpherence/message-pane.css' => '50b1345e',
'rsrc/css/application/conpherence/notification.css' => '85c48def', 'rsrc/css/application/conpherence/notification.css' => '85c48def',
'rsrc/css/application/conpherence/participant-pane.css' => '69e0058a', 'rsrc/css/application/conpherence/participant-pane.css' => '69e0058a',
'rsrc/css/application/conpherence/transaction.css' => '3a3f5e7e', 'rsrc/css/application/conpherence/transaction.css' => '3a3f5e7e',
@ -63,7 +62,7 @@ return array(
'rsrc/css/application/diff/diff-tree-view.css' => 'e2d3e222', 'rsrc/css/application/diff/diff-tree-view.css' => 'e2d3e222',
'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d', 'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d',
'rsrc/css/application/differential/add-comment.css' => '7e5900d9', 'rsrc/css/application/differential/add-comment.css' => '7e5900d9',
'rsrc/css/application/differential/changeset-view.css' => '8b9caefe', 'rsrc/css/application/differential/changeset-view.css' => '360630ff',
'rsrc/css/application/differential/core.css' => '7300a73e', 'rsrc/css/application/differential/core.css' => '7300a73e',
'rsrc/css/application/differential/phui-inline-comment.css' => 'a864426f', 'rsrc/css/application/differential/phui-inline-comment.css' => 'a864426f',
'rsrc/css/application/differential/revision-comment.css' => '7dbc8d1d', 'rsrc/css/application/differential/revision-comment.css' => '7dbc8d1d',
@ -109,7 +108,7 @@ return array(
'rsrc/css/application/slowvote/slowvote.css' => '1694baed', 'rsrc/css/application/slowvote/slowvote.css' => '1694baed',
'rsrc/css/application/tokens/tokens.css' => 'ce5a50bd', 'rsrc/css/application/tokens/tokens.css' => 'ce5a50bd',
'rsrc/css/application/uiexample/example.css' => 'b4795059', 'rsrc/css/application/uiexample/example.css' => 'b4795059',
'rsrc/css/core/core.css' => 'a708bd25', 'rsrc/css/core/core.css' => 'b3a5928e',
'rsrc/css/core/remarkup.css' => '3480e1fe', 'rsrc/css/core/remarkup.css' => '3480e1fe',
'rsrc/css/core/syntax.css' => '548567f6', 'rsrc/css/core/syntax.css' => '548567f6',
'rsrc/css/core/z-index.css' => 'ac3bfcd4', 'rsrc/css/core/z-index.css' => 'ac3bfcd4',
@ -121,7 +120,7 @@ return array(
'rsrc/css/fuel/fuel-handle-list.css' => '2c4cbeca', 'rsrc/css/fuel/fuel-handle-list.css' => '2c4cbeca',
'rsrc/css/fuel/fuel-map.css' => 'd6e31510', 'rsrc/css/fuel/fuel-map.css' => 'd6e31510',
'rsrc/css/fuel/fuel-menu.css' => '21f5d199', 'rsrc/css/fuel/fuel-menu.css' => '21f5d199',
'rsrc/css/layout/phabricator-source-code-view.css' => '49656486', 'rsrc/css/layout/phabricator-source-code-view.css' => 'e382316a',
'rsrc/css/phui/button/phui-button-bar.css' => 'a4aa75c4', 'rsrc/css/phui/button/phui-button-bar.css' => 'a4aa75c4',
'rsrc/css/phui/button/phui-button-simple.css' => '1ff278aa', 'rsrc/css/phui/button/phui-button-simple.css' => '1ff278aa',
'rsrc/css/phui/button/phui-button.css' => 'f9d0f9c8', 'rsrc/css/phui/button/phui-button.css' => 'f9d0f9c8',
@ -160,7 +159,7 @@ return array(
'rsrc/css/phui/phui-head-thing.css' => 'd7f293df', 'rsrc/css/phui/phui-head-thing.css' => 'd7f293df',
'rsrc/css/phui/phui-header-view.css' => '36c86a58', 'rsrc/css/phui/phui-header-view.css' => '36c86a58',
'rsrc/css/phui/phui-hovercard.css' => '39fd2e14', 'rsrc/css/phui/phui-hovercard.css' => '39fd2e14',
'rsrc/css/phui/phui-icon-set-selector.css' => '7aa5f3ec', 'rsrc/css/phui/phui-icon-set-selector.css' => '19e0253b',
'rsrc/css/phui/phui-icon.css' => '084ac612', 'rsrc/css/phui/phui-icon.css' => '084ac612',
'rsrc/css/phui/phui-image-mask.css' => '62c7f4d2', 'rsrc/css/phui/phui-image-mask.css' => '62c7f4d2',
'rsrc/css/phui/phui-info-view.css' => 'a10a909b', 'rsrc/css/phui/phui-info-view.css' => 'a10a909b',
@ -553,14 +552,14 @@ return array(
'conpherence-durable-column-view' => '2d57072b', 'conpherence-durable-column-view' => '2d57072b',
'conpherence-header-pane-css' => 'c9a3db8e', 'conpherence-header-pane-css' => 'c9a3db8e',
'conpherence-menu-css' => '67f4680d', 'conpherence-menu-css' => '67f4680d',
'conpherence-message-pane-css' => 'd244db1e', 'conpherence-message-pane-css' => '50b1345e',
'conpherence-notification-css' => '85c48def', 'conpherence-notification-css' => '85c48def',
'conpherence-participant-pane-css' => '69e0058a', 'conpherence-participant-pane-css' => '69e0058a',
'conpherence-thread-manager' => 'aec8e38c', 'conpherence-thread-manager' => 'aec8e38c',
'conpherence-transaction-css' => '3a3f5e7e', 'conpherence-transaction-css' => '3a3f5e7e',
'd3' => '9d068042', 'd3' => '9d068042',
'diff-tree-view-css' => 'e2d3e222', 'diff-tree-view-css' => 'e2d3e222',
'differential-changeset-view-css' => '8b9caefe', 'differential-changeset-view-css' => '360630ff',
'differential-core-view-css' => '7300a73e', 'differential-core-view-css' => '7300a73e',
'differential-revision-add-comment-css' => '7e5900d9', 'differential-revision-add-comment-css' => '7e5900d9',
'differential-revision-comment-css' => '7dbc8d1d', 'differential-revision-comment-css' => '7dbc8d1d',
@ -770,9 +769,8 @@ return array(
'people-profile-css' => '2ea2daa1', 'people-profile-css' => '2ea2daa1',
'phabricator-action-list-view-css' => '1b0085b2', 'phabricator-action-list-view-css' => '1b0085b2',
'phabricator-busy' => '5202e831', 'phabricator-busy' => '5202e831',
'phabricator-chatlog-css' => 'abdc76ee',
'phabricator-content-source-view-css' => 'cdf0d579', 'phabricator-content-source-view-css' => 'cdf0d579',
'phabricator-core-css' => 'a708bd25', 'phabricator-core-css' => 'b3a5928e',
'phabricator-countdown-css' => 'bff8012f', 'phabricator-countdown-css' => 'bff8012f',
'phabricator-darklog' => '3b869402', 'phabricator-darklog' => '3b869402',
'phabricator-darkmessage' => '26cd4b73', 'phabricator-darkmessage' => '26cd4b73',
@ -792,7 +790,7 @@ return array(
'phabricator-flag-css' => '2b77be8d', 'phabricator-flag-css' => '2b77be8d',
'phabricator-keyboard-shortcut' => '1a844c06', 'phabricator-keyboard-shortcut' => '1a844c06',
'phabricator-keyboard-shortcut-manager' => '81debc48', 'phabricator-keyboard-shortcut-manager' => '81debc48',
'phabricator-main-menu-view' => '89fc16b6', 'phabricator-main-menu-view' => '5d673247',
'phabricator-nav-view-css' => '423f92cc', 'phabricator-nav-view-css' => '423f92cc',
'phabricator-notification' => 'a9b91e3f', 'phabricator-notification' => 'a9b91e3f',
'phabricator-notification-css' => '30240bd2', 'phabricator-notification-css' => '30240bd2',
@ -805,7 +803,7 @@ return array(
'phabricator-search-results-css' => '9ea70ace', 'phabricator-search-results-css' => '9ea70ace',
'phabricator-shaped-request' => '995f5102', 'phabricator-shaped-request' => '995f5102',
'phabricator-slowvote-css' => '1694baed', 'phabricator-slowvote-css' => '1694baed',
'phabricator-source-code-view-css' => '49656486', 'phabricator-source-code-view-css' => 'e382316a',
'phabricator-standard-page-view' => 'e08c7462', 'phabricator-standard-page-view' => 'e08c7462',
'phabricator-textareautils' => 'f340a484', 'phabricator-textareautils' => 'f340a484',
'phabricator-title' => '43bc9360', 'phabricator-title' => '43bc9360',
@ -856,7 +854,7 @@ return array(
'phui-hovercard' => '6199f752', 'phui-hovercard' => '6199f752',
'phui-hovercard-list' => 'de4b4919', 'phui-hovercard-list' => 'de4b4919',
'phui-hovercard-view-css' => '39fd2e14', 'phui-hovercard-view-css' => '39fd2e14',
'phui-icon-set-selector-css' => '7aa5f3ec', 'phui-icon-set-selector-css' => '19e0253b',
'phui-icon-view-css' => '084ac612', 'phui-icon-view-css' => '084ac612',
'phui-image-mask-css' => '62c7f4d2', 'phui-image-mask-css' => '62c7f4d2',
'phui-info-view-css' => 'a10a909b', 'phui-info-view-css' => 'a10a909b',
@ -905,7 +903,7 @@ return array(
'project-card-view-css' => 'c1200da7', 'project-card-view-css' => 'c1200da7',
'project-triggers-css' => 'cd9c8bb9', 'project-triggers-css' => 'cd9c8bb9',
'project-view-css' => '2f7caa20', 'project-view-css' => '2f7caa20',
'setup-issue-css' => '5eed85b2', 'setup-issue-css' => '93231115',
'sprite-login-css' => '07052ee0', 'sprite-login-css' => '07052ee0',
'sprite-tokens-css' => 'f1896dc5', 'sprite-tokens-css' => 'f1896dc5',
'syntax-default-css' => '055fc231', 'syntax-default-css' => '055fc231',
@ -1228,6 +1226,9 @@ return array(
'aphront-typeahead-control-css', 'aphront-typeahead-control-css',
'phui-tag-view-css', 'phui-tag-view-css',
), ),
'360630ff' => array(
'phui-inline-comment-view-css',
),
'3829a3cf' => array( '3829a3cf' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-uri', 'javelin-uri',
@ -1498,6 +1499,9 @@ return array(
'javelin-dom', 'javelin-dom',
'phuix-dropdown-menu', 'phuix-dropdown-menu',
), ),
'5d673247' => array(
'phui-theme-css',
),
'5d83623b' => array( '5d83623b' => array(
'javelin-dom', 'javelin-dom',
), ),
@ -1686,9 +1690,6 @@ return array(
'javelin-stratcom', 'javelin-stratcom',
'javelin-install', 'javelin-install',
), ),
'89fc16b6' => array(
'phui-theme-css',
),
'8ac32fd9' => array( '8ac32fd9' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-stratcom', 'javelin-stratcom',
@ -1702,9 +1703,6 @@ return array(
'javelin-dom', 'javelin-dom',
'phabricator-busy', 'phabricator-busy',
), ),
'8b9caefe' => array(
'phui-inline-comment-view-css',
),
'8badee71' => array( '8badee71' => array(
'javelin-install', 'javelin-install',
'javelin-util', 'javelin-util',

View file

@ -4,7 +4,6 @@ $applications = array(
'Audit', 'Audit',
'Auth', 'Auth',
'Calendar', 'Calendar',
'ChatLog',
'Conduit', 'Conduit',
'Config', 'Config',
'Conpherence', 'Conpherence',

View file

@ -0,0 +1,6 @@
<?php
// @phase worker
PhabricatorRebuildIndexesWorker::rebuildObjectsWithQuery(
'PhabricatorRepositoryQuery');

View file

@ -1,10 +1 @@
CREATE TABLE {$NAMESPACE}_chatlog.chatlog_event ( /* This file is intentionally left empty, see T15126 */
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
channel VARCHAR(64) BINARY NOT NULL,
epoch INT UNSIGNED NOT NULL,
author VARCHAR(64) BINARY NOT NULL,
type VARCHAR(4) NOT NULL,
message LONGBLOB NOT NULL,
loggedByPHID VARCHAR(64) BINARY NOT NULL,
KEY (channel, epoch)
);

View file

@ -16,24 +16,6 @@ ALTER TABLE `{$NAMESPACE}_audit`.`audit_comment`
ALTER DATABASE `{$NAMESPACE}_chatlog` COLLATE utf8_general_ci;
ALTER TABLE `{$NAMESPACE}_chatlog`.`chatlog_event`
MODIFY `channel` varchar(64) CHARACTER SET binary,
MODIFY `author` varchar(64) CHARACTER SET binary,
MODIFY `type` varchar(4) CHARACTER SET binary,
MODIFY `message` longtext CHARACTER SET binary,
MODIFY `loggedByPHID` varchar(64) CHARACTER SET binary;
ALTER TABLE `{$NAMESPACE}_chatlog`.`chatlog_event`
COLLATE utf8_general_ci,
MODIFY `channel` varchar(64) COLLATE utf8_bin NOT NULL,
MODIFY `author` varchar(64) COLLATE utf8_bin NOT NULL,
MODIFY `type` varchar(4) COLLATE utf8_general_ci NOT NULL,
MODIFY `message` longtext COLLATE utf8_bin NOT NULL,
MODIFY `loggedByPHID` varchar(64) COLLATE utf8_bin NOT NULL;
ALTER DATABASE `{$NAMESPACE}_conduit` COLLATE utf8_general_ci; ALTER DATABASE `{$NAMESPACE}_conduit` COLLATE utf8_general_ci;
ALTER TABLE `{$NAMESPACE}_conduit`.`conduit_certificatetoken` ALTER TABLE `{$NAMESPACE}_conduit`.`conduit_certificatetoken`

View file

@ -1,11 +1 @@
CREATE TABLE {$NAMESPACE}_chatlog.chatlog_channel ( /* This file is intentionally left empty, see T15126 */
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
serviceName VARCHAR(64) COLLATE utf8_bin NOT NULL,
serviceType VARCHAR(32) COLLATE utf8_bin NOT NULL,
channelName VARCHAR(64) COLLATE utf8_bin NOT NULL,
viewPolicy VARCHAR(64) COLLATE utf8_bin NOT NULL,
editPolicy VARCHAR(64) COLLATE utf8_bin NOT NULL,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
UNIQUE KEY `key_channel` (channelName, serviceType, serviceName)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

View file

@ -1,2 +1 @@
ALTER TABLE `{$NAMESPACE}_chatlog`.`chatlog_event` /* This file is intentionally left empty, see T15126 */
ADD `channelID` INT UNSIGNED NOT NULL;

View file

@ -1,64 +1,3 @@
<?php <?php
echo pht('Updating channel IDs of previous chatlog events...')."\n"; /* This file is intentionally left empty, see T15126 */
$event_table = new PhabricatorChatLogEvent();
$channel_table = new PhabricatorChatLogChannel();
$event_table->openTransaction();
$channel_table->openTransaction();
$event_table->beginReadLocking();
$channel_table->beginReadLocking();
$events = new LiskMigrationIterator($event_table);
$conn_w = $channel_table->establishConnection('w');
foreach ($events as $event) {
if ($event->getChannelID()) {
continue;
}
$event_row = queryfx_one(
$conn_w,
'SELECT channel FROM %T WHERE id = %d',
$event->getTableName(),
$event->getID());
$event_channel = $event_row['channel'];
$matched = queryfx_one(
$conn_w,
'SELECT * FROM %T WHERE
channelName = %s AND serviceName = %s AND serviceType = %s',
$channel_table->getTableName(),
$event_channel,
'',
'');
if (!$matched) {
$matched = id(new PhabricatorChatLogChannel())
->setChannelName($event_channel)
->setServiceType('')
->setServiceName('')
->setViewPolicy(PhabricatorPolicies::POLICY_USER)
->setEditPolicy(PhabricatorPolicies::POLICY_USER)
->save();
$matched_id = $matched->getID();
} else {
$matched_id = $matched['id'];
}
queryfx(
$event->establishConnection('w'),
'UPDATE %T SET channelID = %d WHERE id = %d',
$event->getTableName(),
$matched_id,
$event->getID());
}
$event_table->endReadLocking();
$channel_table->endReadLocking();
$event_table->saveTransaction();
$channel_table->saveTransaction();
echo "\n".pht('Done.')."\n";

View file

@ -1,2 +1 @@
ALTER TABLE `{$NAMESPACE}_chatlog`.`chatlog_event` /* This file is intentionally left empty, see T15126 */
DROP channel;

View file

@ -1477,45 +1477,6 @@ CREATE TABLE `edgedata` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET={$CHARSET} COLLATE={$COLLATE_TEXT}; ) ENGINE=InnoDB DEFAULT CHARSET={$CHARSET} COLLATE={$COLLATE_TEXT};
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `{$NAMESPACE}_chatlog` /*!40100 DEFAULT CHARACTER SET {$CHARSET} COLLATE {$COLLATE_TEXT} */;
USE `{$NAMESPACE}_chatlog`;
SET NAMES utf8 ;
SET character_set_client = {$CHARSET} ;
CREATE TABLE `chatlog_channel` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`serviceName` varchar(64) CHARACTER SET {$CHARSET} COLLATE {$COLLATE_TEXT} NOT NULL,
`serviceType` varchar(32) CHARACTER SET {$CHARSET} COLLATE {$COLLATE_TEXT} NOT NULL,
`channelName` varchar(64) CHARACTER SET {$CHARSET} COLLATE {$COLLATE_TEXT} NOT NULL,
`viewPolicy` varbinary(64) NOT NULL,
`editPolicy` varbinary(64) NOT NULL,
`dateCreated` int(10) unsigned NOT NULL,
`dateModified` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `key_channel` (`channelName`,`serviceType`,`serviceName`)
) ENGINE=InnoDB DEFAULT CHARSET={$CHARSET} COLLATE={$COLLATE_TEXT};
USE `{$NAMESPACE}_chatlog`;
SET NAMES utf8 ;
SET character_set_client = {$CHARSET} ;
CREATE TABLE `chatlog_event` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`epoch` int(10) unsigned NOT NULL,
`author` varchar(64) CHARACTER SET {$CHARSET} COLLATE {$COLLATE_TEXT} NOT NULL,
`type` varchar(4) CHARACTER SET {$CHARSET} COLLATE {$COLLATE_TEXT} NOT NULL,
`message` longtext CHARACTER SET {$CHARSET} COLLATE {$COLLATE_TEXT} NOT NULL,
`loggedByPHID` varbinary(64) NOT NULL,
`channelID` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `channel` (`epoch`)
) ENGINE=InnoDB DEFAULT CHARSET={$CHARSET} COLLATE={$COLLATE_TEXT};
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `{$NAMESPACE}_conduit` /*!40100 DEFAULT CHARACTER SET {$CHARSET} COLLATE {$COLLATE_TEXT} */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `{$NAMESPACE}_conduit` /*!40100 DEFAULT CHARACTER SET {$CHARSET} COLLATE {$COLLATE_TEXT} */;
USE `{$NAMESPACE}_conduit`; USE `{$NAMESPACE}_conduit`;

View file

@ -13,7 +13,7 @@ function init_phabricator_script(array $options) {
if (!$ok) { if (!$ok) {
echo echo
'FATAL ERROR: Unable to load the "Arcanist" library. '. 'FATAL ERROR: Unable to load the "Arcanist" library. '.
'Put "arcanist/" next to "phabricator/" on disk.'; 'Put "arcanist/" next to "phorge/" on disk.';
echo "\n"; echo "\n";
exit(1); exit(1);

View file

@ -339,9 +339,6 @@ phutil_register_library_map(array(
'CelerityResourcesOnDisk' => 'applications/celerity/resources/CelerityResourcesOnDisk.php', 'CelerityResourcesOnDisk' => 'applications/celerity/resources/CelerityResourcesOnDisk.php',
'CeleritySpriteGenerator' => 'applications/celerity/CeleritySpriteGenerator.php', 'CeleritySpriteGenerator' => 'applications/celerity/CeleritySpriteGenerator.php',
'CelerityStaticResourceResponse' => 'applications/celerity/CelerityStaticResourceResponse.php', 'CelerityStaticResourceResponse' => 'applications/celerity/CelerityStaticResourceResponse.php',
'ChatLogConduitAPIMethod' => 'applications/chatlog/conduit/ChatLogConduitAPIMethod.php',
'ChatLogQueryConduitAPIMethod' => 'applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php',
'ChatLogRecordConduitAPIMethod' => 'applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php',
'ConduitAPIDocumentationPage' => 'applications/conduit/data/ConduitAPIDocumentationPage.php', 'ConduitAPIDocumentationPage' => 'applications/conduit/data/ConduitAPIDocumentationPage.php',
'ConduitAPIMethod' => 'applications/conduit/method/ConduitAPIMethod.php', 'ConduitAPIMethod' => 'applications/conduit/method/ConduitAPIMethod.php',
'ConduitAPIMethodTestCase' => 'applications/conduit/method/__tests__/ConduitAPIMethodTestCase.php', 'ConduitAPIMethodTestCase' => 'applications/conduit/method/__tests__/ConduitAPIMethodTestCase.php',
@ -488,6 +485,7 @@ phutil_register_library_map(array(
'DifferentialChangesetRenderer' => 'applications/differential/render/DifferentialChangesetRenderer.php', 'DifferentialChangesetRenderer' => 'applications/differential/render/DifferentialChangesetRenderer.php',
'DifferentialChangesetSearchConduitAPIMethod' => 'applications/differential/conduit/DifferentialChangesetSearchConduitAPIMethod.php', 'DifferentialChangesetSearchConduitAPIMethod' => 'applications/differential/conduit/DifferentialChangesetSearchConduitAPIMethod.php',
'DifferentialChangesetSearchEngine' => 'applications/differential/query/DifferentialChangesetSearchEngine.php', 'DifferentialChangesetSearchEngine' => 'applications/differential/query/DifferentialChangesetSearchEngine.php',
'DifferentialChangesetTestCase' => 'applications/differential/storage/__tests__/DifferentialChangesetTestCase.php',
'DifferentialChangesetTestRenderer' => 'applications/differential/render/DifferentialChangesetTestRenderer.php', 'DifferentialChangesetTestRenderer' => 'applications/differential/render/DifferentialChangesetTestRenderer.php',
'DifferentialChangesetTwoUpRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpRenderer.php', 'DifferentialChangesetTwoUpRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpRenderer.php',
'DifferentialChangesetTwoUpTestRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpTestRenderer.php', 'DifferentialChangesetTwoUpTestRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpTestRenderer.php',
@ -2807,15 +2805,6 @@ phutil_register_library_map(array(
'PhabricatorChartInterval' => 'applications/fact/chart/PhabricatorChartInterval.php', 'PhabricatorChartInterval' => 'applications/fact/chart/PhabricatorChartInterval.php',
'PhabricatorChartRenderingEngine' => 'applications/fact/engine/PhabricatorChartRenderingEngine.php', 'PhabricatorChartRenderingEngine' => 'applications/fact/engine/PhabricatorChartRenderingEngine.php',
'PhabricatorChartStackedAreaDataset' => 'applications/fact/chart/PhabricatorChartStackedAreaDataset.php', 'PhabricatorChartStackedAreaDataset' => 'applications/fact/chart/PhabricatorChartStackedAreaDataset.php',
'PhabricatorChatLogApplication' => 'applications/chatlog/application/PhabricatorChatLogApplication.php',
'PhabricatorChatLogChannel' => 'applications/chatlog/storage/PhabricatorChatLogChannel.php',
'PhabricatorChatLogChannelListController' => 'applications/chatlog/controller/PhabricatorChatLogChannelListController.php',
'PhabricatorChatLogChannelLogController' => 'applications/chatlog/controller/PhabricatorChatLogChannelLogController.php',
'PhabricatorChatLogChannelQuery' => 'applications/chatlog/query/PhabricatorChatLogChannelQuery.php',
'PhabricatorChatLogController' => 'applications/chatlog/controller/PhabricatorChatLogController.php',
'PhabricatorChatLogDAO' => 'applications/chatlog/storage/PhabricatorChatLogDAO.php',
'PhabricatorChatLogEvent' => 'applications/chatlog/storage/PhabricatorChatLogEvent.php',
'PhabricatorChatLogQuery' => 'applications/chatlog/query/PhabricatorChatLogQuery.php',
'PhabricatorCheckboxesEditField' => 'applications/transactions/editfield/PhabricatorCheckboxesEditField.php', 'PhabricatorCheckboxesEditField' => 'applications/transactions/editfield/PhabricatorCheckboxesEditField.php',
'PhabricatorChunkedFileStorageEngine' => 'applications/files/engine/PhabricatorChunkedFileStorageEngine.php', 'PhabricatorChunkedFileStorageEngine' => 'applications/files/engine/PhabricatorChunkedFileStorageEngine.php',
'PhabricatorClassConfigType' => 'applications/config/type/PhabricatorClassConfigType.php', 'PhabricatorClassConfigType' => 'applications/config/type/PhabricatorClassConfigType.php',
@ -4627,6 +4616,7 @@ phutil_register_library_map(array(
'PhabricatorRepositoryIdentityAssignTransaction' => 'applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php', 'PhabricatorRepositoryIdentityAssignTransaction' => 'applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php',
'PhabricatorRepositoryIdentityChangeWorker' => 'applications/repository/worker/PhabricatorRepositoryIdentityChangeWorker.php', 'PhabricatorRepositoryIdentityChangeWorker' => 'applications/repository/worker/PhabricatorRepositoryIdentityChangeWorker.php',
'PhabricatorRepositoryIdentityEditEngine' => 'applications/repository/engine/PhabricatorRepositoryIdentityEditEngine.php', 'PhabricatorRepositoryIdentityEditEngine' => 'applications/repository/engine/PhabricatorRepositoryIdentityEditEngine.php',
'PhabricatorRepositoryIdentityEditViewCapability' => 'applications/repository/capability/PhabricatorRepositoryIdentityEditViewCapability.php',
'PhabricatorRepositoryIdentityFerretEngine' => 'applications/repository/search/PhabricatorRepositoryIdentityFerretEngine.php', 'PhabricatorRepositoryIdentityFerretEngine' => 'applications/repository/search/PhabricatorRepositoryIdentityFerretEngine.php',
'PhabricatorRepositoryIdentityPHIDType' => 'applications/repository/phid/PhabricatorRepositoryIdentityPHIDType.php', 'PhabricatorRepositoryIdentityPHIDType' => 'applications/repository/phid/PhabricatorRepositoryIdentityPHIDType.php',
'PhabricatorRepositoryIdentityQuery' => 'applications/repository/query/PhabricatorRepositoryIdentityQuery.php', 'PhabricatorRepositoryIdentityQuery' => 'applications/repository/query/PhabricatorRepositoryIdentityQuery.php',
@ -5397,6 +5387,8 @@ phutil_register_library_map(array(
'PholioTransactionType' => 'applications/pholio/xaction/PholioTransactionType.php', 'PholioTransactionType' => 'applications/pholio/xaction/PholioTransactionType.php',
'PholioTransactionView' => 'applications/pholio/view/PholioTransactionView.php', 'PholioTransactionView' => 'applications/pholio/view/PholioTransactionView.php',
'PholioUploadedImageView' => 'applications/pholio/view/PholioUploadedImageView.php', 'PholioUploadedImageView' => 'applications/pholio/view/PholioUploadedImageView.php',
'PhorgeCodeWarningSetupCheck' => 'applications/config/check/PhorgeCodeWarningSetupCheck.php',
'PhorgeSystemDeprecationWarningListener' => 'applications/system/events/PhorgeSystemDeprecationWarningListener.php',
'PhortuneAccount' => 'applications/phortune/storage/PhortuneAccount.php', 'PhortuneAccount' => 'applications/phortune/storage/PhortuneAccount.php',
'PhortuneAccountAddManagerController' => 'applications/phortune/controller/account/PhortuneAccountAddManagerController.php', 'PhortuneAccountAddManagerController' => 'applications/phortune/controller/account/PhortuneAccountAddManagerController.php',
'PhortuneAccountBillingAddressTransaction' => 'applications/phortune/xaction/PhortuneAccountBillingAddressTransaction.php', 'PhortuneAccountBillingAddressTransaction' => 'applications/phortune/xaction/PhortuneAccountBillingAddressTransaction.php',
@ -6337,9 +6329,6 @@ phutil_register_library_map(array(
'CelerityResourcesOnDisk' => 'CelerityPhysicalResources', 'CelerityResourcesOnDisk' => 'CelerityPhysicalResources',
'CeleritySpriteGenerator' => 'Phobject', 'CeleritySpriteGenerator' => 'Phobject',
'CelerityStaticResourceResponse' => 'Phobject', 'CelerityStaticResourceResponse' => 'Phobject',
'ChatLogConduitAPIMethod' => 'ConduitAPIMethod',
'ChatLogQueryConduitAPIMethod' => 'ChatLogConduitAPIMethod',
'ChatLogRecordConduitAPIMethod' => 'ChatLogConduitAPIMethod',
'ConduitAPIDocumentationPage' => 'Phobject', 'ConduitAPIDocumentationPage' => 'Phobject',
'ConduitAPIMethod' => array( 'ConduitAPIMethod' => array(
'Phobject', 'Phobject',
@ -6501,6 +6490,7 @@ phutil_register_library_map(array(
'DifferentialChangesetRenderer' => 'Phobject', 'DifferentialChangesetRenderer' => 'Phobject',
'DifferentialChangesetSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 'DifferentialChangesetSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'DifferentialChangesetSearchEngine' => 'PhabricatorApplicationSearchEngine', 'DifferentialChangesetSearchEngine' => 'PhabricatorApplicationSearchEngine',
'DifferentialChangesetTestCase' => 'PhabricatorTestCase',
'DifferentialChangesetTestRenderer' => 'DifferentialChangesetRenderer', 'DifferentialChangesetTestRenderer' => 'DifferentialChangesetRenderer',
'DifferentialChangesetTwoUpRenderer' => 'DifferentialChangesetHTMLRenderer', 'DifferentialChangesetTwoUpRenderer' => 'DifferentialChangesetHTMLRenderer',
'DifferentialChangesetTwoUpTestRenderer' => 'DifferentialChangesetTestRenderer', 'DifferentialChangesetTwoUpTestRenderer' => 'DifferentialChangesetTestRenderer',
@ -9188,21 +9178,6 @@ phutil_register_library_map(array(
'PhabricatorChartInterval' => 'Phobject', 'PhabricatorChartInterval' => 'Phobject',
'PhabricatorChartRenderingEngine' => 'Phobject', 'PhabricatorChartRenderingEngine' => 'Phobject',
'PhabricatorChartStackedAreaDataset' => 'PhabricatorChartDataset', 'PhabricatorChartStackedAreaDataset' => 'PhabricatorChartDataset',
'PhabricatorChatLogApplication' => 'PhabricatorApplication',
'PhabricatorChatLogChannel' => array(
'PhabricatorChatLogDAO',
'PhabricatorPolicyInterface',
),
'PhabricatorChatLogChannelListController' => 'PhabricatorChatLogController',
'PhabricatorChatLogChannelLogController' => 'PhabricatorChatLogController',
'PhabricatorChatLogChannelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorChatLogController' => 'PhabricatorController',
'PhabricatorChatLogDAO' => 'PhabricatorLiskDAO',
'PhabricatorChatLogEvent' => array(
'PhabricatorChatLogDAO',
'PhabricatorPolicyInterface',
),
'PhabricatorChatLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorCheckboxesEditField' => 'PhabricatorEditField', 'PhabricatorCheckboxesEditField' => 'PhabricatorEditField',
'PhabricatorChunkedFileStorageEngine' => 'PhabricatorFileStorageEngine', 'PhabricatorChunkedFileStorageEngine' => 'PhabricatorFileStorageEngine',
'PhabricatorClassConfigType' => 'PhabricatorTextConfigType', 'PhabricatorClassConfigType' => 'PhabricatorTextConfigType',
@ -11323,6 +11298,7 @@ phutil_register_library_map(array(
'PhabricatorRepositoryIdentityAssignTransaction' => 'PhabricatorRepositoryIdentityTransactionType', 'PhabricatorRepositoryIdentityAssignTransaction' => 'PhabricatorRepositoryIdentityTransactionType',
'PhabricatorRepositoryIdentityChangeWorker' => 'PhabricatorWorker', 'PhabricatorRepositoryIdentityChangeWorker' => 'PhabricatorWorker',
'PhabricatorRepositoryIdentityEditEngine' => 'PhabricatorEditEngine', 'PhabricatorRepositoryIdentityEditEngine' => 'PhabricatorEditEngine',
'PhabricatorRepositoryIdentityEditViewCapability' => 'PhabricatorPolicyCapability',
'PhabricatorRepositoryIdentityFerretEngine' => 'PhabricatorFerretEngine', 'PhabricatorRepositoryIdentityFerretEngine' => 'PhabricatorFerretEngine',
'PhabricatorRepositoryIdentityPHIDType' => 'PhabricatorPHIDType', 'PhabricatorRepositoryIdentityPHIDType' => 'PhabricatorPHIDType',
'PhabricatorRepositoryIdentityQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorRepositoryIdentityQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@ -12234,6 +12210,8 @@ phutil_register_library_map(array(
'PholioTransactionType' => 'PhabricatorModularTransactionType', 'PholioTransactionType' => 'PhabricatorModularTransactionType',
'PholioTransactionView' => 'PhabricatorApplicationTransactionView', 'PholioTransactionView' => 'PhabricatorApplicationTransactionView',
'PholioUploadedImageView' => 'AphrontView', 'PholioUploadedImageView' => 'AphrontView',
'PhorgeCodeWarningSetupCheck' => 'PhabricatorSetupCheck',
'PhorgeSystemDeprecationWarningListener' => 'PhabricatorEventListener',
'PhortuneAccount' => array( 'PhortuneAccount' => array(
'PhortuneDAO', 'PhortuneDAO',
'PhabricatorApplicationTransactionInterface', 'PhabricatorApplicationTransactionInterface',

View file

@ -338,7 +338,17 @@ final class PhabricatorAuditTransaction
$author = null; $author = null;
} }
if ($author) { // Show both Author and Committer only if they are different.
$show_both = $author && $committer;
if ($show_both) {
if ($new['authorPHID']) {
$show_both = $new['authorPHID'] !== $new['committerPHID'];
} else if (phutil_nonempty_string($new['authorName'])) {
$show_both = $new['authorName'] !== $new['committerName'];
}
}
if ($show_both) {
$title = pht( $title = pht(
'%s committed %s (authored by %s).', '%s committed %s (authored by %s).',
$committer, $committer,

View file

@ -104,7 +104,7 @@ abstract class PhutilOAuth1AuthAdapter extends PhutilAuthAdapter {
->setSignatureMethod($this->getSignatureMethod()); ->setSignatureMethod($this->getSignatureMethod());
$consumer_key = $this->getConsumerKey(); $consumer_key = $this->getConsumerKey();
if (strlen($consumer_key)) { if (phutil_nonempty_string($consumer_key)) {
$future->setConsumerKey($consumer_key); $future->setConsumerKey($consumer_key);
} else { } else {
throw new Exception( throw new Exception(
@ -118,11 +118,11 @@ abstract class PhutilOAuth1AuthAdapter extends PhutilAuthAdapter {
$future->setConsumerSecret($consumer_secret); $future->setConsumerSecret($consumer_secret);
} }
if (strlen($this->getToken())) { if (phutil_nonempty_string($this->getToken())) {
$future->setToken($this->getToken()); $future->setToken($this->getToken());
} }
if (strlen($this->getTokenSecret())) { if (phutil_nonempty_string($this->getTokenSecret())) {
$future->setTokenSecret($this->getTokenSecret()); $future->setTokenSecret($this->getTokenSecret());
} }
@ -137,7 +137,7 @@ abstract class PhutilOAuth1AuthAdapter extends PhutilAuthAdapter {
$request_token_uri = $this->getRequestTokenURI(); $request_token_uri = $this->getRequestTokenURI();
$future = $this->newOAuth1Future($request_token_uri); $future = $this->newOAuth1Future($request_token_uri);
if (strlen($this->getCallbackURI())) { if (phutil_nonempty_string($this->getCallbackURI())) {
$future->setCallbackURI($this->getCallbackURI()); $future->setCallbackURI($this->getCallbackURI());
} }

View file

@ -40,7 +40,7 @@ final class PhabricatorAuthSetExternalController
$text = PhabricatorAuthMessage::loadMessageText( $text = PhabricatorAuthMessage::loadMessageText(
$viewer, $viewer,
PhabricatorAuthLinkMessageType::MESSAGEKEY); PhabricatorAuthLinkMessageType::MESSAGEKEY);
if (!strlen($text)) { if (!phutil_nonempty_string($text)) {
$text = pht( $text = pht(
'You can link your %s account to an external account to '. 'You can link your %s account to an external account to '.
'allow you to log in more easily in the future. To continue, choose '. 'allow you to log in more easily in the future. To continue, choose '.

View file

@ -7,6 +7,8 @@ final class PhabricatorAuthContactNumberDisableController
$viewer = $request->getViewer(); $viewer = $request->getViewer();
$id = $request->getURIData('id'); $id = $request->getURIData('id');
$sms_auth_factor = new PhabricatorSMSAuthFactor();
if ($sms_auth_factor->isSMSMailerConfigured()) {
$number = id(new PhabricatorAuthContactNumberQuery()) $number = id(new PhabricatorAuthContactNumberQuery())
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($id)) ->withIDs(array($id))
@ -16,7 +18,8 @@ final class PhabricatorAuthContactNumberDisableController
PhabricatorPolicyCapability::CAN_EDIT, PhabricatorPolicyCapability::CAN_EDIT,
)) ))
->executeOne(); ->executeOne();
if (!$number) { }
if (!isset($number) || !$number) {
return new Aphront404Response(); return new Aphront404Response();
} }

View file

@ -4,9 +4,14 @@ final class PhabricatorAuthContactNumberEditController
extends PhabricatorAuthContactNumberController { extends PhabricatorAuthContactNumberController {
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$sms_auth_factor = new PhabricatorSMSAuthFactor();
if ($sms_auth_factor->isSMSMailerConfigured()) {
return id(new PhabricatorAuthContactNumberEditEngine()) return id(new PhabricatorAuthContactNumberEditEngine())
->setController($this) ->setController($this)
->buildResponse(); ->buildResponse();
} else {
return new Aphront404Response();
}
} }
} }

View file

@ -7,6 +7,8 @@ final class PhabricatorAuthContactNumberPrimaryController
$viewer = $request->getViewer(); $viewer = $request->getViewer();
$id = $request->getURIData('id'); $id = $request->getURIData('id');
$sms_auth_factor = new PhabricatorSMSAuthFactor();
if ($sms_auth_factor->isSMSMailerConfigured()) {
$number = id(new PhabricatorAuthContactNumberQuery()) $number = id(new PhabricatorAuthContactNumberQuery())
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($id)) ->withIDs(array($id))
@ -16,7 +18,8 @@ final class PhabricatorAuthContactNumberPrimaryController
PhabricatorPolicyCapability::CAN_EDIT, PhabricatorPolicyCapability::CAN_EDIT,
)) ))
->executeOne(); ->executeOne();
if (!$number) { }
if (!isset($number) || !$number) {
return new Aphront404Response(); return new Aphront404Response();
} }

View file

@ -7,6 +7,8 @@ final class PhabricatorAuthContactNumberTestController
$viewer = $request->getViewer(); $viewer = $request->getViewer();
$id = $request->getURIData('id'); $id = $request->getURIData('id');
$sms_auth_factor = new PhabricatorSMSAuthFactor();
if ($sms_auth_factor->isSMSMailerConfigured()) {
$number = id(new PhabricatorAuthContactNumberQuery()) $number = id(new PhabricatorAuthContactNumberQuery())
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($id)) ->withIDs(array($id))
@ -16,7 +18,8 @@ final class PhabricatorAuthContactNumberTestController
PhabricatorPolicyCapability::CAN_EDIT, PhabricatorPolicyCapability::CAN_EDIT,
)) ))
->executeOne(); ->executeOne();
if (!$number) { }
if (!isset($number) || !$number) {
return new Aphront404Response(); return new Aphront404Response();
} }

View file

@ -6,11 +6,14 @@ final class PhabricatorAuthContactNumberViewController
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$sms_auth_factor = new PhabricatorSMSAuthFactor();
if ($sms_auth_factor->isSMSMailerConfigured()) {
$number = id(new PhabricatorAuthContactNumberQuery()) $number = id(new PhabricatorAuthContactNumberQuery())
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($request->getURIData('id'))) ->withIDs(array($request->getURIData('id')))
->executeOne(); ->executeOne();
if (!$number) { }
if (!isset($number) || !$number) {
return new Aphront404Response(); return new Aphront404Response();
} }

View file

@ -47,7 +47,10 @@ final class PhabricatorAuthCSRFEngine extends Phobject {
// We expect a BREACH-mitigating token. See T3684. // We expect a BREACH-mitigating token. See T3684.
$breach_prefix = $this->getBREACHPrefix(); $breach_prefix = $this->getBREACHPrefix();
$breach_prelen = strlen($breach_prefix); $breach_prelen = strlen($breach_prefix);
if (strncmp($token, $breach_prefix, $breach_prelen) !== 0) { if (
$token === null ||
strncmp($token, $breach_prefix, $breach_prelen) !== 0
) {
return false; return false;
} }

View file

@ -334,7 +334,7 @@ final class PhabricatorSMSAuthFactor
return $value; return $value;
} }
private function isSMSMailerConfigured() { public function isSMSMailerConfigured() {
$mailers = PhabricatorMetaMTAMail::newMailers( $mailers = PhabricatorMetaMTAMail::newMailers(
array( array(
'outbound' => true, 'outbound' => true,

View file

@ -53,9 +53,8 @@ final class PhabricatorAuthProvidersGuidanceEngineExtension
->setMessage($message); ->setMessage($message);
} else { } else {
$message = pht( $message = pht(
'Anyone who can browse to this this server will be able to '. 'Anyone who can browse to this server will be able to register '.
'register an account. To add email domain restrictions, configure '. 'an account. To add email domain restrictions, configure %s.',
'%s.',
$domains_link); $domains_link);
$results[] = $this->newGuidance('core.auth.email-domains.off') $results[] = $this->newGuidance('core.auth.email-domains.off')

View file

@ -67,7 +67,7 @@ abstract class PhabricatorOAuth1AuthProvider
} }
$denied = $request->getStr('denied'); $denied = $request->getStr('denied');
if (strlen($denied)) { if ($denied) {
// Twitter indicates that the user cancelled the login attempt by // Twitter indicates that the user cancelled the login attempt by
// returning "denied" as a parameter. // returning "denied" as a parameter.
throw new PhutilAuthUserAbortedException(); throw new PhutilAuthUserAbortedException();

View file

@ -150,7 +150,7 @@ final class PhabricatorAuthProviderConfigTransaction
$provider = $this->getProvider(); $provider = $this->getProvider();
if ($provider) { if ($provider) {
$title = $provider->renderConfigPropertyTransactionTitle($this); $title = $provider->renderConfigPropertyTransactionTitle($this);
if (strlen($title)) { if (phutil_nonempty_string($title)) {
return $title; return $title;
} }
} }

View file

@ -29,13 +29,14 @@ final class PhabricatorAuthAccountView extends AphrontView {
$realname = $account->getRealName(); $realname = $account->getRealName();
$use_name = null; $use_name = null;
if (strlen($dispname)) { if (phutil_nonempty_string($dispname)) {
$use_name = $dispname; $use_name = $dispname;
} else if (strlen($username) && strlen($realname)) { } else if (phutil_nonempty_string($username) &&
phutil_nonempty_string($realname)) {
$use_name = $username.' ('.$realname.')'; $use_name = $username.' ('.$realname.')';
} else if (strlen($username)) { } else if (phutil_nonempty_string($username)) {
$use_name = $username; $use_name = $username;
} else if (strlen($realname)) { } else if (phutil_nonempty_string($realname)) {
$use_name = $realname; $use_name = $realname;
} }

View file

@ -61,6 +61,21 @@ abstract class PhabricatorApplication
return pht('%s Application', $this->getName()); return pht('%s Application', $this->getName());
} }
/**
* Extensions are allowed to register multi-character monograms.
* The name "Monogram" is actually a bit of a misnomer,
* but we're keeping it due to the history.
*
* @return array
*/
public function getMonograms() {
return array();
}
public function isDeprecated() {
return false;
}
final public function isInstalled() { final public function isInstalled() {
if (!$this->canUninstall()) { if (!$this->canUninstall()) {
return true; return true;

View file

@ -28,6 +28,10 @@ final class PhabricatorCalendarApplication extends PhabricatorApplication {
return "\xE2\x8C\xA8"; return "\xE2\x8C\xA8";
} }
public function getMonograms() {
return array('E');
}
public function getApplicationGroup() { public function getApplicationGroup() {
return self::GROUP_UTILITIES; return self::GROUP_UTILITIES;
} }

View file

@ -83,12 +83,6 @@ final class PhabricatorCalendarImportEditEngine
$engine = $object->getEngine(); $engine = $object->getEngine();
$can_trigger = $engine->supportsTriggers($object); $can_trigger = $engine->supportsTriggers($object);
// calendar URI import
// note that it can contains a secret token
// if we are here you have enough privileges to edit and see the value
$uri_key = PhabricatorCalendarImportICSURITransaction::PARAMKEY_URI;
$uri = $object->getParameter($uri_key);
$fields = array( $fields = array(
id(new PhabricatorTextEditField()) id(new PhabricatorTextEditField())
->setKey('name') ->setKey('name')
@ -100,15 +94,6 @@ final class PhabricatorCalendarImportEditEngine
->setConduitTypeDescription(pht('New import name.')) ->setConduitTypeDescription(pht('New import name.'))
->setPlaceholder($object->getDisplayName()) ->setPlaceholder($object->getDisplayName())
->setValue($object->getName()), ->setValue($object->getName()),
id(new PhabricatorTextEditField())
->setKey('uri')
->setLabel(pht('URI'))
->setDescription(pht('URI to import.'))
->setTransactionType(
PhabricatorCalendarImportICSURITransaction::TRANSACTIONTYPE)
->setConduitDescription(pht('URI to import.'))
->setConduitTypeDescription(pht('New URI.'))
->setValue($uri),
id(new PhabricatorBoolEditField()) id(new PhabricatorBoolEditField())
->setKey('disabled') ->setKey('disabled')
->setOptions(pht('Active'), pht('Disabled')) ->setOptions(pht('Active'), pht('Disabled'))

View file

@ -58,7 +58,10 @@ final class PhabricatorCalendarICSURIImportEngine
PhabricatorCalendarImport $import) { PhabricatorCalendarImport $import) {
$fields = array(); $fields = array();
if ($engine->getIsCreate()) { // If you are here, you already have the "can edit" capability.
// So you are supposed to be able to edit again your Calendar import URI.
$uri_key = PhabricatorCalendarImportICSURITransaction::PARAMKEY_URI;
$uri = $import->getParameter($uri_key);
$fields[] = id(new PhabricatorTextEditField()) $fields[] = id(new PhabricatorTextEditField())
->setKey('uri') ->setKey('uri')
->setLabel(pht('URI')) ->setLabel(pht('URI'))
@ -66,8 +69,8 @@ final class PhabricatorCalendarICSURIImportEngine
->setTransactionType( ->setTransactionType(
PhabricatorCalendarImportICSURITransaction::TRANSACTIONTYPE) PhabricatorCalendarImportICSURITransaction::TRANSACTIONTYPE)
->setConduitDescription(pht('URI to import.')) ->setConduitDescription(pht('URI to import.'))
->setConduitTypeDescription(pht('New URI.')); ->setConduitTypeDescription(pht('New URI.'))
} ->setValue($uri);
return $fields; return $fields;
} }

View file

@ -447,7 +447,7 @@ abstract class PhabricatorCalendarImportEngine
private function getParentNodeUID(PhutilCalendarEventNode $node) { private function getParentNodeUID(PhutilCalendarEventNode $node) {
$recurrence_id = $node->getRecurrenceID(); $recurrence_id = $node->getRecurrenceID();
if (!strlen($recurrence_id)) { if (!phutil_nonempty_string($recurrence_id)) {
return null; return null;
} }
@ -456,7 +456,7 @@ abstract class PhabricatorCalendarImportEngine
private function getNodeInstanceEpoch(PhutilCalendarEventNode $node) { private function getNodeInstanceEpoch(PhutilCalendarEventNode $node) {
$instance_iso = $node->getRecurrenceID(); $instance_iso = $node->getRecurrenceID();
if (strlen($instance_iso)) { if (phutil_nonempty_string($instance_iso)) {
$instance_datetime = PhutilCalendarAbsoluteDateTime::newFromISO8601( $instance_datetime = PhutilCalendarAbsoluteDateTime::newFromISO8601(
$instance_iso); $instance_iso);
$instance_epoch = $instance_datetime->getEpoch(); $instance_epoch = $instance_datetime->getEpoch();

View file

@ -1,43 +0,0 @@
<?php
final class PhabricatorChatLogApplication extends PhabricatorApplication {
public function getBaseURI() {
return '/chatlog/';
}
public function getName() {
return pht('ChatLog');
}
public function getShortDescription() {
return pht('(Deprecated)');
}
public function getIcon() {
return 'fa-coffee';
}
public function isPrototype() {
return true;
}
public function getTitleGlyph() {
return "\xE0\xBC\x84";
}
public function getApplicationGroup() {
return self::GROUP_UTILITIES;
}
public function getRoutes() {
return array(
'/chatlog/' => array(
'' => 'PhabricatorChatLogChannelListController',
'channel/(?P<channelID>[^/]+)/'
=> 'PhabricatorChatLogChannelLogController',
),
);
}
}

View file

@ -1,9 +0,0 @@
<?php
abstract class ChatLogConduitAPIMethod extends ConduitAPIMethod {
final public function getApplication() {
return PhabricatorApplication::getByClass('PhabricatorChatLogApplication');
}
}

View file

@ -1,59 +0,0 @@
<?php
final class ChatLogQueryConduitAPIMethod extends ChatLogConduitAPIMethod {
public function getAPIMethodName() {
return 'chatlog.query';
}
public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE;
}
public function getMethodDescription() {
return pht('Retrieve chatter.');
}
protected function defineParamTypes() {
return array(
'channels' => 'optional list<string>',
'limit' => 'optional int (default = 100)',
);
}
protected function defineReturnType() {
return 'nonempty list<dict>';
}
protected function execute(ConduitAPIRequest $request) {
$query = new PhabricatorChatLogQuery();
$channel_ids = $request->getValue('channelIDs');
if ($channel_ids) {
$query->withChannelIDs($channel_ids);
}
$limit = $request->getValue('limit');
if (!$limit) {
$limit = 100;
}
$query->setLimit($limit);
$logs = $query->execute();
$results = array();
foreach ($logs as $log) {
$results[] = array(
'channelID' => $log->getChannelID(),
'epoch' => $log->getEpoch(),
'author' => $log->getAuthor(),
'type' => $log->getType(),
'message' => $log->getMessage(),
'loggedByPHID' => $log->getLoggedByPHID(),
);
}
return $results;
}
}

View file

@ -1,72 +0,0 @@
<?php
final class ChatLogRecordConduitAPIMethod extends ChatLogConduitAPIMethod {
public function getAPIMethodName() {
return 'chatlog.record';
}
public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE;
}
public function getMethodDescription() {
return pht('Record chatter.');
}
protected function defineParamTypes() {
return array(
'logs' => 'required list<dict>',
);
}
protected function defineReturnType() {
return 'list<id>';
}
protected function execute(ConduitAPIRequest $request) {
$logs = $request->getValue('logs');
if (!is_array($logs)) {
$logs = array();
}
$template = new PhabricatorChatLogEvent();
$template->setLoggedByPHID($request->getUser()->getPHID());
$objs = array();
foreach ($logs as $log) {
$channel_name = idx($log, 'channel');
$service_name = idx($log, 'serviceName');
$service_type = idx($log, 'serviceType');
$channel = id(new PhabricatorChatLogChannel())->loadOneWhere(
'channelName = %s AND serviceName = %s AND serviceType = %s',
$channel_name,
$service_name,
$service_type);
if (!$channel) {
$channel = id(new PhabricatorChatLogChannel())
->setChannelName($channel_name)
->setserviceName($service_name)
->setServiceType($service_type)
->setViewPolicy(PhabricatorPolicies::POLICY_USER)
->setEditPolicy(PhabricatorPolicies::POLICY_USER)
->save();
}
$obj = clone $template;
$obj->setChannelID($channel->getID());
$obj->setType(idx($log, 'type'));
$obj->setAuthor(idx($log, 'author'));
$obj->setEpoch(idx($log, 'epoch'));
$obj->setMessage(idx($log, 'message'));
$obj->save();
$objs[] = $obj;
}
return array_values(mpull($objs, 'getID'));
}
}

View file

@ -1,41 +0,0 @@
<?php
final class PhabricatorChatLogChannelListController
extends PhabricatorChatLogController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$channels = id(new PhabricatorChatLogChannelQuery())
->setViewer($viewer)
->execute();
$list = new PHUIObjectItemListView();
foreach ($channels as $channel) {
$item = id(new PHUIObjectItemView())
->setHeader($channel->getChannelName())
->setHref('/chatlog/channel/'.$channel->getID().'/')
->addAttribute($channel->getServiceName())
->addAttribute($channel->getServiceType());
$list->addItem($item);
}
$crumbs = $this
->buildApplicationCrumbs()
->addTextCrumb(pht('Channel List'), $this->getApplicationURI());
$box = id(new PHUIObjectBoxView())
->setHeaderText('Channel List')
->setObjectList($list);
return $this->newPage()
->setTitle(pht('Channel List'))
->setCrumbs($crumbs)
->appendChild($box);
}
}

View file

@ -1,320 +0,0 @@
<?php
final class PhabricatorChatLogChannelLogController
extends PhabricatorChatLogController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('channelID');
$uri = new PhutilURI($request->getPath());
$pager = new AphrontCursorPagerView();
$pager->setURI($uri);
$pager->setPageSize(250);
$query = id(new PhabricatorChatLogQuery())
->setViewer($viewer)
->withChannelIDs(array($id));
$channel = id(new PhabricatorChatLogChannelQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if (!$channel) {
return new Aphront404Response();
}
list($after, $before, $map) = $this->getPagingParameters($request, $query);
$pager->setAfterID($after);
$pager->setBeforeID($before);
$logs = $query->executeWithCursorPager($pager);
// Show chat logs oldest-first.
$logs = array_reverse($logs);
// Divide all the logs into blocks, where a block is the same author saying
// several things in a row. A block ends when another user speaks, or when
// two minutes pass without the author speaking.
$blocks = array();
$block = null;
$last_author = null;
$last_epoch = null;
foreach ($logs as $log) {
$this_author = $log->getAuthor();
$this_epoch = $log->getEpoch();
// Decide whether we should start a new block or not.
$new_block = ($this_author !== $last_author) ||
($this_epoch - (60 * 2) > $last_epoch);
if ($new_block) {
if ($block) {
$blocks[] = $block;
}
$block = array(
'id' => $log->getID(),
'epoch' => $this_epoch,
'author' => $this_author,
'logs' => array($log),
);
} else {
$block['logs'][] = $log;
}
$last_author = $this_author;
$last_epoch = $this_epoch;
}
if ($block) {
$blocks[] = $block;
}
// Figure out CSS classes for the blocks. We alternate colors between
// lines, and highlight the entire block which contains the target ID or
// date, if applicable.
foreach ($blocks as $key => $block) {
$classes = array();
if ($key % 2) {
$classes[] = 'alternate';
}
$ids = mpull($block['logs'], 'getID', 'getID');
if (array_intersect_key($ids, $map)) {
$classes[] = 'highlight';
}
$blocks[$key]['class'] = $classes ? implode(' ', $classes) : null;
}
require_celerity_resource('phabricator-chatlog-css');
$out = array();
foreach ($blocks as $block) {
$author = $block['author'];
$author = id(new PhutilUTF8StringTruncator())
->setMaximumGlyphs(18)
->truncateString($author);
$author = phutil_tag('td', array('class' => 'author'), $author);
$href = $uri->alter('at', $block['id']);
$timestamp = $block['epoch'];
$timestamp = phabricator_datetime($timestamp, $viewer);
$timestamp = phutil_tag(
'a',
array(
'href' => $href,
'class' => 'timestamp',
),
$timestamp);
$message = mpull($block['logs'], 'getMessage');
$message = implode("\n", $message);
$message = phutil_tag(
'td',
array(
'class' => 'message',
),
array(
$timestamp,
$message,
));
$out[] = phutil_tag(
'tr',
array(
'class' => $block['class'],
),
array(
$author,
$message,
));
}
$links = array();
$first_uri = $pager->getFirstPageURI();
if ($first_uri) {
$links[] = phutil_tag(
'a',
array(
'href' => $first_uri,
),
"\xC2\xAB ".pht('Newest'));
}
$prev_uri = $pager->getPrevPageURI();
if ($prev_uri) {
$links[] = phutil_tag(
'a',
array(
'href' => $prev_uri,
),
"\xE2\x80\xB9 ".pht('Newer'));
}
$next_uri = $pager->getNextPageURI();
if ($next_uri) {
$links[] = phutil_tag(
'a',
array(
'href' => $next_uri,
),
pht('Older')." \xE2\x80\xBA");
}
$pager_bottom = phutil_tag(
'div',
array('class' => 'phabricator-chat-log-pager-bottom'),
$links);
$crumbs = $this
->buildApplicationCrumbs()
->addTextCrumb($channel->getChannelName(), $uri);
$form = id(new AphrontFormView())
->setUser($viewer)
->setMethod('GET')
->setAction($uri)
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Date'))
->setName('date')
->setValue($request->getStr('date')))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Jump')));
$table = phutil_tag(
'table',
array(
'class' => 'phabricator-chat-log',
),
$out);
$log = phutil_tag(
'div',
array(
'class' => 'phabricator-chat-log-panel',
),
$table);
$jump_link = id(new PHUIButtonView())
->setTag('a')
->setHref('#latest')
->setText(pht('Jump to Bottom'))
->setIcon('fa-arrow-circle-down');
$jump_target = phutil_tag(
'div',
array(
'id' => 'latest',
));
$content = phutil_tag(
'div',
array(
'class' => 'phabricator-chat-log-wrap',
),
array(
$log,
$jump_target,
$pager_bottom,
));
$header = id(new PHUIHeaderView())
->setHeader($channel->getChannelName())
->setSubHeader($channel->getServiceName())
->addActionLink($jump_link);
$box = id(new PHUIObjectBoxView())
->setHeader($header)
->setCollapsed(true)
->appendChild($content);
$box->setShowHide(
pht('Search Dates'),
pht('Hide Dates'),
$form,
'#');
return $this->newPage()
->setTitle(pht('Channel Log'))
->setCrumbs($crumbs)
->appendChild($box);
}
/**
* From request parameters, figure out where we should jump to in the log.
* We jump to either a date or log ID, but load a few lines of context before
* it so the user can see the nearby conversation.
*/
private function getPagingParameters(
AphrontRequest $request,
PhabricatorChatLogQuery $query) {
$viewer = $request->getViewer();
$at_id = $request->getInt('at');
$at_date = $request->getStr('date');
$context_log = null;
$map = array();
$query = clone $query;
$query->setLimit(8);
if ($at_id) {
// Jump to the log in question, and load a few lines of context before
// it.
$context_logs = $query
->setAfterID($at_id)
->execute();
$context_log = last($context_logs);
$map = array(
$at_id => true,
);
} else if ($at_date) {
$timestamp = PhabricatorTime::parseLocalTime($at_date, $viewer);
if ($timestamp) {
$context_logs = $query
->withMaximumEpoch($timestamp)
->execute();
$context_log = last($context_logs);
$target_log = head($context_logs);
if ($target_log) {
$map = array(
$target_log->getID() => true,
);
}
}
}
if ($context_log) {
$after = null;
$before = $context_log->getID() - 1;
} else {
$after = $request->getInt('after');
$before = $request->getInt('before');
}
return array($after, $before, $map);
}
}

View file

@ -1,3 +0,0 @@
<?php
abstract class PhabricatorChatLogController extends PhabricatorController {}

View file

@ -1,63 +0,0 @@
<?php
final class PhabricatorChatLogChannelQuery
extends PhabricatorCursorPagedPolicyAwareQuery {
private $channels;
private $channelIDs;
public function withChannelNames(array $channels) {
$this->channels = $channels;
return $this;
}
public function withIDs(array $channel_ids) {
$this->channelIDs = $channel_ids;
return $this;
}
protected function loadPage() {
$table = new PhabricatorChatLogChannel();
$conn_r = $table->establishConnection('r');
$data = queryfx_all(
$conn_r,
'SELECT * FROM %T c %Q %Q %Q',
$table->getTableName(),
$this->buildWhereClause($conn_r),
$this->buildOrderClause($conn_r),
$this->buildLimitClause($conn_r));
$logs = $table->loadAllFromArray($data);
return $logs;
}
protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
$where[] = $this->buildPagingClause($conn);
if ($this->channelIDs) {
$where[] = qsprintf(
$conn,
'id IN (%Ld)',
$this->channelIDs);
}
if ($this->channels) {
$where[] = qsprintf(
$conn,
'channelName IN (%Ls)',
$this->channels);
}
return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
return 'PhabricatorChatLogApplication';
}
}

View file

@ -1,84 +0,0 @@
<?php
final class PhabricatorChatLogQuery
extends PhabricatorCursorPagedPolicyAwareQuery {
private $channelIDs;
private $maximumEpoch;
public function withChannelIDs(array $channel_ids) {
$this->channelIDs = $channel_ids;
return $this;
}
public function withMaximumEpoch($epoch) {
$this->maximumEpoch = $epoch;
return $this;
}
protected function loadPage() {
$table = new PhabricatorChatLogEvent();
$conn_r = $table->establishConnection('r');
$data = queryfx_all(
$conn_r,
'SELECT * FROM %T e %Q %Q %Q',
$table->getTableName(),
$this->buildWhereClause($conn_r),
$this->buildOrderClause($conn_r),
$this->buildLimitClause($conn_r));
$logs = $table->loadAllFromArray($data);
return $logs;
}
protected function willFilterPage(array $events) {
$channel_ids = mpull($events, 'getChannelID', 'getChannelID');
$channels = id(new PhabricatorChatLogChannelQuery())
->setViewer($this->getViewer())
->withIDs($channel_ids)
->execute();
$channels = mpull($channels, null, 'getID');
foreach ($events as $key => $event) {
$channel = idx($channels, $event->getChannelID());
if (!$channel) {
unset($events[$key]);
continue;
}
$event->attachChannel($channel);
}
return $events;
}
protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
$where[] = $this->buildPagingClause($conn);
if ($this->maximumEpoch !== null) {
$where[] = qsprintf(
$conn,
'epoch <= %d',
$this->maximumEpoch);
}
if ($this->channelIDs !== null) {
$where[] = qsprintf(
$conn,
'channelID IN (%Ld)',
$this->channelIDs);
}
return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
return 'PhabricatorChatLogApplication';
}
}

View file

@ -1,51 +0,0 @@
<?php
final class PhabricatorChatLogChannel
extends PhabricatorChatLogDAO
implements PhabricatorPolicyInterface {
protected $serviceName;
protected $serviceType;
protected $channelName;
protected $viewPolicy;
protected $editPolicy;
protected function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'serviceName' => 'text64',
'serviceType' => 'text32',
'channelName' => 'text64',
),
self::CONFIG_KEY_SCHEMA => array(
'key_channel' => array(
'columns' => array('channelName', 'serviceType', 'serviceName'),
'unique' => true,
),
),
) + parent::getConfiguration();
}
public function getCapabilities() {
return array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
);
}
public function getPolicy($capability) {
switch ($capability) {
case PhabricatorPolicyCapability::CAN_VIEW:
return $this->viewPolicy;
break;
case PhabricatorPolicyCapability::CAN_EDIT:
return $this->editPolicy;
break;
}
}
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
return false;
}
}

View file

@ -1,9 +0,0 @@
<?php
abstract class PhabricatorChatLogDAO extends PhabricatorLiskDAO {
public function getApplicationName() {
return 'chatlog';
}
}

View file

@ -1,59 +0,0 @@
<?php
final class PhabricatorChatLogEvent
extends PhabricatorChatLogDAO
implements PhabricatorPolicyInterface {
protected $channelID;
protected $epoch;
protected $author;
protected $type;
protected $message;
protected $loggedByPHID;
private $channel = self::ATTACHABLE;
protected function getConfiguration() {
return array(
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'author' => 'text64',
'type' => 'text4',
'message' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'channel' => array(
'columns' => array('epoch'),
),
),
) + parent::getConfiguration();
}
public function attachChannel(PhabricatorChatLogChannel $channel) {
$this->channel = $channel;
return $this;
}
public function getChannel() {
return $this->assertAttached($this->channel);
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */
public function getCapabilities() {
return array(
PhabricatorPolicyCapability::CAN_VIEW,
);
}
public function getPolicy($capability) {
return $this->getChannel()->getPolicy($capability);
}
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
return $this->getChannel()->hasAutomaticCapability($capability, $viewer);
}
}

View file

@ -74,7 +74,8 @@ final class PhabricatorAuthSetupCheck extends PhabricatorSetupCheck {
->addRelatedPhabricatorConfig('auth.lock-config') ->addRelatedPhabricatorConfig('auth.lock-config')
->addCommand( ->addCommand(
hsprintf( hsprintf(
'<tt>phabricator/ $</tt> ./bin/auth lock')); '<tt>%s $</tt>./bin/auth lock',
PlatformSymbols::getPlatformServerPath()));
} }
} }
} }

View file

@ -96,9 +96,8 @@ final class PhabricatorBaseURISetupCheck extends PhabricatorSetupCheck {
->setMessage($message) ->setMessage($message)
->addCommand( ->addCommand(
hsprintf( hsprintf(
'<tt>$</tt> %s', '<tt>%s $</tt>./bin/config set phabricator.base-uri %s',
csprintf( PlatformSymbols::getPlatformServerPath(),
'./bin/config set phabricator.base-uri %s', $base_uri_guess));
$base_uri_guess)));
} }
} }

View file

@ -49,7 +49,10 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck {
->setName(pht('Daemons Are Not Running')) ->setName(pht('Daemons Are Not Running'))
->setSummary($summary) ->setSummary($summary)
->setMessage($message) ->setMessage($message)
->addCommand('$ ./bin/phd start'); ->addCommand(
hsprintf(
'<tt>%s $</tt>./bin/phd start',
PlatformSymbols::getPlatformServerPath()));
} }
$expect_user = PhabricatorEnv::getEnvConfig('phd.user'); $expect_user = PhabricatorEnv::getEnvConfig('phd.user');
@ -90,7 +93,10 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck {
->setSummary($summary) ->setSummary($summary)
->setMessage($message) ->setMessage($message)
->addPhabricatorConfig('phd.user') ->addPhabricatorConfig('phd.user')
->addCommand('$ ./bin/phd restart'); ->addCommand(
hsprintf(
'<tt>%s $</tt>./bin/phd restart',
PlatformSymbols::getPlatformServerPath()));
break; break;
} }

View file

@ -35,11 +35,13 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck {
->addPhabricatorConfig('mysql.port') ->addPhabricatorConfig('mysql.port')
->addCommand( ->addCommand(
hsprintf( hsprintf(
'<tt>$</tt> ./bin/config set mysql.host %s', '<tt>%s $</tt>./bin/config set mysql.host %s',
PlatformSymbols::getPlatformServerPath(),
$host)) $host))
->addCommand( ->addCommand(
hsprintf( hsprintf(
'<tt>$</tt> ./bin/config set mysql.port %s', '<tt>%s $</tt>./bin/config set mysql.port %s',
PlatformSymbols::getPlatformServerPath(),
$port)); $port));
} }
@ -134,7 +136,10 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck {
->setName(pht('Setup MySQL Schema')) ->setName(pht('Setup MySQL Schema'))
->setMessage($message) ->setMessage($message)
->setIsFatal(true) ->setIsFatal(true)
->addCommand(hsprintf('<tt>$</tt> ./bin/storage upgrade')); ->addCommand(
hsprintf(
'<tt>%s $</tt>./bin/storage upgrade',
PlatformSymbols::getPlatformServerPath()));
return true; return true;
} }
@ -160,7 +165,9 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck {
->setIsFatal(true) ->setIsFatal(true)
->setMessage($message) ->setMessage($message)
->addCommand( ->addCommand(
hsprintf('<tt>$</tt> ./bin/storage upgrade')); hsprintf(
'<tt>%s $</tt>./bin/storage upgrade',
PlatformSymbols::getPlatformServerPath()));
return true; return true;
} }

View file

@ -60,7 +60,10 @@ final class PhabricatorElasticsearchSetupCheck extends PhabricatorSetupCheck {
$this $this
->newIssue('elastic.missing-index') ->newIssue('elastic.missing-index')
->setName(pht('Elasticsearch Index Not Found')) ->setName(pht('Elasticsearch Index Not Found'))
->addCommand('./bin/search init') ->addCommand(
hsprintf(
'<tt>%s $</tt>./bin/search init',
PlatformSymbols::getPlatformServerPath()))
->setSummary($summary) ->setSummary($summary)
->setMessage($message); ->setMessage($message);
@ -76,7 +79,10 @@ final class PhabricatorElasticsearchSetupCheck extends PhabricatorSetupCheck {
$this $this
->newIssue('elastic.broken-index') ->newIssue('elastic.broken-index')
->setName(pht('Elasticsearch Index Schema Mismatch')) ->setName(pht('Elasticsearch Index Schema Mismatch'))
->addCommand('./bin/search init') ->addCommand(
hsprintf(
'<tt>%s $</tt>./bin/search init',
PlatformSymbols::getPlatformServerPath()))
->setSummary($summary) ->setSummary($summary)
->setMessage($message); ->setMessage($message);
} }

View file

@ -76,7 +76,10 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
$issue->setMessage($message); $issue->setMessage($message);
if ($found_local) { if ($found_local) {
$command = csprintf('$ ./bin/config delete %s', $key); $command = hsprintf(
'<tt>%s $</tt>./bin/config delete %s',
PlatformSymbols::getPlatformServerPath(),
$key);
$issue->addCommand($command); $issue->addCommand($command);
} }
@ -166,9 +169,12 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
'target' => '_blank', 'target' => '_blank',
), ),
$doc_name)); $doc_name));
$command = csprintf( $command = hsprintf(
'$ ./bin/config delete --database %R', '<tt>%s $</tt>%s',
$key); PlatformSymbols::getPlatformServerPath(),
csprintf(
'./bin/config delete --database %R',
$key));
$this->newIssue('config.locked.'.$key) $this->newIssue('config.locked.'.$key)
->setShortName(pht('Deprecated Config Source')) ->setShortName(pht('Deprecated Config Source'))

View file

@ -23,7 +23,7 @@ final class PhabricatorWebServerSetupCheck extends PhabricatorSetupCheck {
} }
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
if (!strlen($base_uri)) { if (!$base_uri) {
// If `phabricator.base-uri` is not set then we can't really do // If `phabricator.base-uri` is not set then we can't really do
// anything. // anything.
return; return;

View file

@ -0,0 +1,81 @@
<?php
final class PhorgeCodeWarningSetupCheck extends PhabricatorSetupCheck {
public function getExecutionOrder() {
return 2000;
}
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() {
$warnings = (new PhorgeSystemDeprecationWarningListener())->getWarnings();
if (!$warnings) {
return;
}
$link = phutil_tag(
'a',
array('href' => 'https://we.phorge.it/w/docs/report-warnings/'),
pht('%s\'s home page', PlatformSymbols::getPlatformServerName()));
$message = pht(
'There is some deprecated code found in the %s code-base.'.
"\n\n".
"This isn't a problem yet, but it means that %s might stop working if ".
'you upgrade PHP version.'.
"\n\n".
'This page records a sample of the cases since last server restart. '.
"\n\n".
'To solve this issue, either:'.
"\n\n".
'- Visit %s, file bug report with the information below, or'.
"\n".
'- Ignore this issue using the `Ignore` button below.'.
"\n\n",
PlatformSymbols::getPlatformServerName(),
PlatformSymbols::getPlatformServerName(),
$link);
$message = array($message);
$message[] = pht('PHP version: %s', phpversion());
$message[] = "\n\n";
$message[] = pht('Recorded items (sample):');
$list = array();
$warnings = array_reverse(isort($warnings, 'counter'));
foreach ($warnings as $key => $data) {
$summary = pht(
'%s, occurrences: %s',
$key,
$data['counter']);
$trace = phutil_tag('tt', array(),
array($data['message'] , "\n", $data['trace']));
$list[] = phutil_tag(
'li',
array(),
phutil_tag(
'details',
array(),
array(
phutil_tag('summary', array(), $summary),
$trace,
)));
}
$message[] = phutil_tag('ul', array(), $list);
$this->newIssue('deprecations')
->setName(pht('Deprecated Code'))
->setMessage($message)
->setSummary(pht('There is some deprecated code found in the code-base.'))
->addLink(
'https://we.phorge.it/w/docs/report-warnings/',
'More Details on the website');
}
}

View file

@ -77,7 +77,7 @@ final class PhabricatorConfigOption
'This configuration is locked and can not be edited from the web '. 'This configuration is locked and can not be edited from the web '.
'interface. Use %s in %s to edit it.', 'interface. Use %s in %s to edit it.',
phutil_tag('tt', array(), './bin/config'), phutil_tag('tt', array(), './bin/config'),
phutil_tag('tt', array(), 'phabricator/')); phutil_tag('tt', array(), PlatformSymbols::getPlatformServerPath()));
} }
public function addExample($value, $description) { public function addExample($value, $description) {

View file

@ -83,11 +83,11 @@ final class PhabricatorSetupIssueView extends AphrontView {
// TODO: We should do a better job of detecting how to install extensions // TODO: We should do a better job of detecting how to install extensions
// on the current system. // on the current system.
$install_commands = hsprintf( $install_commands = hsprintf(
"\$ sudo apt-get install php-<em>extname</em> ". "<tt>$</tt>sudo apt-get install php-<em>extname</em> ".
"# Debian / Ubuntu\n". "# Debian / Ubuntu\n".
"\$ sudo dnf install php-<em>extname</em> ". "<tt>$</tt>sudo dnf install php-<em>extname</em> ".
"# Red Hat / Derivatives\n". "# Red Hat / Derivatives\n".
"\$ sudo yum install php-<em>extname</em> ". "<tt>$</tt>sudo yum install php-<em>extname</em> ".
"# Older Red Hat versions"); "# Older Red Hat versions");
$fallback_info = pht( $fallback_info = pht(
@ -286,7 +286,8 @@ final class PhabricatorSetupIssueView extends AphrontView {
$update = array(); $update = array();
foreach ($configs as $key) { foreach ($configs as $key) {
$update[] = hsprintf( $update[] = hsprintf(
'<tt>$</tt> ./bin/config set %s <em>value</em>', '<tt>%s $</tt>./bin/config set %s <em>value</em>',
PlatformSymbols::getPlatformServerPath(),
$key); $key);
} }
$update = phutil_tag('pre', array(), phutil_implode_html("\n", $update)); $update = phutil_tag('pre', array(), phutil_implode_html("\n", $update));
@ -603,14 +604,14 @@ final class PhabricatorSetupIssueView extends AphrontView {
} }
private function renderRestartLink() { private function renderRestartLink() {
$doc_href = PhabricatorEnv::getDoclink('Restarting Phabricator'); $doc_href = PhabricatorEnv::getDoclink('Restarting Phorge');
return phutil_tag( return phutil_tag(
'a', 'a',
array( array(
'href' => $doc_href, 'href' => $doc_href,
'target' => '_blank', 'target' => '_blank',
), ),
pht('Restarting Phabricator')); pht('Restarting'));
} }
} }

View file

@ -28,6 +28,10 @@ final class PhabricatorConpherenceApplication extends PhabricatorApplication {
); );
} }
public function getMonograms() {
return array('Z');
}
public function getRoutes() { public function getRoutes() {
return array( return array(
'/Z(?P<id>[1-9]\d*)' '/Z(?P<id>[1-9]\d*)'

View file

@ -328,7 +328,12 @@ final class ConpherenceUpdateController
->executeOne(); ->executeOne();
$non_update = false; $non_update = false;
$participant = $conpherence->getParticipant($user->getPHID());
// The User is always available. The Participant may not. See:
// User: it's you, lurking the Chat (maybe it's a public chat).
// Participant: it's you, if you are a Chat Member.
// https://we.phorge.it/T15497
$participant = $conpherence->getParticipantIfExists($user->getPHID());
if ($need_transactions && $conpherence->getTransactions()) { if ($need_transactions && $conpherence->getTransactions()) {
$data = ConpherenceTransactionRenderer::renderTransactions( $data = ConpherenceTransactionRenderer::renderTransactions(
@ -336,7 +341,7 @@ final class ConpherenceUpdateController
$conpherence); $conpherence);
$key = PhabricatorConpherenceColumnMinimizeSetting::SETTINGKEY; $key = PhabricatorConpherenceColumnMinimizeSetting::SETTINGKEY;
$minimized = $user->getUserSetting($key); $minimized = $user->getUserSetting($key);
if (!$minimized) { if (!$minimized && $participant) {
$participant->markUpToDate($conpherence); $participant->markUpToDate($conpherence);
} }
} else if ($need_transactions) { } else if ($need_transactions) {

View file

@ -44,6 +44,7 @@ final class DarkConsoleErrorLogPluginAPI extends Phobject {
'trace' => $metadata['trace'], 'trace' => $metadata['trace'],
); );
break; break;
case PhutilErrorHandler::DEPRECATED:
case PhutilErrorHandler::ERROR: case PhutilErrorHandler::ERROR:
// $value is a simple string // $value is a simple string
self::$errors[] = array( self::$errors[] = array(

View file

@ -36,6 +36,10 @@ final class PhabricatorCountdownApplication extends PhabricatorApplication {
); );
} }
public function getMonograms() {
return array('C');
}
public function getRoutes() { public function getRoutes() {
return array( return array(
'/C(?P<id>[1-9]\d*)' => 'PhabricatorCountdownViewController', '/C(?P<id>[1-9]\d*)' => 'PhabricatorCountdownViewController',

View file

@ -171,7 +171,8 @@ final class PhabricatorDaemonLogViewController
phutil_tag( phutil_tag(
'tt', 'tt',
array(), array(),
"phabricator/ $ ./bin/phd log --id {$id}")); PlatformSymbols::getPlatformServerPath().
" $ ./bin/phd log --id {$id}"));
return $view; return $view;

View file

@ -30,6 +30,10 @@ final class PhabricatorDashboardApplication extends PhabricatorApplication {
return 0.160; return 0.160;
} }
public function getMonograms() {
return array('W');
}
public function getRoutes() { public function getRoutes() {
$menu_rules = $this->getProfileMenuRouting( $menu_rules = $this->getProfileMenuRouting(
'PhabricatorDashboardPortalViewController'); 'PhabricatorDashboardPortalViewController');

View file

@ -32,7 +32,7 @@ final class PhabricatorDashboardAdjustController
$panel_ref = null; $panel_ref = null;
$panel_key = $request->getStr('panelKey'); $panel_key = $request->getStr('panelKey');
if (strlen($panel_key)) { if ($panel_key !== null && strlen($panel_key)) {
$panel_ref = $ref_list->getPanelRef($panel_key); $panel_ref = $ref_list->getPanelRef($panel_key);
if (!$panel_ref) { if (!$panel_ref) {
return new Aphront404Response(); return new Aphront404Response();

View file

@ -41,12 +41,12 @@ final class PhabricatorDashboardPanelTabsController
$op = $request->getURIData('op'); $op = $request->getURIData('op');
$after = $request->getStr('after'); $after = $request->getStr('after');
if (!strlen($after)) { if ($after === '') {
$after = null; $after = null;
} }
$target = $request->getStr('target'); $target = $request->getStr('target');
if (!strlen($target)) { if ($target === '') {
$target = null; $target = null;
} }

View file

@ -155,6 +155,7 @@ final class PhabricatorDashboardPanelRenderingEngine extends Phobject {
return $this->renderNormalPanel(); return $this->renderNormalPanel();
} catch (Exception $ex) { } catch (Exception $ex) {
phlog($ex);
return $this->renderErrorPanel( return $this->renderErrorPanel(
$panel->getName(), $panel->getName(),
pht( pht(

View file

@ -85,10 +85,12 @@ final class PhabricatorDashboardTabsPanelType
$rename_uri = id(new PhutilURI($rename_uri)) $rename_uri = id(new PhutilURI($rename_uri))
->replaceQueryParam('contextPHID', $context_phid); ->replaceQueryParam('contextPHID', $context_phid);
$selected = 0;
$key_list = array_keys($config); $key_list = array_keys($config);
// In the future we may persist which panel was selected.
// At the moment we have always selected the first one.
$selected = (string)head($key_list);
$next_keys = array(); $next_keys = array();
$prev_keys = array(); $prev_keys = array();
for ($ii = 0; $ii < count($key_list); $ii++) { for ($ii = 0; $ii < count($key_list); $ii++) {
@ -100,7 +102,7 @@ final class PhabricatorDashboardTabsPanelType
$panel_id = idx($tab_spec, 'panelID'); $panel_id = idx($tab_spec, 'panelID');
$subpanel = idx($panels, $panel_id); $subpanel = idx($panels, $panel_id);
$name = idx($tab_spec, 'name'); $name = coalesce(idx($tab_spec, 'name'), '');
if (!strlen($name)) { if (!strlen($name)) {
if ($subpanel) { if ($subpanel) {
$name = $subpanel->getName(); $name = $subpanel->getName();
@ -111,7 +113,8 @@ final class PhabricatorDashboardTabsPanelType
$name = pht('Unnamed Tab'); $name = pht('Unnamed Tab');
} }
$is_selected = (string)$idx === (string)$selected; // The $idx can be something like "0", "1" or "asdasd98".
$is_selected = (string)$idx === $selected;
$tab_view = id(new PHUIListItemView()) $tab_view = id(new PHUIListItemView())
->setHref('#') ->setHref('#')
@ -282,7 +285,8 @@ final class PhabricatorDashboardTabsPanelType
$panel_content = pht('(Invalid Panel)'); $panel_content = pht('(Invalid Panel)');
} }
$is_selected = (string)$idx === (string)$selected; // Note that $idx can be something like "0", "1" or "asdasd98".
$is_selected = (string)$idx === $selected;
$content_id = celerity_generate_unique_node_id(); $content_id = celerity_generate_unique_node_id();

View file

@ -42,6 +42,10 @@ final class PhabricatorDifferentialApplication
'engineers to review, discuss and approve changes to software.'); 'engineers to review, discuss and approve changes to software.');
} }
public function getMonograms() {
return array('D');
}
public function getRoutes() { public function getRoutes() {
return array( return array(
'/D(?P<id>[1-9]\d*)' => array( '/D(?P<id>[1-9]\d*)' => array(

View file

@ -325,14 +325,16 @@ final class DifferentialChangeset
public function getOldStatePathVector() { public function getOldStatePathVector() {
$path = $this->getOldFile(); $path = $this->getOldFile();
if (!strlen($path)) { if (!phutil_nonempty_string($path)) {
$path = $this->getFilename(); $path = $this->getFilename();
} }
$path = trim($path, '/'); if (!phutil_nonempty_string($path)) {
$path = explode('/', $path); return null;
}
return $path; $path = trim($path, '/');
return explode('/', $path);
} }
public function getNewStatePathVector() { public function getNewStatePathVector() {

View file

@ -0,0 +1,16 @@
<?php
final class DifferentialChangesetTestCase extends PhabricatorTestCase {
public function testPhp81() {
$diff_change_set = new DifferentialChangeset();
try {
$old_state_vector = $diff_change_set->getOldStatePathVector();
$this->assertTrue(true, 'getOldStatePathVector did not throw an error');
} catch (Throwable $ex) {
$this->assertTrue(false,
'getOldStatePathVector threw an exception:'.$ex->getMessage());
}
}
}

View file

@ -44,6 +44,11 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
); );
} }
public function getMonograms() {
// This is a special case, as r and R mean different things.
return array('r', 'R');
}
public function getRoutes() { public function getRoutes() {
$repository_routes = array( $repository_routes = array(
'/' => array( '/' => array(
@ -183,6 +188,9 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
DiffusionCreateRepositoriesCapability::CAPABILITY => array( DiffusionCreateRepositoriesCapability::CAPABILITY => array(
'default' => PhabricatorPolicies::POLICY_ADMIN, 'default' => PhabricatorPolicies::POLICY_ADMIN,
), ),
PhabricatorRepositoryIdentityEditViewCapability::CAPABILITY => array(
'default' => PhabricatorPolicies::POLICY_USER,
),
); );
} }

View file

@ -23,6 +23,7 @@ final class DiffusionDiffQueryConduitAPIMethod
return array( return array(
'path' => 'required string', 'path' => 'required string',
'commit' => 'optional string', 'commit' => 'optional string',
'encoding' => 'optional string',
); );
} }
@ -152,7 +153,7 @@ final class DiffusionDiffQueryConduitAPIMethod
$arcanist_changes = DiffusionPathChange::convertToArcanistChanges( $arcanist_changes = DiffusionPathChange::convertToArcanistChanges(
$path_changes); $path_changes);
$parser = $this->getDefaultParser(); $parser = $this->getDefaultParser($request);
$parser->setChanges($arcanist_changes); $parser->setChanges($arcanist_changes);
$parser->forcePath($path->getPath()); $parser->forcePath($path->getPath());
$changes = $parser->parseDiff($raw_diff); $changes = $parser->parseDiff($raw_diff);
@ -212,18 +213,20 @@ final class DiffusionDiffQueryConduitAPIMethod
return $this->getEmptyResult(); return $this->getEmptyResult();
} }
$parser = $this->getDefaultParser(); $parser = $this->getDefaultParser($request);
$changes = $parser->parseDiff($raw_diff); $changes = $parser->parseDiff($raw_diff);
return $changes; return $changes;
} }
private function getDefaultParser() { private function getDefaultParser(ConduitAPIRequest $request) {
$drequest = $this->getDiffusionRequest(); $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();
$parser = new ArcanistDiffParser(); $parser = new ArcanistDiffParser();
$try_encoding = $repository->getDetail('encoding'); $try_encoding = coalesce(
$request->getValue('encoding'),
$repository->getDetail('encoding'));
if ($try_encoding) { if ($try_encoding) {
$parser->setTryEncoding($try_encoding); $parser->setTryEncoding($try_encoding);
} }

View file

@ -198,6 +198,10 @@ final class DiffusionBlameController extends DiffusionController {
$map[$identifier] = $data; $map[$identifier] = $data;
} }
if (empty($epochs)) {
$epochs[] = 0;
}
$epoch_min = min($epochs); $epoch_min = min($epochs);
$epoch_max = max($epochs); $epoch_max = max($epochs);

View file

@ -49,8 +49,6 @@ final class DiffusionCloneController extends DiffusionController {
->appendChild(pht('Repository has no URIs set.')); ->appendChild(pht('Repository has no URIs set.'));
} }
$info = null;
// Try to load alternatives. This may fail for repositories which have not // Try to load alternatives. This may fail for repositories which have not
// cloned yet. If it does, just ignore it and continue. // cloned yet. If it does, just ignore it and continue.
try { try {

View file

@ -48,6 +48,7 @@ final class DiffusionDiffController extends DiffusionController {
array( array(
'commit' => $drequest->getCommit(), 'commit' => $drequest->getCommit(),
'path' => $drequest->getPath(), 'path' => $drequest->getPath(),
'encoding' => $request->getStr('encoding'),
)); ));
$drequest->updateSymbolicCommit($data['effectiveCommit']); $drequest->updateSymbolicCommit($data['effectiveCommit']);
$raw_changes = ArcanistDiffChange::newFromConduit($data['changes']); $raw_changes = ArcanistDiffChange::newFromConduit($data['changes']);

View file

@ -508,7 +508,7 @@ final class DiffusionRepositoryController extends DiffusionController {
$repository_name = $repository->getName(); $repository_name = $repository->getName();
$branch_name = $drequest->getBranch(); $branch_name = $drequest->getBranch();
if (strlen($branch_name)) { if (phutil_nonempty_string($branch_name)) {
$repository_name .= ' ('.$branch_name.')'; $repository_name .= ' ('.$branch_name.')';
} }

View file

@ -28,7 +28,8 @@ final class DiffusionRepositoryEditDeleteController
'the command line:')) 'the command line:'))
->appendCommand( ->appendCommand(
csprintf( csprintf(
'phabricator/ $ ./bin/remove destroy %R', '%s $ ./bin/remove destroy %R',
PlatformSymbols::getPlatformServerPath(),
$repository->getMonogram())) $repository->getMonogram()))
->appendParagraph( ->appendParagraph(
pht( pht(

View file

@ -878,12 +878,31 @@ final class DiffusionServeController extends DiffusionController {
} }
$args_raw[] = $_SERVER[$header]; $args_raw[] = $_SERVER[$header];
} }
$args_raw = implode('', $args_raw);
if ($args_raw) {
$args_raw = implode('', $args_raw);
return id(new PhutilQueryStringParser()) return id(new PhutilQueryStringParser())
->parseQueryString($args_raw); ->parseQueryString($args_raw);
} }
// Sometimes arguments come in via the query string. Note that this will
// not handle multi-value entries e.g. "a[]=1,a[]=2" however it's unclear
// whether or how the mercurial protocol should handle this.
$query = idx($_SERVER, 'QUERY_STRING', '');
$query_pairs = id(new PhutilQueryStringParser())
->parseQueryString($query);
foreach ($query_pairs as $key => $value) {
// Filter out private/internal keys as well as the command itself.
if (strncmp($key, '__', 2) && $key != 'cmd') {
$args_raw[$key] = $value;
}
}
// TODO: Arguments can also come in via request body for POST requests. The
// body would be all arguments, url-encoded.
return $args_raw;
}
private function formatMercurialArguments($command, array $arguments) { private function formatMercurialArguments($command, array $arguments) {
$spec = DiffusionMercurialWireProtocol::getCommandArgs($command); $spec = DiffusionMercurialWireProtocol::getCommandArgs($command);

View file

@ -131,6 +131,8 @@ final class DiffusionCommitRef extends Phobject {
} }
private function formatUser($name, $email) { private function formatUser($name, $email) {
$name = coalesce($name, '');
$email = coalesce($email, '');
if (strlen($name) && strlen($email)) { if (strlen($name) && strlen($email)) {
return "{$name} <{$email}>"; return "{$name} <{$email}>";
} else if (strlen($email)) { } else if (strlen($email)) {

View file

@ -27,7 +27,7 @@ final class DiffusionLowLevelGitRefQuery extends DiffusionLowLevelQuery {
$with_branches = isset($ref_types[$type_branch]); $with_branches = isset($ref_types[$type_branch]);
$with_tags = isset($ref_types[$type_tag]); $with_tags = isset($ref_types[$type_tag]);
$with_refs = isset($refs_types[$type_ref]); $with_refs = isset($ref_types[$type_ref]);
$repository = $this->getRepository(); $repository = $this->getRepository();

View file

@ -140,8 +140,9 @@ final class DiffusionLowLevelResolveRefsQuery
if (count($lines) !== count($unresolved)) { if (count($lines) !== count($unresolved)) {
throw new Exception( throw new Exception(
pht( pht(
'Unexpected line count from `%s`!', 'Unexpected line count from `%s` in %s!',
'git cat-file')); 'git cat-file',
$repository->getMonogram()));
} }
$hits = array(); $hits = array();
@ -153,8 +154,9 @@ final class DiffusionLowLevelResolveRefsQuery
if (count($parts) < 2) { if (count($parts) < 2) {
throw new Exception( throw new Exception(
pht( pht(
'Failed to parse `%s` output: %s', 'Failed to parse `%s` output in %s: %s',
'git cat-file', 'git cat-file',
$repository->getMonogram(),
$line)); $line));
} }
list($identifier, $type) = $parts; list($identifier, $type) = $parts;
@ -177,8 +179,9 @@ final class DiffusionLowLevelResolveRefsQuery
default: default:
throw new Exception( throw new Exception(
pht( pht(
'Unexpected object type from `%s`: %s', 'Unexpected object type from `%s` in %s: %s',
'git cat-file', 'git cat-file',
$repository->getMonogram(),
$line)); $line));
} }

View file

@ -3,6 +3,9 @@
final class DiffusionMercurialRequest extends DiffusionRequest { final class DiffusionMercurialRequest extends DiffusionRequest {
protected function isStableCommit($symbol) { protected function isStableCommit($symbol) {
if ($symbol === null) {
return false;
}
return preg_match('/^[a-f0-9]{40}\z/', $symbol); return preg_match('/^[a-f0-9]{40}\z/', $symbol);
} }
@ -10,11 +13,9 @@ final class DiffusionMercurialRequest extends DiffusionRequest {
if ($this->branch) { if ($this->branch) {
return $this->branch; return $this->branch;
} }
if ($this->repository) { if ($this->repository) {
return $this->repository->getDefaultBranch(); return $this->repository->getDefaultBranch();
} }
throw new Exception(pht('Unable to determine branch!')); throw new Exception(pht('Unable to determine branch!'));
} }

View file

@ -3,6 +3,9 @@
final class DiffusionSvnRequest extends DiffusionRequest { final class DiffusionSvnRequest extends DiffusionRequest {
protected function isStableCommit($symbol) { protected function isStableCommit($symbol) {
if ($symbol === null) {
return false;
}
return preg_match('/^[1-9]\d*\z/', $symbol); return preg_match('/^[1-9]\d*\z/', $symbol);
} }

View file

@ -16,13 +16,16 @@ final class DiffusionRepositoryDatasource
} }
public function loadResults() { public function loadResults() {
$viewer = $this->getViewer();
$raw_query = $this->getRawQuery();
$query = id(new PhabricatorRepositoryQuery()) $query = id(new PhabricatorRepositoryQuery())
->setOrder('name') ->setViewer($this->getViewer());
->withDatasourceQuery($raw_query);
$repos = $this->executeQuery($query); $this->applyFerretConstraints(
$query,
id(new PhabricatorRepository())->newFerretEngine(),
'title',
$this->getRawQuery());
$repos = $query->execute();
$type_icon = id(new PhabricatorRepositoryRepositoryPHIDType()) $type_icon = id(new PhabricatorRepositoryRepositoryPHIDType())
->getTypeIcon(); ->getTypeIcon();

View file

@ -32,7 +32,7 @@ final class DivinerFindController extends DivinerController {
} }
$context = $request->getStr('context'); $context = $request->getStr('context');
if (strlen($context)) { if (phutil_nonempty_string($context)) {
$query->withContexts(array($context)); $query->withContexts(array($context));
} }

View file

@ -172,7 +172,7 @@ final class DivinerLiveSymbol extends DivinerDAO
public function getTitle() { public function getTitle() {
$title = parent::getTitle(); $title = parent::getTitle();
if (!strlen($title)) { if (!phutil_nonempty_string($title)) {
$title = $this->getName(); $title = $this->getName();
} }

View file

@ -348,7 +348,7 @@ final class DivinerGenerateWorkflow extends DivinerWorkflow {
$atomizers[$atomizer][] = $file; $atomizers[$atomizer][] = $file;
} }
$root = dirname(phutil_get_library_root('phabricator')); $root = dirname(phutil_get_library_root('phorge'));
$config_root = $this->getConfig('root'); $config_root = $this->getConfig('root');
$bar = id(new PhutilConsoleProgressBar()) $bar = id(new PhutilConsoleProgressBar())
@ -363,7 +363,6 @@ final class DivinerGenerateWorkflow extends DivinerWorkflow {
$this->getBookConfigPath(), $this->getBookConfigPath(),
$class, $class,
$chunk); $chunk);
$future->setCWD($config_root);
$futures[] = $future; $futures[] = $future;

View file

@ -67,6 +67,10 @@ final class PhabricatorFilesApplication extends PhabricatorApplication {
); );
} }
public function getMonograms() {
return array('F');
}
public function getRoutes() { public function getRoutes() {
return array( return array(
'/F(?P<id>[1-9]\d*)(?:\$(?P<lines>\d+(?:-\d+)?))?' '/F(?P<id>[1-9]\d*)(?:\$(?P<lines>\d+(?:-\d+)?))?'

View file

@ -134,9 +134,11 @@ final class PhabricatorFilesConfigOptions
->setDescription( ->setDescription(
pht( pht(
"Configure which uploaded file types may be viewed directly ". "Configure which uploaded file types may be viewed directly ".
"in the browser. Other file types will be downloaded instead ". "in the browser. Other types will be downloaded instead of ".
"of displayed. This is mainly a usability consideration, since ". "displayed. This is a usability and security consideration, ".
"browsers tend to freak out when viewing very large binary files.". "since browsers tend to freak out when viewing very large ".
"binary files, and some types may be vulnerable to XSS attacks ".
"when viewed in a browser.".
"\n\n". "\n\n".
"The keys in this map are viewable MIME types; the values are ". "The keys in this map are viewable MIME types; the values are ".
"the MIME types they are delivered as when they are viewed in ". "the MIME types they are delivered as when they are viewed in ".

View file

@ -14,14 +14,16 @@ final class PhabricatorPDFDocumentEngine
} }
protected function canRenderDocumentType(PhabricatorDocumentRef $ref) { protected function canRenderDocumentType(PhabricatorDocumentRef $ref) {
// Since we just render a link to the document anyway, we don't need to $viewable_types = PhabricatorEnv::getEnvConfig('files.viewable-mime-types');
// check anything fancy in config to see if the MIME type is actually $viewable_types = array_keys($viewable_types);
// viewable.
return $ref->hasAnyMimeType( $pdf_types = array(
array(
'application/pdf', 'application/pdf',
)); );
return
$ref->hasAnyMimeType($viewable_types) &&
$ref->hasAnyMimeType($pdf_types);
} }
protected function newDocumentContent(PhabricatorDocumentRef $ref) { protected function newDocumentContent(PhabricatorDocumentRef $ref) {

View file

@ -137,8 +137,12 @@ abstract class PhabricatorFileImageTransform extends PhabricatorFileTransform {
protected function newFileFromData($data) { protected function newFileFromData($data) {
if ($this->file) { if ($this->file) {
$name = $this->file->getName(); $name = $this->file->getName();
$inherit_properties = array(
'viewPolicy' => $this->file->getViewPolicy(),
);
} else { } else {
$name = 'default.png'; $name = 'default.png';
$inherit_properties = array();
} }
$defaults = array( $defaults = array(
@ -146,7 +150,7 @@ abstract class PhabricatorFileImageTransform extends PhabricatorFileTransform {
'name' => $this->getTransformKey().'-'.$name, 'name' => $this->getTransformKey().'-'.$name,
); );
$properties = $this->getFileProperties() + $defaults; $properties = $this->getFileProperties() + $inherit_properties + $defaults;
return PhabricatorFile::newFromFileData($data, $properties); return PhabricatorFile::newFromFileData($data, $properties);
} }

View file

@ -58,7 +58,7 @@ final class PhabricatorFileThumbnailTransform
public function generateTransforms() { public function generateTransforms() {
return array( return array(
id(new PhabricatorFileThumbnailTransform()) id(new PhabricatorFileThumbnailTransform())
->setName(pht("Profile (400px \xC3\x97 400px)")) ->setName(pht("Profile (400px \xC3\x97 400px) (Image will be Public)"))
->setKey(self::TRANSFORM_PROFILE) ->setKey(self::TRANSFORM_PROFILE)
->setDimensions(400, 400) ->setDimensions(400, 400)
->setScaleUp(true), ->setScaleUp(true),

View file

@ -50,13 +50,13 @@ final class PhabricatorFileAltTextTransaction
$old_value = $this->getOldValue(); $old_value = $this->getOldValue();
$new_value = $this->getNewValue(); $new_value = $this->getNewValue();
if (!strlen($old_value)) { if (!phutil_nonempty_string($old_value)) {
return pht( return pht(
'%s set the alternate text for %s to %s.', '%s set the alternate text for %s to %s.',
$this->renderAuthor(), $this->renderAuthor(),
$this->renderObject(), $this->renderObject(),
$this->renderNewValue()); $this->renderNewValue());
} else if (!strlen($new_value)) { } else if (!phutil_nonempty_string($new_value)) {
return pht( return pht(
'%s removed the alternate text for %s (was %s).', '%s removed the alternate text for %s (was %s).',
$this->renderAuthor(), $this->renderAuthor(),

View file

@ -36,6 +36,10 @@ final class PhabricatorFundApplication extends PhabricatorApplication {
); );
} }
public function getMonograms() {
return array('I');
}
public function getRoutes() { public function getRoutes() {
return array( return array(
'/I(?P<id>[1-9]\d*)' => 'FundInitiativeViewController', '/I(?P<id>[1-9]\d*)' => 'FundInitiativeViewController',

View file

@ -51,6 +51,10 @@ final class PhabricatorHarbormasterApplication extends PhabricatorApplication {
); );
} }
public function getMonograms() {
return array('B');
}
public function getRoutes() { public function getRoutes() {
return array( return array(
'/B(?P<id>[1-9]\d*)' => 'HarbormasterBuildableViewController', '/B(?P<id>[1-9]\d*)' => 'HarbormasterBuildableViewController',

View file

@ -139,7 +139,7 @@ final class HarbormasterStepEditController
->setUser($viewer); ->setUser($viewer);
$instructions = $implementation->getEditInstructions(); $instructions = $implementation->getEditInstructions();
if (strlen($instructions)) { if (phutil_nonempty_string($instructions)) {
$form->appendRemarkupInstructions($instructions); $form->appendRemarkupInstructions($instructions);
} }

View file

@ -103,7 +103,7 @@ final class HarbormasterBuildPlanEditEngine
$key); $key);
$behavior_option = $object->getPlanProperty($storage_key); $behavior_option = $object->getPlanProperty($storage_key);
if (!strlen($behavior_option)) { if (!phutil_nonempty_string($behavior_option)) {
$behavior_option = $behavior->getPlanOption($object)->getKey(); $behavior_option = $behavior->getPlanOption($object)->getKey();
} }

View file

@ -49,6 +49,10 @@ final class PhabricatorHeraldApplication extends PhabricatorApplication {
); );
} }
public function getMonograms() {
return array('H');
}
public function getRoutes() { public function getRoutes() {
return array( return array(
'/H(?P<id>[1-9]\d*)' => 'HeraldRuleViewController', '/H(?P<id>[1-9]\d*)' => 'HeraldRuleViewController',

View file

@ -48,6 +48,10 @@ final class PhabricatorLegalpadApplication extends PhabricatorApplication {
'open source projects keep track of Contributor License Agreements.'); 'open source projects keep track of Contributor License Agreements.');
} }
public function getMonograms() {
return array('L');
}
public function getRoutes() { public function getRoutes() {
return array( return array(
'/L(?P<id>\d+)' => 'LegalpadDocumentSignController', '/L(?P<id>\d+)' => 'LegalpadDocumentSignController',

View file

@ -273,7 +273,7 @@ final class PhabricatorMemeEngine extends Phobject {
$size = $metrics['size']; $size = $metrics['size'];
$above = $this->getAboveText(); $above = $this->getAboveText();
if (strlen($above)) { if ($above !== null && phutil_nonempty_string(trim($above))) {
$x = (int)floor(($dx - $metrics['text']['above']['width']) / 2); $x = (int)floor(($dx - $metrics['text']['above']['width']) / 2);
$y = $metrics['text']['above']['height'] + 12; $y = $metrics['text']['above']['height'] + 12;
@ -281,7 +281,7 @@ final class PhabricatorMemeEngine extends Phobject {
} }
$below = $this->getBelowText(); $below = $this->getBelowText();
if (strlen($below)) { if ($below !== null && phutil_nonempty_string(trim($below))) {
$x = (int)floor(($dx - $metrics['text']['below']['width']) / 2); $x = (int)floor(($dx - $metrics['text']['below']['width']) / 2);
$y = $dy - 12 - $metrics['text']['below']['descend']; $y = $dy - 12 - $metrics['text']['below']['descend'];

View file

@ -42,6 +42,10 @@ final class PhabricatorManiphestApplication extends PhabricatorApplication {
); );
} }
public function getMonograms() {
return array('T');
}
public function getRoutes() { public function getRoutes() {
return array( return array(
'/T(?P<id>[1-9]\d*)' => 'ManiphestTaskDetailController', '/T(?P<id>[1-9]\d*)' => 'ManiphestTaskDetailController',

View file

@ -1036,7 +1036,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
$parts[] = null; $parts[] = null;
} }
if (!strlen($parts[1])) { if (!phutil_nonempty_string($parts[1])) {
$parts[1] = null; $parts[1] = null;
} }

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