summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'import.licenses.php')
-rw-r--r--import.licenses.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/import.licenses.php b/import.licenses.php
new file mode 100644
index 0000000..dccb612
--- /dev/null
+++ b/import.licenses.php
@@ -0,0 +1,30 @@
+<?
+
+ require_once 'header.php';
+ require_once '../class.portage.tree.php';
+
+ $tree = new PortageTree();
+ $table = 'license';
+
+ $arr = $tree->getLicenses();
+
+ $arr_diff = importDiff($table, $arr);
+ $arr_diff = null;
+
+ if(count($arr_diff['delete'])) {
+ foreach($arr_diff['delete'] as $name) {
+ $sql = "DELETE FROM $table WHERE name = ".$db->quote($name).";";
+ $db->query($sql);
+ }
+ }
+
+ if(count($arr_diff['insert'])) {
+ foreach($arr_diff['insert'] as $name) {
+ $arr_insert = array('name' => $name);
+ $db->autoExecute($table, $arr_insert, MDB2_AUTOQUERY_INSERT);
+ }
+ }
+
+ unset($arr, $arr_diff);
+
+?> \ No newline at end of file