Changeset 423


Ignore:
Timestamp:
May 1, 2008, 12:21:49 PM (14 years ago)
Author:
nick
Message:

Command line delete tool

Location:
wiki-toolkit/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • wiki-toolkit/trunk/MANIFEST

    r411 r423  
    66SIGNATURE
    77bin/wiki-toolkit-rename-node
     8bin/wiki-toolkit-delete-node
    89bin/wiki-toolkit-setupdb
    910bin/user-setup-mysql-dbixfts.pl
  • wiki-toolkit/trunk/lib/Wiki/Toolkit/Store/Database.pm

    r420 r423  
    11221122        post_delete_node($name,$node_id,$version,$args{plugins});
    11231123    return 1;
     1124}
     1125
     1126# Returns the name of the node with the given ID
     1127# Not normally used except when doing low-level maintenance
     1128sub node_name_for_id {
     1129        my ($self, $node_id) = @_;
     1130    my $dbh = $self->dbh;
     1131
     1132    my $name_sql = "SELECT name FROM node WHERE id=?";
     1133    my $name_sth = $dbh->prepare($name_sql);
     1134    $name_sth->execute($node_id);
     1135        my ($name) = $name_sth->fetchrow_array;
     1136    $name_sth->finish;
     1137
     1138        return $name;
    11241139}
    11251140
  • wiki-toolkit/trunk/t/004_write_and_retrieve.t

    r209 r423  
    66    plan skip_all => "no backends configured";
    77} else {
    8     plan tests => ( 11 * scalar @Wiki::Toolkit::TestLib::wiki_info );
     8    plan tests => ( 12 * scalar @Wiki::Toolkit::TestLib::wiki_info );
    99}
    1010
     
    3838            "...and false for a nonexistent one" );
    3939
     40    # Test -> node_name_for_id
     41    my $id = $wiki->store->{_dbh}->selectrow_array("SELECT id FROM node WHERE name = 'A Node'");
     42    is( "A Node", $wiki->store->node_name_for_id($id),
     43        "Can fetch the name of a node with a id" );
    4044}
Note: See TracChangeset for help on using the changeset viewer.