diff options
author | 2010-01-02 20:33:08 +0000 | |
---|---|---|
committer | 2010-01-02 20:33:08 +0000 | |
commit | 60f30bc3874cbcf2bcd507b25b0a38190c3963a0 (patch) | |
tree | ad9fe36a564fca71c21bf965598d3fb431a827a7 | |
parent | notes (diff) | |
download | znurt-org-backend-60f30bc3874cbcf2bcd507b25b0a38190c3963a0.tar.gz znurt-org-backend-60f30bc3874cbcf2bcd507b25b0a38190c3963a0.tar.bz2 znurt-org-backend-60f30bc3874cbcf2bcd507b25b0a38190c3963a0.zip |
cleanup; arr_update should work now
git-svn-id: file:///var/svn/portage@53 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
-rw-r--r-- | import.ebuilds.php | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/import.ebuilds.php b/import.ebuilds.php index f5dc49d..84a39fe 100644 --- a/import.ebuilds.php +++ b/import.ebuilds.php @@ -156,14 +156,14 @@ else $arr_db_ebuilds = array(); - $obj_package = new PortagePackage($category_name, $package_name); + $p = new PortagePackage($category_name, $package_name); $package_id =& $arr_db[$category_name][$package_name]; // If there are any old ebuilds (in the DB), then compare the new (in portage) if(count($arr_db_ebuilds)) { - $arr_fs_ebuilds = $obj_package->getEbuilds(); + $arr_fs_ebuilds = $p->getEbuilds(); // Check old against new $arr_delete = array_diff($arr_db_ebuilds, $arr_fs_ebuilds); @@ -174,14 +174,14 @@ foreach($arr_fs_ebuilds as $ebuild_name) { - $obj_ebuild = new PortageEbuild("$category_name/$ebuild_name"); + $e = new PortageEbuild("$category_name/$ebuild_name"); $ebuild = $arr_ebuild_ids[$category_name][$package_name][$ebuild_name]; if($ebuild) { $db_ebuild = new DBEbuild($ebuild); - if(($obj_ebuild->portage_mtime != $db_ebuild->portage_mtime) || ($obj_ebuild->cache_mtime != $db_ebuild->cache_mtime)) { + if(($e->portage_mtime != $db_ebuild->portage_mtime) || ($e->cache_mtime != $db_ebuild->cache_mtime)) { $arr_update[] = $ebuild_name; $arr_insert[] = $ebuild_name; @@ -206,8 +206,8 @@ $ebuild = $arr_ebuild_ids[$category_name][$package_name][$ebuild_name]; if($ebuild) { - $arr_update = array('status' => 2); - $db->autoExecute('ebuild', $arr_update, MDB2_AUTOQUERY_UPDATE, "id = ".$db->quote($id)); + $tmp_update = array('status' => 2); + $db->autoExecute('ebuild', $tmp_update, MDB2_AUTOQUERY_UPDATE, "id = ".$db->quote($id)); } } } @@ -215,7 +215,7 @@ } // Otherwise, insert all of them else { - $arr_insert = $obj_package->getEbuilds(); + $arr_insert = $p->getEbuilds(); } if(count($arr_insert)) { @@ -227,7 +227,7 @@ if($verbose) shell::msg("[insert] $category_name/$ebuild_name"); - $obj_ebuild = new PortageEbuild("$category_name/$ebuild_name"); + $e = new PortageEbuild("$category_name/$ebuild_name"); if(in_array($ebuild_name, $arr_update)) { $udate = $now; @@ -236,22 +236,22 @@ $arr = array( 'package' => $package_id, - 'pf' => $obj_ebuild->pf, - 'pv' => $obj_ebuild->pv, - 'pr' => $obj_ebuild->pr, - 'pvr' => $obj_ebuild->pvr, - 'alpha' => $obj_ebuild->_alpha, - 'beta' => $obj_ebuild->_beta, - 'pre' => $obj_ebuild->_pre, - 'rc' => $obj_ebuild->_rc, - 'p' => $obj_ebuild->_p, - 'version' => $obj_ebuild->version, - 'slot' => $obj_ebuild->slot, - 'portage_mtime' => $obj_ebuild->portage_mtime, - 'cache_mtime' => $obj_ebuild->cache_mtime, + 'pf' => $e->pf, + 'pv' => $e->pv, + 'pr' => $e->pr, + 'pvr' => $e->pvr, + 'alpha' => $e->_alpha, + 'beta' => $e->_beta, + 'pre' => $e->_pre, + 'rc' => $e->_rc, + 'p' => $e->_p, + 'version' => $e->version, + 'slot' => $e->slot, + 'portage_mtime' => $e->portage_mtime, + 'cache_mtime' => $e->cache_mtime, 'status' => 1, 'udate' => $udate, - 'source' => $obj_ebuild->source, + 'source' => $e->source, ); $db->autoExecute('ebuild', $arr, MDB2_AUTOQUERY_INSERT); @@ -267,6 +267,11 @@ } + unset($e); + unset($p); + unset($db_ebuild); + unset($db_package); + // Update the package_recent entries $sql = "DELETE FROM package_recent WHERE status = 1;"; $db->query($sql); |