WeBid Bug Tracking

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000293WeBidLanguagepublic2011-06-26 06:592016-04-25 16:22
ReporterLunkwill 
Assigned Torenlok 
PriorityimmediateSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version1.0.2 
Target Version1.2.0Fixed in Version1.2.0 
Summary0000293: Minor messages.inc.php issue, perhaps more
DescriptionI just noticed $MSG['159'] is a duplicate in messages.inc.php.

To check for more such cases I wrote a little Perl hack to check the file (see below) and extended it to search for potentially obsolete/unused messages. While it found no further duplicates, a whole bunch came up as unused. There are certainly quite a few false positives as e.g. includes/datacheck.inc.php contains calculated error numbers that are very hard to check for. Others like $MSG['179'] seem to be for real though.

If someone feels bored, you might want to check this list and save a little bit of overhead and some work for translators:



Duplicate: $MSG['159']

Possibly unused:

$ERR_002

$ERR_003

$ERR_005

$ERR_007

$ERR_009

$ERR_010

$ERR_012

$ERR_013

$ERR_014

$ERR_015

$ERR_016

$ERR_017

$ERR_018

$ERR_019

$ERR_020

$ERR_021

$ERR_022

$ERR_023

$ERR_024

$ERR_026

$ERR_027

$ERR_028

$ERR_029

$ERR_034

$ERR_035

$ERR_036

$ERR_041

$ERR_042

$ERR_056

$ERR_057

$ERR_060

$ERR_061

$ERR_062

$ERR_063

$ERR_064

$ERR_065

$ERR_066

$ERR_075

$ERR_102

$ERR_106

$ERR_5045

$ERR_5046

$ERR_600

$ERR_601

$ERR_602

$ERR_603

$ERR_607

$ERR_612

$ERR_619

$ERR_700

$ERR_714

$ERR_715

$MSG['007']

$MSG['015']

$MSG['034']

$MSG['036']

$MSG['037']

$MSG['039']

$MSG['040']

$MSG['044']

$MSG['047']

$MSG['049']

$MSG['051']

$MSG['053']

$MSG['054']

$MSG['055']

$MSG['056']

$MSG['057']

$MSG['058']

$MSG['060']

$MSG['073']

$MSG['074']

$MSG['076']

$MSG['077']

$MSG['086']

$MSG['090']

$MSG['091']

$MSG['096']

$MSG['1025']

$MSG['108']

$MSG['115']

$MSG['122']

$MSG['133']

$MSG['136']

$MSG['145']

$MSG['147']

$MSG['150']

$MSG['151']

$MSG['153']

$MSG['155']

$MSG['158']

$MSG['163']

$MSG['172']

$MSG['173']

$MSG['177']

$MSG['178']

$MSG['179']

$MSG['180']

$MSG['182']

$MSG['184']

$MSG['186']

$MSG['190']

$MSG['193']

$MSG['195']

$MSG['196']

$MSG['201']

$MSG['202']

$MSG['212']

$MSG['216']

$MSG['218']

$MSG['223']

$MSG['224']

$MSG['225']

$MSG['226']

$MSG['228']

$MSG['229']

$MSG['230']

$MSG['233']

$MSG['234']

$MSG['246']

$MSG['253']

$MSG['254']

$MSG['255']

$MSG['256']

$MSG['25_0015']

$MSG['25_0038']

$MSG['25_0040']

$MSG['25_0041']

$MSG['25_0042']

$MSG['25_0043']

$MSG['25_0044']

$MSG['25_0045']

$MSG['25_0048']

$MSG['25_0049']

$MSG['25_0056']

$MSG['25_0071']

$MSG['25_0075']

$MSG['25_0076']

$MSG['25_0077']

$MSG['25_0078']

$MSG['25_0108']

$MSG['25_0109']

$MSG['25_0133']

$MSG['25_0134']

$MSG['25_0135']

$MSG['25_0137']

$MSG['25_0138']

$MSG['25_0139']

$MSG['25_0143']

$MSG['25_0157']

$MSG['25_0166']

$MSG['25_0172']

$MSG['25_0186']

$MSG['262']

$MSG['269']

$MSG['285']

$MSG['286']

$MSG['288']

$MSG['289']

$MSG['290']

$MSG['291']

$MSG['304']

$MSG['307']

$MSG['30_0062']

$MSG['30_0067']

