public function popolate($more = array()) { $allpackage = array(); $pack = new package(); if (!$this->pkgsfile) { $this->pkgsfile = new internet(((substr($this->packages, 0, 7) == "http://" or substr($this->packages, 0, 6) == "ftp://") ? "" : $this->url) . $this->packages); } if (!$this->pkgsfile->exists()) { return false; } $i = 0; while (!is_null($pkg = $pack->fetch($this->pkgsfile))) { if ($pkg) { $id = $pack->add($pkg, array('repository' => $this->id), $more); if (!$id) { return false; } if (isset($_SERVER['DEBUG'])) { echo $id . " -> " . $pack->filename . " \n"; } if (isset($_SERVER["_"])) { echo "\r(packages {$i}: " . $pkg['name'] . " "; } else { echo "."; } $allpackage[$pack->filename] = $id; $i++; } } $this->pkgsfile->close(); if (!$this->db->query("update #__repository set npkgs='{$i}' where id='{$this->id}'")) { var_dump($this->db); } if (isset($_SERVER["_"])) { echo "\r(packages: {$i} \n"; } else { echo "\n [{$i} packages] \n"; } $list = new filelist(); if ($this->manifest) { $this->manifile = new internet($this->url . $this->manifest); if (!($i = $list->addall($allpackage, $this))) { var_dump($i); return false; } if (!$this->db->query("update #__repository set nfiles='{$i}' where id='{$this->id}'")) { var_dump($this->db); } } if (!$this->pkgsfile->exists()) { return false; } $this->mtime = $this->pkgsfile->head['Last-Modified']; $repo['mtime'] = $this->mtime; if (!$this->db->query("update #__repository set mtime='" . $this->mtime . "' where id=" . $this->id)) { return false; } return true; }