$allpub = $compiler->books;
if (isset($collection->settings['offline']) && $collection->settings['offline']) {
- $p = $compiler->getPublishedVersionPath($os);
+ $p = $compiler->getPublishedVersionPath($os, $collection->settings['version']);
$phonegap->addAdditionalSource('publications', $p);
file_put_contents($this->vdir . '/data/app.css', implode("\n", $c));
}
- public function getPublishedVersionPath($os) {
+ public function getPublishedVersionPath($os, $version) {
global $core;
- $r = $core->con->select('SELECT compile_date FROM book_collection_compile WHERE collection_id=\'' . $this->collectionId . '\' AND online_' . $os . '=1');
+ $r = $core->con->select('SELECT compile_date FROM book_collection_compile WHERE collection_id=\'' . $this->collectionId . '\'');
while ($r->fetch()) {
+ $v = $r->{"online_" . $os};
+ if (!$v) {
+ continue;
+ }
+ if (version_compare($v, $version, '>')) {
+ continue;
+ }
return WS_COLLECTIONS . '/versions/' . $this->collectionId . '/' . $r->compile_date . '/' . $os . '/';
}
}