src/snac/server/ServerExecutor.php
/**
     * Publish Constellation
     *
     * Updates the status of the given input's constellation to "published."  On successful publish, this method
     * also updates the Elastic Search indices to include the new version of this Constellation, if ES is being used
     * in this install.
     *
     * @param string[] $input Input array from the Server object
     * @throws \Exception
     * @return string[] The response to send to the client
     */
Publish Constellation
Updates the status of the given input's constellation to "published."  On successful publish, this method
also updates the Elastic Search indices to include the new version of this Constellation, if ES is being used
in this install.

@param string[] $input Input array from the Server object
@throws \Exception
@return string[] The response to send to the client
Publish Constellation Updates the status of the given input ' s constellation to " published . " On successful publish this method also updates the Elastic Search indices to include the new version of this Constellation if ES is being used in this install . @param string [] $input Input array from the Server object @throws \ Exception @return string [] The response to send to the client
public function publishConstellation(&$input) {
        $response = array();
        try {
            $this->logger->addDebug("Publishing constellation");
            if (isset($input["constellation"])) {
                $constellation = new \snac\data\Constellation($input["constellation"]);
                $current = $this->cStore->readConstellation($constellation->getID(), null, DBUtil::$READ_NRD);
                $info = $this->cStore->readConstellationUserStatus($constellation->getID());
                if (!$info) {
                    throw new \snac\exceptions\SNACDatabaseException("The current constellation did not have a valid status", 403);
                }
                $currentStatus = $info["status"];
                $currentUserID = $info["userid"];
                $currentNote = $info["note"];
                $inList = false;
                if ($currentUserID == $this->user->getUserID() &&
                    ($currentStatus == 'currently editing' || $currentStatus == 'locked editing')) {
                        $inList = true;
                    }
                $result = false;
                if ($current->getVersion() == $constellation->getVersion() && $inList) {
                    $result = $this->corePublish($current);
                }
                if (isset($result) && $result !== false) {
                    $this->logger->addDebug("successfully published constellation");
                    $constellation->setVersion($result);
                    $constellation->setArkID($current->getArk()); 
                    $response["constellation"] = $constellation->toArray();
                    $response["result"] = "success";
                    $this->updateIndexesAfterPublish($constellation->getID());
                } else {
                    $this->logger->addDebug("could not publish the constellation");
                    $response["result"] = "failure";
                    $response["error"] = "cannot publish an out-of-date copy of the constellation";
                }
            } else {
                $this->logger->addDebug("no constellation given to publish");
                $response["result"] = "failure";
                $response["error"] = "missing constellation information";
            }
        } catch (\Exception $e) {
            $this->logger->addError("publishing constellation threw an exception");
            $response["result"] = "failure";
            throw $e;
        }
        return $response;
    }
public function publishConstellation ( & $ input ) { $ response = array ( ) ; try { $ this -> logger -> addDebug ( " Publishing constellation " ) ; if ( isset ( $ input [ " constellation " ] ) ) { $ constellation = new \ snac \ data \ Constellation ( $ input [ " constellation " ] ) ; $ current = $ this -> cStore -> readConstellation ( $ constellation -> getID ( ) , null , DBUtil :: $ READ_NRD ) ; $ info = $ this -> cStore -> readConstellationUserStatus ( $ constellation -> getID ( ) ) ; if ( ! $ info ) { throw new \ snac \ exceptions \ SNACDatabaseException ( " The current constellation did not have a valid status " , 403 ) ; } $ currentStatus = $ info [ " status " ] ; $ currentUserID = $ info [ " userid " ] ; $ currentNote = $ info [ " note " ] ; $ inList = false ; if ( $ currentUserID == $ this -> user -> getUserID ( ) && ( $ currentStatus == 'currently editing' || $ currentStatus == 'locked editing' ) ) { $ inList = true ; } $ result = false ; if ( $ current -> getVersion ( ) == $ constellation -> getVersion ( ) && $ inList ) { $ result = $ this -> corePublish ( $ current ) ; } if ( isset ( $ result ) && $ result !== false ) { $ this -> logger -> addDebug ( " successfully published constellation " ) ; $ constellation -> setVersion ( $ result ) ; $ constellation -> setArkID ( $ current -> getArk ( ) ) ; $ response [ " constellation " ] = $ constellation -> toArray ( ) ; $ response [ " result " ] = " success " ; $ this -> updateIndexesAfterPublish ( $ constellation -> getID ( ) ) ; } else { $ this -> logger -> addDebug ( " could not publish the constellation " ) ; $ response [ " result " ] = " failure " ; $ response [ " error " ] = " cannot publish an out-of-date copy of the constellation " ; } } else { $ this -> logger -> addDebug ( " no constellation given to publish " ) ; $ response [ " result " ] = " failure " ; $ response [ " error " ] = " missing constellation information " ; } } catch ( \ Exception $ e ) { $ this -> logger -> addError ( " publishing constellation threw an exception " ) ; $ response [ " result " ] = " failure " ; throw $ e ; } return $ response ; }
Publish Constellation
 Updates the status of the given input's constellation to "published."
Publish Constellation Updates the status of the given input ' s constellation to " published . "
// Check the status of the constellation.  Make sure the input has the old version number (read the summary) // and then only publish if the user has permission (it was locked to them, etc). // If this constellation is the correct version, and the user was editing it, then publish it // Return the passed-in constellation from the user, with the new version number // corePublish updates current's ARK