From bf4a9c7a838ee8ac279fd0084535d67b1b59930a Mon Sep 17 00:00:00 2001 From: Steve Dibb Date: Mon, 8 Feb 2010 16:43:20 +0000 Subject: Use new classes git-svn-id: file:///var/svn/portage@81 3218660a-b0cf-4799-a991-8ddcc5b9e0f3 --- import.packages.php | 86 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 74 insertions(+), 12 deletions(-) diff --git a/import.packages.php b/import.packages.php index ea555c4..0692f7c 100644 --- a/import.packages.php +++ b/import.packages.php @@ -1,6 +1,6 @@ $category_id, 'name' => $package_name, - '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); + + $package_id = $db->lastInsertID(); + + // New changelog entry + $arr_insert = array( + 'package' => $package_id, + 'changelog' => $ch->changelog, + 'mtime' => $ch->mtime, + 'hash' => $ch->hash, + 'filesize' => $ch->filesize, + ); + + $db->autoExecute('package_changelog', $arr_insert, MDB2_AUTOQUERY_INSERT); + + // New Manifest entry + $arr_insert = array( + 'package' => $package_id, + 'manifest' => $ma->manifest, + 'mtime' => $ma->mtime, + 'hash' => $ma->hash, + 'filesize' => $ma->filesize, + ); + + $db->autoExecute('package_manifest', $arr_insert, MDB2_AUTOQUERY_INSERT); + + // Import package files + $arr = $ma->getDistfiles(); + + foreach($arr as $filename) { + + $arr_insert = array( + 'package' => $package_id, + 'filename' => $filename, + 'type' => 'DIST', + 'hash' => $ma->getHash($filename), + 'filesize' => $ma->getFilesize($filename), + ); + + $db->autoExecute('package_files', $arr_insert, MDB2_AUTOQUERY_INSERT); + + } + + // Import patches + $arr = $ma->getFiles(); + + foreach($arr as $filename) { + + $arr_insert = array( + 'package' => $package_id, + 'filename' => $filename, + 'type' => 'AUX', + 'hash' => $ma->getHash($filename), + 'filesize' => $ma->getFilesize($filename), + ); + + $db->autoExecute('package_files', $arr_insert, MDB2_AUTOQUERY_INSERT); + + } + } } } - unset($c); + unset($c, $p, $ch, $ma); foreach($arr_update as $category_name => $arr_packages) { @@ -162,13 +224,13 @@ $db_package->status = 1; } - if($p->changelog_mtime != $db_package->changelog_mtime) { - $db_package->changelog_mtime = $p->changelog_mtime; - $db_package->changelog = $p->changelog; - } - - if($p->metadata_mtime != $db_package->metadata_mtime) - $db_package->metadata_mtime = $p->metadata_mtime; +// if($p->changelog_mtime != $db_package->changelog_mtime) { +// $db_package->changelog_mtime = $p->changelog_mtime; +// $db_package->changelog = $p->changelog; +// } +// +// if($p->metadata_mtime != $db_package->metadata_mtime) +// $db_package->metadata_mtime = $p->metadata_mtime; } } -- cgit v1.2.3-65-gdbad