diff options
Diffstat (limited to 'import.categories.php')
-rw-r--r-- | import.categories.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/import.categories.php b/import.categories.php index 201cb41..0bec245 100644 --- a/import.categories.php +++ b/import.categories.php @@ -1,11 +1,15 @@ <? require_once 'header.php'; - require_once 'class.portage.tree.php'; + + if(!$tree) { + require_once 'class.portage.tree.php'; + $tree = new PortageTree(); + } + require_once 'class.portage.category.php'; require_once 'class.db.category.php'; - $tree = new PortageTree(); $table = 'category'; $arr = $tree->getCategories(); @@ -27,6 +31,10 @@ } } + // FIXME I should check the mtimes of the directories + // instead, just to get an idea of when things were + // last changed. Also, store the metadata mtime. + // Update descriptions $sql = "SELECT name, id FROM category;"; $arr = $db->getAssoc($sql); @@ -34,10 +42,10 @@ foreach($arr as $category_name => $category) { $db_category = new DBCategory($category); - $obj_category = new PortageCategory($category_name); + $c = new PortageCategory($category_name); - if($db_category->description != $obj_category->description['en']) - $db_category->description = $obj_category->description['en']; + if($db_category->description != $c->description['en']) + $db_category->description = $c->description['en']; } |