Exemple #1
0
 * 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();
        echo PHP_EOL . '===================================' . PHP_EOL;
    }
} else {
    echo sprintf(PHP_EOL . 'Sorry, an unexpected error has occured : %s' . PHP_EOL, $updateError->getMessage());
    print $updateError->getTraceAsString() . PHP_EOL;
    print "Trace: " . PHP_EOL;
    foreach ($update->getLogs() as $log) {
Exemple #2
0
                    </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 
        }
    }
    if ($continue) {
        try {
            $update->process();
        } catch (UpdateException $ex) {
            $updateError = $ex;
        }
        if (null === $updateError) {
            ?>

                    <div class="alert alert-success">
                        <p><?php 
            echo $trans->trans('Thelia as been successfully updated to version %version', ['%version' => $update->getCurrentVersion()]);
            ?>
</p>
                    </div>

                    <?php 
            if ($update->hasPostInstructions()) {