aStepsHistory[] = ['step' => $sStep, 'result' => $aResult]; } public function GetHistory() { return $this->aStepsHistory; } /** * Runs all the installation steps in one go and directly outputs * some information about the progress and the success of the various * sequential steps. * * @param bool $bVerbose * @param string|null $sMessage * @param string|null $sComment * * @return boolean True if the installation was successful, false otherwise */ public function ExecuteAllSteps(bool $bVerbose = true, ?string &$sMessage = null, ?string $sComment = null) { $sStep = ''; $sStepLabel = ''; $iOverallStatus = self::OK; do { if ($bVerbose) { if ($sStep != '') { echo "$sStepLabel\n"; echo "Executing '$sStep'\n"; } else { echo "Starting...\n"; } } $aRes = $this->ExecuteStep($sStep, $sComment); $this->LogStep($sStep, $aRes); $sStep = $aRes['next-step']; $sStepLabel = $aRes['next-step-label']; $sMessage = $aRes['message']; if ($bVerbose) { switch ($aRes['status']) { case self::OK: echo "Ok. ".$aRes['percentage-completed']." % done.\n"; break; case self::ERROR: $iOverallStatus = self::ERROR; echo "Error: ".$aRes['message']."\n"; break; case self::WARNING: $iOverallStatus = self::WARNING; echo "Warning: ".$aRes['message']."\n"; echo $aRes['percentage-completed']." % done.\n"; break; case self::INFO: echo "Info: ".$aRes['message']."\n"; echo $aRes['percentage-completed']." % done.\n"; break; } } else { switch ($aRes['status']) { case self::ERROR: $iOverallStatus = self::ERROR; break; case self::WARNING: $iOverallStatus = self::WARNING; break; } } } while (($aRes['status'] != self::ERROR) && ($aRes['next-step'] != '')); return ($iOverallStatus == self::OK); } abstract public function ExecuteStep($sStep = '', $sComment = null); }