Example #1
0
try {
    $update = new \Thelia\Install\Update(false);
} catch (UpdateException $ex) {
    cliOutput($ex->getMessage(), 'error');
    exit(2);
}
/***************************************************
 * Check if update is needed
 ***************************************************/
if ($update->isLatestVersion()) {
    cliOutput("You already have the latest version of Thelia : " . $update->getCurrentVersion(), 'success');
    exit(3);
}
$current = $update->getCurrentVersion();
$files = $update->getLatestVersion();
$web = $update->getWebVersion();
while (1) {
    if ($web !== null && $files != $web) {
        cliOutput(sprintf("Thelia server is reporting the current stable release version is %s ", $web), 'warning');
    }
    cliOutput(sprintf("You are going to update Thelia from version %s to version %s.", $current, $files), 'info');
    if ($web !== null && $files < $web) {
        cliOutput(sprintf("Your files belongs to version %s, which is not the latest stable release.", $files), 'warning');
        cliOutput(sprintf("It is recommended to upgrade your files first then run this script again." . PHP_EOL . "The latest version is available at http://thelia.net/#download ."), 'warning');
        cliOutput("Continue update process anyway ? (Y/n)");
    } else {
        cliOutput("Continue update process ? (Y/n)");
    }
    $rep = readStdin(true);
    if ($rep == 'y') {
        break;