Or that... Hopefully with a bound parameter and not raw string concat,
though.

On Tue, Dec 16, 2008 at 10:24 AM, ringmaster <[email protected]> wrote:

>
> 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'<http://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/*'<http://svn.habariproject.org/private/extras-export/plugins/*'>
> );
> $themes = glob('/home/habari/public_html/svn.habariproject.org/private/
> extras-export/themes/*'<http://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to