Differential D15152 Diff 36584 src/applications/project/engineextension/PhabricatorProjectsMembershipIndexEngineExtension.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/engineextension/PhabricatorProjectsMembershipIndexEngineExtension.php
| Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | if ($descendant_phids) { | ||||
| $has_subprojects = true; | $has_subprojects = true; | ||||
| } else { | } else { | ||||
| $source_phids = array($project->getPHID()); | $source_phids = array($project->getPHID()); | ||||
| $has_subprojects = false; | $has_subprojects = false; | ||||
| } | } | ||||
| $conn_w = $project->establishConnection('w'); | $conn_w = $project->establishConnection('w'); | ||||
| $any_milestone = queryfx_one( | |||||
| $conn_w, | |||||
| 'SELECT id FROM %T | |||||
| WHERE parentProjectPHID = %s AND milestoneNumber IS NOT NULL | |||||
| LIMIT 1', | |||||
| $project->getTableName(), | |||||
| $project_phid); | |||||
| $has_milestones = (bool)$any_milestone; | |||||
| $project->openTransaction(); | $project->openTransaction(); | ||||
| // Delete any existing materialized member edges. | // Delete any existing materialized member edges. | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'DELETE FROM %T WHERE src = %s AND type = %s', | 'DELETE FROM %T WHERE src = %s AND type = %s', | ||||
| PhabricatorEdgeConfig::TABLE_NAME_EDGE, | PhabricatorEdgeConfig::TABLE_NAME_EDGE, | ||||
| $project_phid, | $project_phid, | ||||
| Show All 15 Lines | $project->openTransaction(); | ||||
| // Update the hasSubprojects flag. | // Update the hasSubprojects flag. | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'UPDATE %T SET hasSubprojects = %d WHERE id = %d', | 'UPDATE %T SET hasSubprojects = %d WHERE id = %d', | ||||
| $project->getTableName(), | $project->getTableName(), | ||||
| (int)$has_subprojects, | (int)$has_subprojects, | ||||
| $project->getID()); | $project->getID()); | ||||
| // Update the hasMilestones flag. | |||||
| queryfx( | |||||
| $conn_w, | |||||
| 'UPDATE %T SET hasMilestones = %d WHERE id = %d', | |||||
| $project->getTableName(), | |||||
| (int)$has_milestones, | |||||
| $project->getID()); | |||||
| $project->saveTransaction(); | $project->saveTransaction(); | ||||
| } | } | ||||
| } | } | ||||