1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +01:00
phorge-phorge/resources/sql/autopatches/20180914.audit.01.mailkey.php

35 lines
899 B
PHP
Raw Normal View History

<?php
$commit_table = new PhabricatorRepositoryCommit();
$commit_conn = $commit_table->establishConnection('w');
$commit_name = $commit_table->getTableName();
$properties_table = new PhabricatorMetaMTAMailProperties();
$conn = $properties_table->establishConnection('w');
$iterator = new LiskRawMigrationIterator($commit_conn, $commit_name);
$chunks = new PhutilChunkedIterator($iterator, 100);
foreach ($chunks as $chunk) {
$sql = array();
foreach ($chunk as $commit) {
$sql[] = qsprintf(
$conn,
'(%s, %s, %d, %d)',
$commit['phid'],
phutil_json_encode(
array(
'mailKey' => $commit['mailKey'],
)),
PhabricatorTime::getNow(),
PhabricatorTime::getNow());
}
queryfx(
$conn,
'INSERT IGNORE INTO %R
(objectPHID, mailProperties, dateCreated, dateModified)
VALUES %LQ',
$properties_table,
$sql);
}