summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dibb <beandog@gentoo.org>2009-12-29 21:50:14 +0000
committerSteve Dibb <beandog@gentoo.org>2009-12-29 21:50:14 +0000
commite83562c390ae10a02a46d3152e9215f32c79636e (patch)
tree407780b5afde1eda1ee086bb06e230a756ea8de4
parentUpdate package description (diff)
downloadznurt-org-backend-e83562c390ae10a02a46d3152e9215f32c79636e.tar.gz
znurt-org-backend-e83562c390ae10a02a46d3152e9215f32c79636e.tar.bz2
znurt-org-backend-e83562c390ae10a02a46d3152e9215f32c79636e.zip
Only do updates on newer directories
git-svn-id: file:///var/svn/portage@23 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
-rw-r--r--import.packages.php39
1 files changed, 28 insertions, 11 deletions
diff --git a/import.packages.php b/import.packages.php
index e9b2daa..c5ee191 100644
--- a/import.packages.php
+++ b/import.packages.php
@@ -1,5 +1,7 @@
<?
+// $verbose = true;
+
require_once 'header.php';
require_once 'class.portage.tree.php';
require_once 'class.portage.category.php';
@@ -15,6 +17,11 @@
$arr_package_ids[$row['category_name']][$row['package_name']] = $row['package'];
}
+ $sql = "SELECT MAX(ctime) max_ctime, MAX(mtime) max_mtime FROM package;";
+ $arr = $db->getRow($sql);
+ if(is_array($arr))
+ extract($arr);
+
$table = 'package';
foreach($arr_categories as $category_id => $category_name) {
@@ -44,25 +51,35 @@
}
foreach($arr_packages as $package_name) {
+
+ if($verbose) {
+ shell::msg("$category_name/$package_name");
+ }
if(!in_array($package_name, $arr_diff['insert'])) {
$package_id = $arr_package_ids[$category_name][$package_name];
if($package_id) {
-// if($verbose) {
-// shell::msg("Updating $category_name/$package_name id: $package_id");
-// }
-
- $db_package = new DBPackage($package_id);
$p = new PortagePackage($obj_category->name, $package_name);
- if($p->mtime != $db_package->mtime)
- $db_package->mtime = $p->mtime;
- if($p->ctime != $db_package->ctime)
- $db_package->ctime = $p->ctime;
- if($p->changelog != $db_package->changelog)
- $db_package->changelog = $p->changelog;
+ if(($p->mtime > $max_mtime) || ($p->ctime > $max_ctime)) {
+
+ if($verbose) {
+ shell::msg("Updating $category_name/$package_name id: $package_id");
+ }
+
+ $db_package = new DBPackage($package_id);
+
+ if($p->mtime != $db_package->mtime)
+ $db_package->mtime = $p->mtime;
+ if($p->ctime != $db_package->ctime)
+ $db_package->ctime = $p->ctime;
+ if($p->changelog != $db_package->changelog)
+ $db_package->changelog = $p->changelog;
+
+
+ }
}
}