diff options
author | 2010-01-02 19:22:25 +0000 | |
---|---|---|
committer | 2010-01-02 19:22:25 +0000 | |
commit | 2628e6fb2bf0db823a9092c9e3acdf66aac77776 (patch) | |
tree | eb6889f51de980c60a81cc29e2fc1d4a7aed6709 /import.packages.php | |
parent | Add package_recent table; don't create a new instance of the ebuild object un... (diff) | |
download | znurt-org-backend-2628e6fb2bf0db823a9092c9e3acdf66aac77776.tar.gz znurt-org-backend-2628e6fb2bf0db823a9092c9e3acdf66aac77776.tar.bz2 znurt-org-backend-2628e6fb2bf0db823a9092c9e3acdf66aac77776.zip |
cosmetics and optimization
git-svn-id: file:///var/svn/portage@41 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
Diffstat (limited to 'import.packages.php')
-rw-r--r-- | import.packages.php | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/import.packages.php b/import.packages.php index 5c140b6..d3d6226 100644 --- a/import.packages.php +++ b/import.packages.php @@ -70,15 +70,15 @@ foreach($arr_categories as $category_id => $category_name) { - $obj_category = new PortageCategory($category_name); - - $arr_packages = $obj_category->getPackages(); + $c = new PortageCategory($category_name); + $arr_packages = $c->getPackages(); $arr_diff = importDiff('package', $arr_packages, "category = $category_id"); + // FIXME Flag to be deleted, execute later if(count($arr_diff['delete'])) { - foreach($arr_diff['delete'] as $name) { - $sql = "DELETE FROM $table WHERE name = ".$db->quote($name)." AND category = $category_id;"; + foreach($arr_diff['delete'] as $package_name) { + $sql = "DELETE FROM $table WHERE name = ".$db->quote($package_name)." AND category = $category_id;"; $db->query($sql); } } @@ -87,21 +87,23 @@ foreach($arr_diff['insert'] as $package_name) { - $obj_package = new PortagePackage($obj_category->name, $package_name); + $p = new PortagePackage($category_name, $package_name); $arr_insert = array( 'category' => $category_id, 'name' => $package_name, - 'changelog' => $obj_package->changelog, - 'portage_mtime' => $obj_package->portage_mtime, - 'changelog_mtime' => $obj_package->changelog_mtime, - 'metadata_mtime' => $obj_package->metadata_mtime, + 'changelog' => $p->changelog, + 'portage_mtime' => $p->portage_mtime, + 'changelog_mtime' => $p->changelog_mtime, + 'metadata_mtime' => $p->metadata_mtime, ); $db->autoExecute($table, $arr_insert, MDB2_AUTOQUERY_INSERT); } } } + unset($c); + foreach($arr_update as $category_name => $arr_packages) { foreach($arr_packages as $package_name) { |