Page MenuHomestyx hydra

No OneTemporary

diff --git a/scripts/sql/manage_storage.php b/scripts/sql/manage_storage.php
index f4d8d0f947..32c3bd3f12 100755
--- a/scripts/sql/manage_storage.php
+++ b/scripts/sql/manage_storage.php
@@ -1,171 +1,171 @@
#!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('manage Phabricator storage and schemata');
$args->setSynopsis(<<<EOHELP
**storage** __workflow__ [__options__]
Manage Phabricator database storage and schema versioning.
**storage** upgrade
Initialize or upgrade Phabricator storage.
**storage** upgrade --user __root__ --password __hunter2__
Use administrative credentials for schema changes.
EOHELP
);
$args->parseStandardArguments();
$conf = PhabricatorEnv::newObjectFromConfig(
'mysql.configuration-provider',
array($dao = null, 'w'));
$default_user = $conf->getUser();
$default_host = $conf->getHost();
$default_port = $conf->getPort();
$default_namespace = PhabricatorLiskDAO::getDefaultStorageNamespace();
try {
$args->parsePartial(
array(
array(
'name' => 'force',
'short' => 'f',
'help' => 'Do not prompt before performing dangerous operations.',
),
array(
'name' => 'user',
'short' => 'u',
'param' => 'username',
'default' => $default_user,
'help' => "Connect with __username__ instead of the configured ".
"default ('{$default_user}').",
),
array(
'name' => 'password',
'short' => 'p',
'param' => 'password',
'help' => 'Use __password__ instead of the configured default.',
),
array(
'name' => 'namespace',
'param' => 'name',
'default' => $default_namespace,
'help' => "Use namespace __namespace__ instead of the configured ".
"default ('{$default_namespace}'). This is an advanced ".
"feature used by unit tests; you should not normally ".
"use this flag.",
),
array(
'name' => 'dryrun',
'help' => 'Do not actually change anything, just show what would be '.
'changed.',
),
array(
'name' => 'disable-utf8mb4',
'help' => pht(
'Disable utf8mb4, even if the database supports it. This is an '.
'advanced feature used for testing changes to Phabricator; you '.
'should not normally use this flag.'),
- )
+ ),
));
} catch (PhutilArgumentUsageException $ex) {
$args->printUsageException($ex);
exit(77);
}
// First, test that the Phabricator configuration is set up correctly. After
// we know this works we'll test any administrative credentials specifically.
$test_api = new PhabricatorStorageManagementAPI();
$test_api->setUser($default_user);
$test_api->setHost($default_host);
$test_api->setPort($default_port);
$test_api->setPassword($conf->getPassword());
$test_api->setNamespace($args->getArg('namespace'));
try {
queryfx(
$test_api->getConn(null),
'SELECT 1');
} catch (AphrontQueryException $ex) {
$message = phutil_console_format(
pht(
"**MySQL Credentials Not Configured**\n\n".
"Unable to connect to MySQL using the configured credentials. ".
"You must configure standard credentials before you can upgrade ".
"storage. Run these commands to set up credentials:\n".
"\n".
" phabricator/ $ ./bin/config set mysql.host __host__\n".
" phabricator/ $ ./bin/config set mysql.user __username__\n".
" phabricator/ $ ./bin/config set mysql.pass __password__\n".
"\n".
"These standard credentials are separate from any administrative ".
"credentials provided to this command with __--user__ or ".
"__--password__, and must be configured correctly before you can ".
"proceed.\n".
"\n".
"**Raw MySQL Error**: %s\n",
$ex->getMessage()));
echo phutil_console_wrap($message);
exit(1);
}
if ($args->getArg('password') === null) {
// This is already a PhutilOpaqueEnvelope.
$password = $conf->getPassword();
} else {
// Put this in a PhutilOpaqueEnvelope.
$password = new PhutilOpaqueEnvelope($args->getArg('password'));
PhabricatorEnv::overrideConfig('mysql.pass', $args->getArg('password'));
}
$api = new PhabricatorStorageManagementAPI();
$api->setUser($args->getArg('user'));
PhabricatorEnv::overrideConfig('mysql.user', $args->getArg('user'));
$api->setHost($default_host);
$api->setPort($default_port);
$api->setPassword($password);
$api->setNamespace($args->getArg('namespace'));
$api->setDisableUTF8MB4($args->getArg('disable-utf8mb4'));
try {
queryfx(
$api->getConn(null),
'SELECT 1');
} catch (AphrontQueryException $ex) {
$message = phutil_console_format(
pht(
"**Bad Administrative Credentials**\n\n".
"Unable to connnect to MySQL using the administrative credentials ".
"provided with the __--user__ and __--password__ flags. Check that ".
"you have entered them correctly.\n".
"\n".
"**Raw MySQL Error**: %s\n",
$ex->getMessage()));
echo phutil_console_wrap($message);
exit(1);
}
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorStorageManagementWorkflow')
->loadObjects();
$patches = PhabricatorSQLPatchList::buildAllPatches();
foreach ($workflows as $workflow) {
$workflow->setAPI($api);
$workflow->setPatches($patches);
}
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
diff --git a/src/applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php b/src/applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php
index 7c46bbbc82..e7577426d3 100644
--- a/src/applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php
+++ b/src/applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php
@@ -1,104 +1,99 @@
<?php
final class PhabricatorPeopleTestDataGenerator
extends PhabricatorTestDataGenerator {
public function generate() {
while (true) {
try {
$realname = $this->generateRealname();
$username = $this->generateUsername($realname);
$email = $this->generateEmail($username);
$admin = PhabricatorUser::getOmnipotentUser();
$user = new PhabricatorUser();
$user->setUsername($username);
$user->setRealname($realname);
$email_object = id(new PhabricatorUserEmail())
->setAddress($email)
->setIsVerified(1);
id(new PhabricatorUserEditor())
->setActor($admin)
->createNewUser($user, $email_object);
return $user;
} catch (AphrontDuplicateKeyQueryException $ex) {}
}
}
protected function generateRealname() {
$realname_generator = new PhutilRealnameContextFreeGrammar();
$random_real_name = $realname_generator->generate();
return $random_real_name;
}
protected function generateUsername($random_real_name) {
$name = strtolower($random_real_name);
$name = preg_replace('/[^a-z]/s' , ' ', $name);
$name = preg_replace('/\s+/', ' ', $name);
$words = explode(' ', $name);
$random = rand(0, 4);
$reduced = '';
if ($random == 0) {
foreach ($words as $w) {
if ($w == end($words)) {
$reduced .= $w;
- }
- else {
+ } else {
$reduced .= $w[0];
}
}
} else if ($random == 1) {
foreach ($words as $w) {
if ($w == $words[0]) {
$reduced .= $w;
- }
- else {
+ } else {
$reduced .= $w[0];
}
}
} else if ($random == 2) {
foreach ($words as $w) {
if ($w == $words[0] || $w == end($words)) {
$reduced .= $w;
- }
- else {
+ } else {
$reduced .= $w[0];
}
}
} else if ($random == 3) {
foreach ($words as $w) {
if ($w == $words[0] || $w == end($words)) {
$reduced .= $w;
- }
- else {
+ } else {
$reduced .= $w[0].'.';
}
}
} else if ($random == 4) {
foreach ($words as $w) {
if ($w == $words[0] || $w == end($words)) {
$reduced .= $w;
- }
- else {
+ } else {
$reduced .= $w[0].'_';
}
}
}
$random1 = rand(0, 4);
if ($random1 >= 1) {
$reduced = ucfirst($reduced);
}
$username = $reduced;
return $username;
}
protected function generateEmail($username) {
$default_email_domain = 'example.com';
$email = $username.'@'.$default_email_domain;
return $email;
}
}
diff --git a/src/applications/releeph/conduit/ReleephQueryRequestsConduitAPIMethod.php b/src/applications/releeph/conduit/ReleephQueryRequestsConduitAPIMethod.php
index a4ae91f10e..d55b723ed9 100644
--- a/src/applications/releeph/conduit/ReleephQueryRequestsConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/ReleephQueryRequestsConduitAPIMethod.php
@@ -1,81 +1,81 @@
<?php
final class ReleephQueryRequestsConduitAPIMethod
extends ReleephConduitAPIMethod {
public function getAPIMethodName() {
return 'releeph.queryrequests';
}
public function getMethodDescription() {
return
'Return information about all Releeph requests linked to the given ids.';
}
public function defineParamTypes() {
return array(
'revisionPHIDs' => 'optional list<phid>',
'requestedCommitPHIDs' => 'optional list<phid>',
);
}
public function defineReturnType() {
return 'dict<string, wild>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $conduit_request) {
$revision_phids = $conduit_request->getValue('revisionPHIDs');
$requested_commit_phids =
$conduit_request->getValue('requestedCommitPHIDs');
$result = array();
if (!$revision_phids && !$requested_commit_phids) {
return $result;
}
$query = new ReleephRequestQuery();
$query->setViewer($conduit_request->getUser());
if ($revision_phids) {
$query->withRequestedObjectPHIDs($revision_phids);
} else if ($requested_commit_phids) {
$query->withRequestedCommitPHIDs($requested_commit_phids);
}
$releephRequests = $query->execute();
foreach ($releephRequests as $releephRequest) {
$branch = $releephRequest->getBranch();
$request_commit_phid = $releephRequest->getRequestCommitPHID();
$object = $releephRequest->getRequestedObject();
if ($object instanceof DifferentialRevision) {
$object_phid = $object->getPHID();
- } else {
+ } else {
$object_phid = null;
}
$status = $releephRequest->getStatus();
$statusName = ReleephRequestStatus::getStatusDescriptionFor($status);
$url = PhabricatorEnv::getProductionURI('/RQ'.$releephRequest->getID());
$result[] = array(
'branchBasename' => $branch->getBasename(),
'branchSymbolic' => $branch->getSymbolicName(),
'requestID' => $releephRequest->getID(),
'revisionPHID' => $object_phid,
'status' => $status,
'statusName' => $statusName,
'url' => $url,
);
}
return $result;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Apr 29, 6:25 AM (1 d, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
108212
Default Alt Text
(11 KB)

Event Timeline