summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dibb <beandog@gentoo.org>2010-01-02 19:22:07 +0000
committerSteve Dibb <beandog@gentoo.org>2010-01-02 19:22:07 +0000
commita300f930a2772db2451491e4bb60492276ef92db (patch)
treee0083c18c3e6c98679c13f2e2d5e4872f41dee05 /import.ebuilds.php
parentmore final acts (diff)
downloadznurt-org-backend-a300f930a2772db2451491e4bb60492276ef92db.tar.gz
znurt-org-backend-a300f930a2772db2451491e4bb60492276ef92db.tar.bz2
znurt-org-backend-a300f930a2772db2451491e4bb60492276ef92db.zip
Add package_recent table; don't create a new instance of the ebuild object unnecessarily
git-svn-id: file:///var/svn/portage@40 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
Diffstat (limited to 'import.ebuilds.php')
-rw-r--r--import.ebuilds.php25
1 files changed, 21 insertions, 4 deletions
diff --git a/import.ebuilds.php b/import.ebuilds.php
index 67ef80e..0279ff1 100644
--- a/import.ebuilds.php
+++ b/import.ebuilds.php
@@ -187,20 +187,24 @@
$arr_update[] = $ebuild_name;
$arr_insert[] = $ebuild_name;
- $arr_delete[] = $ebuild_name;
+ // Normally I'd add this here, but instead, just go ahead and mark it
+ // right away, and avoid having it run twice.
+ $db_ebuild->status = 3;
+// $arr_delete[] = $ebuild_name;
if($verbose) {
shell::msg("[update] $category_name/$ebuild_name");
}
// Flag as being updated (will be removed from end of import run)
- $db_ebuild->status = 2;
+// $db_ebuild->status = 2;
}
}
}
}
+ // FIXME just pass the IDs
if(count($arr_delete)) {
foreach($arr_delete as $ebuild_name) {
@@ -211,8 +215,12 @@
$ebuild = $arr_ebuild_ids[$category_name][$package_name][$ebuild_name];
if($ebuild) {
- $db_ebuild = new DBEbuild($ebuild);
- $db_ebuild->status = 3;
+// $db_ebuild = new DBEbuild($ebuild);
+// $db_ebuild->status = 3;
+
+ $arr_update = array('status' => 3);
+ $db->autoExecute('ebuild', $arr_update, MDB2_AUTOQUERY_UPDATE, "id = ".$db->quote($id));
+
}
}
@@ -258,6 +266,7 @@
'cache_mtime' => $obj_ebuild->cache_mtime,
'status' => 1,
'udate' => $udate,
+ 'source' => $obj_ebuild->source,
);
$db->autoExecute('ebuild', $arr, MDB2_AUTOQUERY_INSERT);
@@ -273,4 +282,12 @@
}
+ // Update the package_recent entries
+ $sql = "DELETE FROM package_recent WHERE status = 1;";
+ $db->query($sql);
+
+ $sql = "INSERT INTO package_recent SELECT DISTINCT package, MAX(cache_mtime), 1 FROM ebuild e GROUP BY package ORDER BY MAX(cache_mtime) DESC, package;";
+ $db->query($sql);
+
+
?> \ No newline at end of file