mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
03d6e7f1b6
Summary: I'm having trouble figuring out exactly what the timeframe on this was, but for a while in November we were not writing edges between pastes and their attached files correctly. An example of this on this install is here: https://secure.phabricator.com/P1893 That will start working once the migration runs, but until it does it shows this: {F1126605} This got fixed so recent stuff works fine, but it looks like WMF updated while the bug was active so they have more affected pastes than we do (we only have about 10). Test Plan: Ran this query to find pastes with missing edges: ``` select id, FROM_UNIXTIME(p.dateCreated) from pastebin_paste p LEFT JOIN edge ON edge.src = p.phid AND edge.type = 25 WHERE edge.dst IS NULL order by id; ``` Ran the migration. Verified the edges were fixed. Viewed one of the affected pastes, things now worked properly. Reviewers: chad Reviewed By: chad Subscribers: 20after4 Differential Revision: https://secure.phabricator.com/D15340
21 lines
545 B
PHP
21 lines
545 B
PHP
<?php
|
|
|
|
// For a while in November 2015, attachment edges between pastes and their
|
|
// underlying file data were not written correctly. This restores edges for
|
|
// any missing pastes.
|
|
|
|
$table = new PhabricatorPaste();
|
|
$edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
|
|
|
|
foreach (new LiskMigrationIterator($table) as $paste) {
|
|
$paste_phid = $paste->getPHID();
|
|
$file_phid = $paste->getFilePHID();
|
|
|
|
if (!$file_phid) {
|
|
continue;
|
|
}
|
|
|
|
id(new PhabricatorEdgeEditor())
|
|
->addEdge($paste_phid, $edge_type, $file_phid)
|
|
->save();
|
|
}
|