1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 00:10:57 +01:00

Open database connection with 'w' instead of 'r' for writing

Summary:
there are several places we open an 'r' connection but use it
for writing. Fix them.

Test Plan:
ran parse_one_commit.php against one revision which executes
the code with problem. It used to throw exception. Now it works fine.

Reviewed By: Girish
Reviewers: tuomaspelkonen, Girish
Commenters: aran
CC: aran, Girish
Differential Revision: 213
This commit is contained in:
jungejason 2011-05-02 13:00:16 -07:00
parent 6bec3d2e4f
commit c728e4f7da
3 changed files with 3 additions and 3 deletions

View file

@ -27,7 +27,7 @@ PhutilSymbolLoader::loadClass('PhabricatorRepositoryCommit');
$commit = new PhabricatorRepositoryCommit();
$conn_w = id(new PhabricatorRepository())->establishConnection('r');
$conn_w = id(new PhabricatorRepository())->establishConnection('w');
$sizes = queryfx_all(
$conn_w,
'SELECT repositoryID, count(*) N FROM %T GROUP BY repositoryID',

View file

@ -76,7 +76,7 @@ abstract class PhabricatorRepositoryCommitDiscoveryDaemon
$event->recordEvent();
queryfx(
$repository->establishConnection('r'),
$repository->establishConnection('w'),
'INSERT INTO %T (repositoryID, size, lastCommitID, epoch)
VALUES (%d, 1, %d, %d)
ON DUPLICATE KEY UPDATE

View file

@ -51,7 +51,7 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
if ($revision) {
queryfx(
$revision->establishConnection('r'),
$revision->establishConnection('w'),
'INSERT IGNORE INTO %T (revisionID, commitPHID) VALUES (%d, %s)',
DifferentialRevision::TABLE_COMMIT,
$revision->getID(),