diff options
author | Steve Dibb <beandog@gentoo.org> | 2009-12-15 20:44:20 +0000 |
---|---|---|
committer | Steve Dibb <beandog@gentoo.org> | 2009-12-15 20:44:20 +0000 |
commit | 09088aa9aee870ff3e9dc490683976d224a68b4b (patch) | |
tree | 99637a9cd8193a2c937a3efd0e09d6726055916a /import.ebuild_homepage.php | |
download | znurt-org-backend-09088aa9aee870ff3e9dc490683976d224a68b4b.tar.gz znurt-org-backend-09088aa9aee870ff3e9dc490683976d224a68b4b.tar.bz2 znurt-org-backend-09088aa9aee870ff3e9dc490683976d224a68b4b.zip |
initial commit
git-svn-id: file:///var/svn/portage@1 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
Diffstat (limited to 'import.ebuild_homepage.php')
-rw-r--r-- | import.ebuild_homepage.php | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/import.ebuild_homepage.php b/import.ebuild_homepage.php new file mode 100644 index 0000000..fad0537 --- /dev/null +++ b/import.ebuild_homepage.php @@ -0,0 +1,67 @@ +<? + + $verbose = true; + $qa = true; + + + require_once 'header.php'; + require_once '../class.portage.tree.php'; + require_once '../class.portage.category.php'; + require_once '../class.portage.package.php'; + require_once '../class.portage.ebuild.php'; + + // Find all the ebuilds that are missing ebuild arch + $sql = "SELECT id, metadata FROM missing_homepage;"; + $arr = $db->getAssoc($sql); + + if($verbose) + shell::msg(count($arr)." ebuilds to check"); + + foreach($arr as $ebuild_id => $homepages) { + + if(!empty($homepages)) + $arr = arrHomepages($homepages); + else { + $arr = array(); + } + + if(count($arr)) { + foreach($arr as $homepage) { + + $arr_insert = array( + 'ebuild' => $ebuild_id, + 'homepage' => $homepage, + ); + + $db->autoExecute('ebuild_homepage', $arr_insert, MDB2_AUTOQUERY_INSERT); + } + } + + + } + + /** + * Create an array of the arch keywords + * + * @param string keywords + * @return array + */ + function arrHomepages($str) { + + $arr = explode(' ', $str); + + $arr_keywords = array(); + + if(count($arr)) { + + foreach($arr as $str) { + if(substr($str, 0, 4) == "http" || substr($str, 0, 6) == "ftp://" || substr($str, 0, 9) == "gopher://") + $arr_homepages[] = $str; + } + } + + return $arr_homepages; + } + + +?>
\ No newline at end of file |