public function applyDeltas()
 {
     while ($this->dbVersion->isLessThan($this->deltaDirectory->latestVersion())) {
         $delta = new Delta($this->dbVersion->currentVersion() + 1);
         $delta->apply($this);
     }
 }
Ejemplo n.º 2
0
            }
            $channels = empty($postJson->params->channels) ? array('nightly') : $postJson->params->channels;
            $limit = empty($postJson->params->limit) ? 25 : intval($postJson->params->limit);
            $tokens = new TokenCollection($channels, $devicePath, $device);
            $ret['result'] = $tokens->getUpdateList($limit);
        }
    }
    Flight::json($ret);
});
// Deltas
Flight::route('/api/v1/build/get_delta', function () {
    $ret = array();
    $req = Flight::request();
    $postJson = json_decode($req->body);
    if ($postJson != NULL && !empty($postJson->source_incremental) && !empty($postJson->target_incremental)) {
        $source_incremental = $postJson->source_incremental;
        $target_incremental = $postJson->target_incremental;
        if ($source_incremental != $target_incremental) {
            $ret = Delta::find($source_incremental, $target_incremental);
        }
    }
    if (empty($ret)) {
        $ret['errors'] = array('message' => 'Unable to find delta');
    }
    Flight::json($ret);
});
Flight::map('notFound', function () {
    // Display custom 404 page
    echo 'Sorry, 404!';
});
Flight::start();