getSimulationResults() 공개 메소드

Get the results of the last simulation.
public getSimulationResults ( ) : array
리턴 array
예제 #1
0
 public function upgrade()
 {
     $this->start(3);
     $update = new AutoUpdate(__DIR__ . '/temp', __DIR__ . '/../../', 60);
     $update->setCurrentVersion($this->version);
     // Current version of your application. This value should be from a database or another file which will be updated with the installation of a new version
     $update->setUpdateUrl('http://www.phpback.org/upgrade/');
     //Replace the url with your server update url
     $update->checkUpdate();
     // Check if new update is available
     if ($update->newVersionAvailable()) {
         //Install new update
         $result = $update->update();
         if ($result !== true) {
             echo 'Update failed: ' . $result . '!<br>';
             if ($result = AutoUpdate::ERROR_SIMULATE) {
                 echo '<pre>';
                 var_dump($update->getSimulationResults());
                 echo '</pre>';
             }
         }
         @(include __DIR__ . '../config/update.php');
         @unlink(__DIR__ . '../config/update.php');
     }
     header('Location: ' . base_url() . 'admin/system');
 }
예제 #2
0
if ($update->checkUpdate() === false) {
    die('Could not check for updates! See log file for details.');
}
if ($update->newVersionAvailable()) {
    //Install new update
    echo 'New Version: ' . $update->getLatestVersion() . '<br>';
    echo 'Installing Updates: <br>';
    echo '<pre>';
    var_dump(array_map(function ($version) {
        return (string) $version;
    }, $update->getVersionsToUpdate()));
    echo '</pre>';
    // This call will only simulate an update.
    // Set the first argument (simulate) to "false" to install the update
    // i.e. $update->update(false);
    $result = $update->update();
    if ($result === true) {
        echo 'Update simulation successful<br>';
    } else {
        echo 'Update simulation failed: ' . $result . '!<br>';
        if ($result = AutoUpdate::ERROR_SIMULATE) {
            echo '<pre>';
            var_dump($update->getSimulationResults());
            echo '</pre>';
        }
    }
} else {
    echo 'Current Version is up to date<br>';
}
echo 'Log:<br>';
echo nl2br(file_get_contents(__DIR__ . '/update.log'));