[dw-free] remove "use constants" lines from S2 layer code
[commit: http://hg.dwscoalition.org/dw-free/rev/ecd40b302765]
http://bugs.dwscoalition.org/show_bug.cgi?id=3139
Remove constants from compiled layers on dev servers, to reduce warning
spam.
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3139
Remove constants from compiled layers on dev servers, to reduce warning
spam.
Patch by
Files modified:
- bin/upgrading/update-db-general.pl
--------------------------------------------------------------------------------
diff -r 9d6bd9196dac -r ecd40b302765 bin/upgrading/update-db-general.pl
--- a/bin/upgrading/update-db-general.pl Fri Oct 22 23:18:04 2010 +0800
+++ b/bin/upgrading/update-db-general.pl Sat Oct 23 00:00:09 2010 +0800
@@ -3864,6 +3864,16 @@ EOF
unless ( column_type( 'acctcode_promo', 'paid_months' ) ) {
do_alter( 'acctcode_promo', "ALTER TABLE acctcode_promo ADD COLUMN paid_months tinyint unsigned" );
}
+
+ if ( $LJ::IS_DEV_SERVER ) {
+ # strip constant definitions from user layers
+ if ( table_relevant( "s2compiled2" ) && ! check_dbnote( "no_layer_constants" ) ) {
+ my $uses = q{ 'use constant VTABLE => 0;\nuse constant STATIC => 1;\nuse constant PROPS => 2;\n' };
+ do_sql( "UPDATE s2compiled2 SET compdata = REPLACE(compdata,$uses,'')" );
+ set_dbnote( "no_layer_constants", 1 );
+ }
+ }
+
});
--------------------------------------------------------------------------------
