From: Greg Sabino Mullane Date: Wed, 30 Apr 2008 14:44:22 +0000 (+0000) Subject: Check that no MySQL-isms have snuck into the codebase. X-Git-Tag: 1.31.0-rc.0~47988 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=db16a073572b5c26f6643cc53c6e96802a4590c6;p=lhc%2Fweb%2Fwiklou.git Check that no MySQL-isms have snuck into the codebase. --- diff --git a/maintenance/postgres/compare_schemas.pl b/maintenance/postgres/compare_schemas.pl index 2a74ae3b3d..fd06502425 100644 --- a/maintenance/postgres/compare_schemas.pl +++ b/maintenance/postgres/compare_schemas.pl @@ -2,11 +2,14 @@ ## Rough check that the base and postgres "tables.sql" are in sync ## Should be run from maintenance/postgres +## Checks a few other things as well... use strict; use warnings; use Data::Dumper; +check_includes_dir(); + my @old = ('../tables.sql'); my $new = 'tables.sql'; my @xfile; @@ -453,6 +456,39 @@ for (sort keys %new) { } ## end each file to be parsed +sub check_includes_dir { + + ## Check for some common errors in the files in the includes directory + + print "Checking files in includes directory...\n"; + my $dir = "../../includes"; + opendir my $dh, $dir or die qq{Could not opendir $dir: $!\n}; + for my $file (grep { -f "$dir/$_" and /\.php$/ } readdir $dh) { + $file = "$dir/$file"; + open my $fh, '<', $file or die qq{Could not open "$file": $!\n}; + while (<$fh>) { + if (/FORCE INDEX/ and $file !~ /Database.php/) { + warn "Found FORCE INDEX string at line $. of $file\n"; + } + if (/REPLACE INTO/ and $file !~ /Database/) { + warn "Found REPLACE INTO string at line $. of $file\n"; + } + if (/\bIF\s*\(/ and $file !~ /Database.php/) { + warn "Found IF string at line $. of $file\n"; + } + if (/\bCONCAT\b/ and $file !~ /Database.php/) { + warn "Found CONCAT string at line $. of $file\n"; + } + } + close $fh or die qq{Could not close "$file": $!\n}; + } + closedir $dh or die qq{Closedir failed?!\n}; + + + + +} ## end of check_includes_dir + __DATA__ ## Known exceptions OLD: searchindex ## We use tsearch2 directly on the page table instead