protected function proceedTrackingIds($changeSetId, array $trackingIds)
    {
        // The commit message includes the tracking ids.
        // Via a new patchset, the commit message (inkl. tracking ids) can change.
        // To handle this case, we set all tracking ids to referenced_earlier => 1
        // and proceed the tracking ids. If the tracking id is still in the commit message
        // it will be set back to referenced_earlier => 0.
        $dataToUpdate = array(
            'referenced_earlier' => 1
        );
        $where = 'changeset = ' . intval($changeSetId);
        $this->getDatabase()->updateRecords(Database::TABLE_TRACKING_ID, $dataToUpdate, $where);

        foreach ($trackingIds as $trackingId) {
            $system = $this->proceedLookupTable(Database::TABLE_TRACKING_SYSTEM, 'id', 'name', $trackingId['system']);

            $trackingIdRow = $this->getGerritTrackingIdByIdentifier($changeSetId, $system, $trackingId['id']);

            // If there is no tracking id with the current changeset, system and number, insert it
            if ($trackingIdRow === false) {
                $trackingRow = array(
                    'changeset' => $changeSetId,
                    'system' => $system,
                    'number' => $trackingId['id']
                );
                $this->getDatabase()->insertRecord(Database::TABLE_TRACKING_ID, $trackingRow);

                // We know this tracking id, but this id was set to referenced_earlier => 1 earlier.
                // So lets reactivate this!
            } else {
                $dataToUpdate = array(
                    'referenced_earlier' => 0
                );
                $this->getDatabase()->updateRecord(Database::TABLE_TRACKING_ID, $dataToUpdate, $trackingIdRow['id']);
            }

            $trackingId = $this->unsetKeys($trackingId, array('id', 'system'));
            $this->checkIfAllValuesWereProceeded($trackingId, 'Tracking ID');
        }
    }
protected function proceedTrackingIds($changeSetId, array $trackingIds)
    {
        // The commit message includes the tracking ids.
        // Via a new patchset, the commit message (inkl. tracking ids) can change.
        // To handle this case, we set all tracking ids to referenced_earlier => 1
        // and proceed the tracking ids. If the tracking id is still in the commit message
        // it will be set back to referenced_earlier => 0.
        $dataToUpdate = array(
            'referenced_earlier' => 1
        );
        $where = 'changeset = ' . intval($changeSetId);
        $this->getDatabase()->updateRecords(Database::TABLE_TRACKING_ID, $dataToUpdate, $where);

        foreach ($trackingIds as $trackingId) {
            $system = $this->proceedLookupTable(Database::TABLE_TRACKING_SYSTEM, 'id', 'name', $trackingId['system']);

            $trackingIdRow = $this->getGerritTrackingIdByIdentifier($changeSetId, $system, $trackingId['id']);

            // If there is no tracking id with the current changeset, system and number, insert it
            if ($trackingIdRow === false) {
                $trackingRow = array(
                    'changeset' => $changeSetId,
                    'system' => $system,
                    'number' => $trackingId['id']
                );
                $this->getDatabase()->insertRecord(Database::TABLE_TRACKING_ID, $trackingRow);

                // We know this tracking id, but this id was set to referenced_earlier => 1 earlier.
                // So lets reactivate this!
            } else {
                $dataToUpdate = array(
                    'referenced_earlier' => 0
                );
                $this->getDatabase()->updateRecord(Database::TABLE_TRACKING_ID, $dataToUpdate, $trackingIdRow['id']);
            }

            $trackingId = $this->unsetKeys($trackingId, array('id', 'system'));
            $this->checkIfAllValuesWereProceeded($trackingId, 'Tracking ID');
        }
    }
protected function proceedTrackingIds ( $ changeSetId , array $ trackingIds ) { // The commit message includes the tracking ids. // Via a new patchset, the commit message (inkl. tracking ids) can change. // To handle this case, we set all tracking ids to referenced_earlier => 1 // and proceed the tracking ids. If the tracking id is still in the commit message // it will be set back to referenced_earlier => 0. $ dataToUpdate = array ( 'referenced_earlier' => 1 ) ; $ where = 'changeset = ' . intval ( $ changeSetId ) ; $ this -> getDatabase ( ) -> updateRecords ( Database :: TABLE_TRACKING_ID , $ dataToUpdate , $ where ) ; foreach ( $ trackingIds as $ trackingId ) { $ system = $ this -> proceedLookupTable ( Database :: TABLE_TRACKING_SYSTEM , 'id' , 'name' , $ trackingId [ 'system' ] ) ; $ trackingIdRow = $ this -> getGerritTrackingIdByIdentifier ( $ changeSetId , $ system , $ trackingId [ 'id' ] ) ; // If there is no tracking id with the current changeset, system and number, insert it if ( $ trackingIdRow === false ) { $ trackingRow = array ( 'changeset' => $ changeSetId , 'system' => $ system , 'number' => $ trackingId [ 'id' ] ) ; $ this -> getDatabase ( ) -> insertRecord ( Database :: TABLE_TRACKING_ID , $ trackingRow ) ; // We know this tracking id, but this id was set to referenced_earlier => 1 earlier. // So lets reactivate this! } else { $ dataToUpdate = array ( 'referenced_earlier' => 0 ) ; $ this -> getDatabase ( ) -> updateRecord ( Database :: TABLE_TRACKING_ID , $ dataToUpdate , $ trackingIdRow [ 'id' ] ) ; } $ trackingId = $ this -> unsetKeys ( $ trackingId , array ( 'id' , 'system' ) ) ; $ this -> checkIfAllValuesWereProceeded ( $ trackingId , 'Tracking ID' ) ; } }
Proceed tracking ids per changeset.
Checks if they are already exists. If not, insert them.

@param integer $changeSetId Current changeset id
@param array $trackingIds Tracking ids to proceed
@return void
Proceed tracking ids per changeset . Checks if they are already exists . If not insert them .