IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24461


Ignore:
Timestamp:
Jun 17, 2009, 12:25:54 PM (17 years ago)
Author:
jhoblitt
Message:

update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/scripts/dirize.pl

    r24404 r24461  
    3737
    3838# initial directory fill in
    39 my $query = $db->prepare_cached("SELECT so_id, ext_id, dir_id FROM storage_object AS so WHERE so.dir_id = 0 LIMIT 100000");
     39my $work_query = $db->prepare_cached("SELECT so_id, ext_id, dir_id FROM storage_object AS so WHERE so.dir_id = 0 LIMIT 10000");
    4040
     41my $update_query = $db->prepare_cached("UPDATE storage_object SET ext_id_basename = ?, dir_id = ? WHERE so_id = ?");
     42
     43# turn of fkeys, otherwise we can change storage_object.dir_id to a
     44# non-existant value
    4145$db->do("SET FOREIGN_KEY_CHECKS=0");
    42 #$db->do("UPDATE storage_object SET dir_id = 0");
    43 #$db->do("DELETE FROM directory");
     46$db->do("UPDATE storage_object SET dir_id = 0");
     47
     48# completely reset the directory table
     49$db->do("DELETE FROM directory");
     50$db->do("ALTER TABLE directiry AUTO_INCREMENT = 1");
     51# seed the root ('/') directory
     52$db->do("INSERT INTO directory VALUES(1, '/', 1");
    4453
    4554my $i = 0;
    46 while ($query->execute and $query->rows) {
    47     while (my $row = $query->fetchrow_hashref) {
     55while ($work_query->execute and $work_query->rows) {
     56    while (my $row = $work_query->fetchrow_hashref) {
    4857        $i++;
    4958        my $key = parse_neb_key($row->{'ext_id'});
     
    5362#        printf("$i dirizing %s\n", $key->path);
    5463
    55         my $q = $db->prepare_cached("UPDATE storage_object SET ext_id_basename = ?, dir_id = ? WHERE so_id = ?");
    56         $q->execute(basename($row->{'ext_id'}), $parent_id, $row->{'so_id'});
     64        $update_query->execute(basename($row->{'ext_id'}), $parent_id, $row->{'so_id'});
    5765    }
    5866    $db->commit;
     
    6371
    6472$db->do("SET FOREIGN_KEY_CHECKS=1");
    65 
    66 # remove unused dirs
    67 #$db-do("");
    68 #$db->commit;
     73$db->commit;
Note: See TracChangeset for help on using the changeset viewer.