Pimcore\Update::getJobs PHP Method

getJobs() public static method

public static getJobs ( $toRevision, null $currentRev = null ) : array
$toRevision
$currentRev null
return array
    public static function getJobs($toRevision, $currentRev = null)
    {
        if (!$currentRev) {
            $currentRev = Version::$revision;
        }
        $xmlRaw = Tool::getHttpData("https://" . self::$updateHost . "/v2/getDownloads.php?from=" . $currentRev . "&to=" . $toRevision);
        $xml = simplexml_load_string($xmlRaw, null, LIBXML_NOCDATA);
        $jobs = [];
        $updateScripts = [];
        $revisions = [];
        if (isset($xml->download)) {
            foreach ($xml->download as $download) {
                if ($download->type == "script") {
                    $updateScripts[(string) $download->revision]["preupdate"] = ["type" => "preupdate", "revision" => (string) $download->revision];
                    $updateScripts[(string) $download->revision]["postupdate"] = ["type" => "postupdate", "revision" => (string) $download->revision];
                }
            }
        }
        if (isset($xml->download)) {
            foreach ($xml->download as $download) {
                $jobs["parallel"][] = ["type" => "download", "revision" => (string) $download->revision, "url" => (string) $download->url];
                $revisions[] = (int) $download->revision;
            }
        }
        $revisions = array_unique($revisions);
        foreach ($revisions as $revision) {
            if ($updateScripts[$revision]["preupdate"]) {
                $jobs["procedural"][] = $updateScripts[$revision]["preupdate"];
            }
            $jobs["procedural"][] = ["type" => "files", "revision" => $revision];
            if ($updateScripts[$revision]["postupdate"]) {
                $jobs["procedural"][] = $updateScripts[$revision]["postupdate"];
            }
        }
        $jobs["procedural"][] = ["type" => "clearcache"];
        $jobs["procedural"][] = ["type" => "cleanup"];
        $jobs["procedural"][] = ["type" => "composer-dump-autoload"];
        return $jobs;
    }

Usage Example

 public function getJobsAction()
 {
     $jobs = Update::getJobs($this->getParam("toRevision"));
     $this->_helper->json($jobs);
 }
All Usage Examples Of Pimcore\Update::getJobs