mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
c03a412d5c
Summary: Adds authorPHID to panels so we can default to the panels you made. Test Plan: Run upgrade, visit manage panels, see my panels. Create a new panel. Edit a panel. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17036
39 lines
904 B
PHP
39 lines
904 B
PHP
<?php
|
|
|
|
// Set authorPHID on Dashboard Panels
|
|
//
|
|
$table = new PhabricatorDashboardPanel();
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
$txn_table = new PhabricatorDashboardPanelTransaction();
|
|
$txn_conn = $table->establishConnection('r');
|
|
|
|
echo pht("Building Dashboard Panel authorPHIDs...\n");
|
|
|
|
foreach (new LiskMigrationIterator($table) as $panel) {
|
|
|
|
if ($panel->getAuthorPHID()) {
|
|
continue;
|
|
}
|
|
|
|
$panel_row = queryfx_one(
|
|
$txn_conn,
|
|
'SELECT authorPHID FROM %T WHERE objectPHID = %s ORDER BY id ASC LIMIT 1',
|
|
$txn_table->getTableName(),
|
|
$panel->getPHID());
|
|
|
|
if (!$panel_row) {
|
|
$author_phid = id(new PhabricatorDashboardApplication())->getPHID();
|
|
} else {
|
|
$author_phid = $panel_row['authorPHID'];
|
|
}
|
|
|
|
queryfx(
|
|
$conn_w,
|
|
'UPDATE %T SET authorPHID = %s WHERE id = %d',
|
|
$table->getTableName(),
|
|
$author_phid,
|
|
$panel->getID());
|
|
}
|
|
|
|
echo pht("Done\n");
|