Airship\Cabin\Bridge\Blueprint\ChannelUpdates::storeUpdate PHP Method

storeUpdate() protected method

Store the new update in the database.
protected storeUpdate ( array $nodeData ) : boolean
$nodeData array
return boolean
    protected function storeUpdate(array $nodeData) : bool
    {
        $this->db->beginTransaction();
        $treeUpdateID = (int) $this->db->insertGet('airship_tree_updates', ['channel' => $this->channel, 'channelupdateid' => $nodeData['id'], 'data' => $nodeData['data'], 'merkleroot' => $nodeData['root']], 'treeupdateid');
        $unpacked = \json_decode($nodeData['data'], true);
        switch ($nodeData['stored']['action']) {
            case 'CORE':
            case 'PACKAGE':
                if (!$this->updatePackageQueue($unpacked, $treeUpdateID)) {
                    $this->db->rollBack();
                    return false;
                }
                break;
            case 'CREATE':
                if (!$this->insertKey($unpacked, $nodeData)) {
                    $this->db->rollBack();
                    return false;
                }
                break;
            case 'INSERT':
                if (!$this->revokeKey($unpacked, $nodeData)) {
                    $this->db->rollBack();
                    return false;
                }
                break;
            default:
                // Unknown operation. Do nothing and abort.
                $this->db->rollBack();
                return false;
        }
        return $this->db->commit();
    }