Pimcore\Update::composerDumpAutoload PHP Method

composerDumpAutoload() public static method

public static composerDumpAutoload ( ) : array
return array
    public static function composerDumpAutoload()
    {
        $composerLock = PIMCORE_DOCUMENT_ROOT . "/composer.lock";
        if (file_exists($composerLock)) {
            @unlink($composerLock);
        }
        $outputMessage = "";
        // dump autoload and regenerate composer.lock
        try {
            $composerPath = \Pimcore\Tool\Console::getExecutable("composer");
            $process = new Process($composerPath . ' update nothing -d ' . PIMCORE_DOCUMENT_ROOT);
            $process->setTimeout(300);
            $process->mustRun();
        } catch (\Exception $e) {
            Logger::error($e);
            $outputMessage = "<b style='color:red;'>Important</b>: Failed running <pre>composer update nothing</pre> Please run it manually on commandline!";
        }
        return ["message" => $outputMessage, "success" => true];
    }

Usage Example

Beispiel #1
0
 public function jobProceduralAction()
 {
     $status = ["success" => true];
     if ($this->getParam("type") == "files") {
         Update::installData($this->getParam("revision"));
     } elseif ($this->getParam("type") == "clearcache") {
         \Pimcore\Cache::clearAll();
     } elseif ($this->getParam("type") == "preupdate") {
         $status = Update::executeScript($this->getParam("revision"), "preupdate");
     } elseif ($this->getParam("type") == "postupdate") {
         $status = Update::executeScript($this->getParam("revision"), "postupdate");
     } elseif ($this->getParam("type") == "cleanup") {
         Update::cleanup();
     } elseif ($this->getParam("type") == "composer-dump-autoload") {
         $status = Update::composerDumpAutoload();
     }
     // we use pure PHP here, otherwise this can cause issues with dependencies that changed during the update
     header("Content-type: application/json");
     echo json_encode($status);
     exit;
 }
All Usage Examples Of Pimcore\Update::composerDumpAutoload