ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-tags.ext
(Generate patch)

Comparing deliantra/server/ext/map-tags.ext (file contents):
Revision 1.5 by root, Thu Sep 13 08:35:24 2007 UTC vs.
Revision 1.6 by root, Thu Sep 13 12:36:25 2007 UTC

104 104
105sub reload { 105sub reload {
106 my $start = Event::time; 106 my $start = Event::time;
107 107
108 # 1. check for maps no longer existing 108 # 1. check for maps no longer existing
109 {
110 my @delkeys;
111
112 my $cursor = $db_mapinfo->cursor;
113 for (;;) {
114 BDB::db_c_get $cursor, my $key, my $data, BDB::NEXT;
115 last if $!;
116
117 my $data = JSON::XS::from_json $data;
118 my ($ver, undef, undef, $path) = split /,/, $data->{hash}, 4;
119 push @delkeys, [$key, $data->{tags}]
120 if $ver != 1 || Coro::AIO::aio_stat $path;
121 }
122 BDB::db_c_close $cursor;
123
124 for (@delkeys) {
125 my ($key, $tags) = @$_;
126 my $txn = $cf::DB_ENV->txn_begin;
127 BDB::db_del $db_mapinfo, $txn, $key;
128 for my $tag (@{ $tags || [] }) {
129 remove_tag_target $txn, $tag, $key;
130 }
131 BDB::db_txn_commit $txn;
132 }
133 }
109 134
110 # 2. scan all static maps 135 # 2. scan all static maps
111 scan_static $cf::MAPDIR, "/"; 136 scan_static $cf::MAPDIR, "/";
112 137
113 # 3. scan all dynamic maps 138 # 3. scan all dynamic maps

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines