Changeset 1005
- Timestamp:
- 04/19/02 10:42:00 (11 years ago)
- Location:
- trunk/bin/upgrading
- Files:
-
- 2 modified
-
texttool.pl (modified) (3 diffs)
-
update-db-general.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/upgrading/texttool.pl
r1001 r1005 29 29 dumptext Dump lang text based on text[-local].dat information 30 30 check Check validity of text[-local].dat files 31 wipedb Remove all language/text data from database. 31 32 newitems Search files in htdocs, cgi-bin, & bin and insert 32 33 necessary text item codes in database. … … 141 142 popstruct() if $mode eq "dump"; 142 143 newitems() if $mode eq "newitems"; 144 wipedb() if $mode eq "wipedb"; 143 145 help(); 146 147 sub wipedb 148 { 149 $dbh->do("DELETE FROM ml_$_") 150 foreach (qw(domains items langdomains langs latest text)); 151 exit 0; 152 } 144 153 145 154 sub popstruct … … 166 175 167 176 print "All done.\n"; 177 exit 0; 178 } 179 180 sub poptext 181 { 182 foreach my $lang (keys %lang_code) 183 { 184 print "$lang\n"; 185 my $l = $lang_code{$lang}; 186 open (D, "$ENV{'LJHOME'}/bin/upgrading/${lang}.dat") 187 or die "Can't find $lang.dat\n"; 188 my $lnum = 0; 189 my ($code, $text); 190 while (my $line = <D>) { 191 $lnum++; 192 if ($line =~ /^(\S+?)=(.*)/) { 193 ($code, $text) = ($1, $2); 194 } elsif ($line =~ /^(\S+?)\<\<\s*$/) { 195 ($code, $text) = ($1, ""); 196 while (<D>) { 197 last if $_ eq ".\n"; 198 s/^\.//; 199 $text .= $_; 200 } 201 } elsif ($line =~ /\S/) { 202 die "$lang.dat:$lnum: Bogus format.\n"; 203 } 204 205 my $qcode = $dbh->quote($code); 206 my $exists = $dbh->selectrow_array("SELECT COUNT(*) FROM ml_latest l, ml_items i ". 207 "WHERE l.dmid=1 AND i.dmid AND i.itcode=$qcode AND ". 208 "i.itid=l.itid AND l.lnid=$l->{'lnid'}"); 209 if (! $exists) { 210 print " adding: $code = "; 211 my $res = LJ::Lang::set_text($dbh, 1, $lang, $code, $text); 212 print "$res\n"; 213 } 214 } 215 close D; 216 } 168 217 exit 0; 169 218 } -
trunk/bin/upgrading/update-db-general.pl
r999 r1005 1416 1416 PRIMARY KEY (lnid, dmid, itid), 1417 1417 chgtime DATETIME NOT NULL, 1418 txtid INT UNSIGNED NOT NULL,1419 version SMALLINT UNSIGNED NOT NULL,1418 staleness TINYINT UNSIGNED DEFAULT 0 NOT NULL, # better than ENUM('0','1','2'); 1419 INDEX (lnid, staleness), 1420 1420 INDEX (dmid, itid), 1421 1421 INDEX (lnid, dmid, chgtime),
