Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20160223.paste.fileedges.php
| <?php | <?php | ||||
| // For a while in November 2015, attachment edges between pastes and their | // For a while in November 2015, attachment edges between pastes and their | ||||
| // underlying file data were not written correctly. This restores edges for | // underlying file data were not written correctly. This restores edges for | ||||
| // any missing pastes. | // any missing pastes. | ||||
| $table = new PhabricatorPaste(); | // See T13510. The "pastebin" database was later renamed to "paste", which | ||||
| $edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST; | // broke this migration. The migration was removed in 2020 since it seems | ||||
| // plausible that zero installs are impacted (only installs that ran code | |||||
| foreach (new LiskMigrationIterator($table) as $paste) { | // from November 2015 and have not upgraded in five years could possibly be | ||||
| $paste_phid = $paste->getPHID(); | // impacted). | ||||
| $file_phid = $paste->getFilePHID(); | |||||
| if (!$file_phid) { | |||||
| continue; | |||||
| } | |||||
| id(new PhabricatorEdgeEditor()) | |||||
| ->addEdge($paste_phid, $edge_type, $file_phid) | |||||
| ->save(); | |||||
| } | |||||