Example #1
0
    echo $trans->trans('It seems that Thelia database is already up to date.');
    ?>
</p>
            </div>

        <?php 
} else {
    $continue = true;
    // Backup
    if ($backup) {
        try {
            $update->backupDb();
            ?>
                    <div class="alert alert-success">
                    <p><?php 
            echo $trans->trans('Your database has been backed up. The sql file : %file', ['%file' => $update->getBackupFile()]);
            ?>
</p>
                    </div><?php 
        } catch (\Exception $ex) {
            $continue = false;
            $updateError = $ex;
            ?>
                    <div class="alert alert-danger">
                    <p><?php 
            echo $trans->trans('Sorry, your database can\'t be backed up. Reason : ' . $ex->getMessage());
            ?>
</p>
                    </div><?php 
        }
    }
Example #2
0
        break;
    } elseif ($rep == 'n') {
        $backup = false;
        break;
    }
}
/***************************************************
 * Update
 ***************************************************/
$updateError = null;
try {
    // backup db
    if (true === $backup) {
        try {
            $update->backupDb();
            echo sprintf(PHP_EOL . 'Your database has been backed up. The sql file : %s' . PHP_EOL, $update->getBackupFile());
        } catch (\Exception $e) {
            echo PHP_EOL . 'Sorry, your database can\'t be backed up. Reason : ' . $e->getMessage() . PHP_EOL;
            exit(4);
        }
    }
    // update
    $update->process($backup);
} catch (UpdateException $ex) {
    $updateError = $ex;
}
if (null === $updateError) {
    echo sprintf(PHP_EOL . 'Thelia as been successfully updated to version %s' . PHP_EOL, $update->getCurrentVersion());
    if ($update->hasPostInstructions()) {
        echo PHP_EOL . '===================================' . PHP_EOL;
        echo $update->getPostInstructions();
Example #3
0
        break;
    } elseif ($rep == 'n') {
        $backup = false;
        break;
    }
}
/***************************************************
 * Update
 ***************************************************/
$updateError = null;
try {
    // backup db
    if (true === $backup) {
        try {
            $update->backupDb();
            cliOutput(sprintf('Your database has been backed up. The sql file : %s', $update->getBackupFile()), 'info');
        } catch (\Exception $e) {
            cliOutput('Sorry, your database can\'t be backed up. Reason : ' . $e->getMessage(), 'error');
            exit(4);
        }
    }
    // update
    $update->process($backup);
} catch (UpdateException $ex) {
    $updateError = $ex;
}
foreach ($update->getMessages() as $message) {
    cliOutput($message[0], $message[1]);
}
if (null === $updateError) {
    cliOutput(sprintf('Thelia as been successfully updated to version %s', $update->getCurrentVersion()), 'success');