$MSG['30_0080']

$MSG['325']

$MSG['326']

$MSG['341']

$MSG['378']

$MSG['384']

$MSG['396']

$MSG['398']

$MSG['400']

$MSG['412']

$MSG['419']

$MSG['456']

$MSG['5003']

$MSG['5005']

$MSG['5006']

$MSG['5011']

$MSG['5012']

$MSG['5019']

$MSG['5025']

$MSG['5033']

$MSG['5064']

$MSG['5067']

$MSG['5092']

$MSG['5093']

$MSG['5140']

$MSG['5141']

$MSG['5155']

$MSG['5157']

$MSG['5159']

$MSG['5160']

$MSG['5170']

$MSG['5181']

$MSG['5182']

$MSG['5183']

$MSG['5184']

$MSG['5185']

$MSG['5187']

$MSG['5188']

$MSG['5200']

$MSG['5220']

$MSG['5221']

$MSG['5222']

$MSG['5223']

$MSG['5224']

$MSG['5225']

$MSG['5228']

$MSG['5235']

$MSG['524']

$MSG['5241']

$MSG['5244']

$MSG['5277']

$MSG['5278']

$MSG['5282']

$MSG['5283']

$MSG['531']

$MSG['556']

$MSG['602']

$MSG['646']

$MSG['647']

$MSG['648']

$MSG['649']

$MSG['662']

$MSG['675']

$MSG['676']

$MSG['728']

$MSG['908']

$MSG['912']

$MSG['913']

$MSG['914']

$MSG['916']

$MSG['917']

$MSG['918']

$MSG['919']

$MSG['MON_001']

$MSG['MON_002']

$MSG['MON_003']

$MSG['MON_004']

$MSG['MON_005']

$MSG['MON_006']

$MSG['MON_007']

$MSG['MON_008']

$MSG['MON_009']

$MSG['MON_010']

$MSG['MON_011']

$MSG['MON_012']

$MSG['_0010']

$MSG['_0012']

$MSG['_0014']

$MSG['_0015']

$MSG['_0016']

$MSG['_0017']

$MSG['_0018']

$MSG['_0044']

$MSG['_0056']

$MSG['_0148']



Here's the script:
#!/usr/bin/perl



use strict;

use warnings;

use IO::File;



unless(2 == @ARGV) {

    my ($name) = $0 =~ m!(?:.*/)?(.*)!;

    print STDERR "Usage: $name <messages file> <phpdir>";

    exit 1;

}



my ($msgfile, $phpdir) = @ARGV;

my %msgs;

my $fh = IO::File->new($msgfile, 'r') or die "Can't read \`$msgfile': $!";

while(<$fh>) {

    chomp;

    next unless /^\s*\$\S+\s*=/;

    s/\s*(\$\S+)\s*=.*/$1/;

    defined $msgs{$_} and print "Duplicate: $_
";

    $msgs{$_} = 1;

}

$fh->close;



PHPFILE:

foreach my $phpfile (qx{find $phpdir -name "*.php"}) {

    chomp $phpfile;

    next if $phpfile =~ m!^$phpdir/?(?:ckeditor|language|includes/(?:phpmailer|HTMLPurifier))/!;

    $fh = IO::File->new($phpfile, 'r') or do {

        print STDERR "Can't read \`$phpfile' ($!), skipping
";

        next PHPFILE;

    };

    my $file = do{local $/;<$fh>};

    foreach(keys %msgs) {

        -1 != index($file, $_) and delete $msgs{$_};

    }

}



TPLFILE:

foreach my $tplfile (qx{find $phpdir -name "*.tpl"}) {

    chomp $tplfile;

    $fh = IO::File->new($tplfile, 'r') or do {

        print STDERR "Can't read \`$tplfile' ($!), skipping
";

        next TPLFILE;

    };

    my $file = do{local $/;<$fh>};

    foreach(map { s/(?:^\{L_|\})//g; $_ } $file =~ /\{L_[^}]+}/g) {

        delete $msgs{"\$MSG['$_']"};

    }

}



print "Possibly unused:
", join("
", sort keys %msgs), "
";

TagsNo tags attached.
import_id295
Thread
Attached Files

- Relationships

-  Notes
(0000755)
Pleb (reporter)
2011-06-26 19:51
edited on: 1970-01-01 00:00

nice,
how do i use code.
(0000756)
Lunkwill (reporter)
2011-06-26 23:58
edited on: 1970-01-01 00:00

Paste it into a file, make it executable and run it :) It wants your messages file as first argument and the site's root directory as the second.
(0001045)
renlok (administrator)
2012-12-13 15:59
edited on: 2012-12-13 16:00

