On Dec 16, 9:46 am, "Chris Meller" <[email protected]> wrote:
> There's no automated way to do this, nor really a convenient way to write a
> script to do it that could be run manually.
<?php
// on post-commit:
$db = new PDO('sqlite:/home/habari/public_html/trac.habariproject.org/
htdocs/habari-extras/db/trac.db');
$results = $db->query('SELECT name FROM component');
while ($row = $results->fetch(PDO::FETCH_ASSOC)) {
$names[$row['name']] = $row['name'];
}
$plugins = glob('/home/habari/public_html/svn.habariproject.org/
private/extras-export/plugins/*');
$themes = glob('/home/habari/public_html/svn.habariproject.org/private/
extras-export/themes/*');
$components = array_merge($plugins, $themes);
$components = array_map('basename', $components);
$present = array();
$missing = array();
foreach($components as $component) {
if(isset($names[$component])) {
// Just in case we want this info:
$present[$component] = $component;
}
else {
$missing[$component] = $component;
}
}
foreach($missing as $component) {
$results = $db->query("INSERT INTO component (name) VALUES
('$component');");
}
?>
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/habari-dev
-~----------~----~----~----~------~----~------~--~---