@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3// Set authorPHID on Dashboards
4//
5$table = new PhabricatorDashboard();
6$conn_w = $table->establishConnection('w');
7
8$txn_table = new PhabricatorDashboardTransaction();
9$txn_conn = $table->establishConnection('r');
10
11echo pht("Building Dashboard authorPHIDs...\n");
12
13foreach (new LiskMigrationIterator($table) as $dashboard) {
14
15 if ($dashboard->getAuthorPHID()) {
16 continue;
17 }
18
19 $author_row = queryfx_one(
20 $txn_conn,
21 'SELECT authorPHID FROM %T WHERE objectPHID = %s ORDER BY id ASC LIMIT 1',
22 $txn_table->getTableName(),
23 $dashboard->getPHID());
24
25 if (!$author_row) {
26 $author_phid = id(new PhabricatorDashboardApplication())->getPHID();
27 } else {
28 $author_phid = $author_row['authorPHID'];
29 }
30
31 queryfx(
32 $conn_w,
33 'UPDATE %T SET authorPHID = %s WHERE id = %d',
34 $table->getTableName(),
35 $author_phid,
36 $dashboard->getID());
37}
38
39echo pht("Done\n");