summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+
+
+ }
}
}