I've fixed the dupe but as for the others each will have to checked off one by one as a lot of the strings are only referenced in the code by their number
(0001401)
renlok (administrator)
2016-04-25 09:42
edited on: 2016-04-25 14:16

Working through this list still to do:
$ERR_026
$ERR_027
$ERR_028
$ERR_029
$ERR_034
$ERR_035
$ERR_036
$ERR_041
$ERR_042
$ERR_056
$ERR_057
$ERR_065
$ERR_066
$ERR_075
$ERR_102
$ERR_106
$ERR_602
$ERR_603
$MSG['015']
$MSG['034']
$MSG['036']
$MSG['037']
$MSG['039']
$MSG['040']
$MSG['044']
$MSG['047']
$MSG['049']
$MSG['051']
$MSG['053']
$MSG['054']
$MSG['055']
$MSG['056']
$MSG['057']
$MSG['058']
$MSG['060']
$MSG['073']
$MSG['074']
$MSG['076']
$MSG['077']
$MSG['086']
$MSG['090']
$MSG['091']
$MSG['096']
$MSG['108']
$MSG['115']
$MSG['122']
$MSG['133']
$MSG['136']
$MSG['145']
$MSG['147']
$MSG['150']
$MSG['151']
$MSG['153']
$MSG['155']
$MSG['158']
$MSG['163']
$MSG['172']
$MSG['173']
$MSG['177']
$MSG['178']
$MSG['179']
$MSG['180']
$MSG['182']
$MSG['184']
$MSG['186']
$MSG['190']
$MSG['193']
$MSG['195']
$MSG['196']
$MSG['201']
$MSG['202']
$MSG['212']
$MSG['216']
$MSG['218']
$MSG['223']
$MSG['224']
$MSG['225']
$MSG['226']
$MSG['228']
$MSG['229']
$MSG['230']
$MSG['233']
$MSG['234']
$MSG['246']
$MSG['253']
$MSG['254']
$MSG['255']
$MSG['256']
$MSG['25_0038']
$MSG['25_0040']
$MSG['25_0041']
$MSG['25_0042']
$MSG['25_0043']
$MSG['25_0045']
$MSG['25_0048']
$MSG['25_0049']
$MSG['25_0056']
$MSG['25_0071']
$MSG['25_0075']
$MSG['25_0076']
$MSG['25_0077']
$MSG['25_0078']
$MSG['25_0108']
$MSG['25_0109']
$MSG['25_0133']
$MSG['25_0134']
$MSG['25_0135']
$MSG['25_0137']
$MSG['25_0138']
$MSG['25_0139']
$MSG['25_0143']
$MSG['25_0157']
$MSG['25_0166']
$MSG['25_0172']
$MSG['25_0186']
$MSG['262']
$MSG['269']
$MSG['285']
$MSG['286']
$MSG['288']
$MSG['289']
$MSG['290']
$MSG['291']
$MSG['304']
$MSG['307']
$MSG['30_0062']
$MSG['30_0067']
$MSG['30_0080']
$MSG['325']
$MSG['326']
$MSG['341']
$MSG['378']
$MSG['384']
$MSG['396']
$MSG['398']
$MSG['400']
$MSG['412']
$MSG['419']


- Issue History
Date Modified Username Field Change
2015-04-01 13:17 renlok New Issue
2015-04-01 13:17 renlok import_id => 295
2015-04-01 13:17 renlok Date Submitted 2015-04-01 13:17 => 2011-06-26 06:59
2015-04-01 13:17 renlok Last Update 2015-04-01 13:17 => 2012-12-13 15:59
2016-04-24 14:17 renlok Target Version => 1.2.0
2016-04-25 09:42 renlok Note Added: 0001401
2016-04-25 14:16 renlok Note Edited: 0001401 View Revisions
2016-04-25 16:22 renlok Status feedback => resolved
2016-04-25 16:22 renlok Fixed in Version => 1.2.0
2016-04-25 16:22 renlok Resolution open => fixed
2016-04-25 16:22 renlok Assigned To => renlok


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker