IDEMPIERE-400 Column ad_system.lastbuildinfo is not updated

This commit is contained in:
Elaine Tan 2013-12-27 17:41:42 +08:00
parent 431c0770c7
commit 56f7a0c200
9 changed files with 194 additions and 21 deletions

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
<booleanAttribute key="append.args" value="true"/>
<stringAttribute key="application" value="org.adempiere.base.SignDatabaseBuildApplication"/>
<booleanAttribute key="askclear" value="true"/>
<booleanAttribute key="automaticAdd" value="false"/>
<booleanAttribute key="automaticValidate" value="false"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/sign.database.build"/>
<booleanAttribute key="default" value="false"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-sign.database.build"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.adempiere.server.server_product"/>
<stringAttribute key="selected_target_plugins" value="com.springsource.javax.ejb@default:default,com.springsource.javax.jms@default:default,com.springsource.javax.mail@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.javax.persistence@default:default,com.springsource.javax.transaction@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.org.aopalliance@default:default,com.springsource.org.apache.activemq@default:default,com.springsource.org.apache.commons.logging@default:default,com.springsource.org.apache.kahadb@default:default,javax.el@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.bridge@default:default,org.apache.batik.css@default:default,org.apache.batik.dom.svg@default:default,org.apache.batik.dom@default:default,org.apache.batik.ext.awt@default:default,org.apache.batik.extension@default:default,org.apache.batik.parser@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.batik.xml@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.poi@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit@default:default,org.restlet.ext.net@default:default,org.restlet.ext.ssl@default:default,org.restlet@default:default,org.springframework.aop@default:default,org.springframework.beans@default:default,org.springframework.context@default:default,org.springframework.core@default:default,org.w3c.css.sac@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base@default:default,org.adempiere.eclipse.equinox.http.servlet@default:default,org.adempiere.eclipse.equinox.http.servletbridge@default:default,org.adempiere.eclipse.equinox.servletbridge@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.adempiere.plugin.utils@default:default,org.adempiere.report.jasper.library@default:default,org.adempiere.ui@default:default,org.apache.ecs@default:default,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default,org.idempiere.fitrecorder@default:default,org.idempiere.webservices@default:default,org.w3c.dom.fragment@default:false"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>
<booleanAttribute key="useProduct" value="false"/>
</launchConfiguration>

View File

@ -92,5 +92,18 @@
tableName="AD_InfoColumn">
</callout>
</extension>
<extension
id="org.adempiere.base.SignDatabaseBuildApplication"
name="Sign Database Build"
point="org.eclipse.core.runtime.applications">
<application
cardinality="singleton-global"
thread="main"
visible="true">
<run
class="org.adempiere.base.SignDatabaseBuildApplication">
</run>
</application>
</extension>
</plugin>

View File

@ -0,0 +1,83 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.adempiere.base;
import java.sql.PreparedStatement;
import java.util.logging.Level;
import org.compiere.Adempiere;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
/**
* Sign Database Build
* [ 1851190 ] Running outdated client can cause data corruption
*
* @author Carlos Ruiz
*/
public class SignDatabaseBuildApplication implements IApplication {
private static CLogger s_log = CLogger.getCLogger (SignDatabaseBuildApplication.class);
/* (non-Javadoc)
* @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
*/
@Override
public Object start(IApplicationContext context) throws Exception {
Adempiere.startupEnvironment(false);
CLogMgt.setLevel(Level.FINE);
s_log.info("Sign Database Build");
s_log.info("-------------------");
if (! DB.isConnected()) {
s_log.info("No DB Connection");
System.exit(1);
}
String version = Adempiere.getVersion();
s_log.info("Version = " + version);
System.out.println("Version = " + version);
PreparedStatement updateStmt = null;
try {
String upd = "UPDATE AD_System SET LastBuildInfo = ?";
updateStmt = DB.prepareStatement(upd, null);
updateStmt.setString(1,version);
s_log.info(upd);
System.out.println(upd); // Also show the update to the console
updateStmt.executeUpdate();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
DB.close(updateStmt);
}
return IApplication.EXIT_OK;
}
/* (non-Javadoc)
* @see org.eclipse.equinox.app.IApplication#stop()
*/
@Override
public void stop() {
}
}

View File

@ -160,6 +160,13 @@ public final class Adempiere
return bundle.getVersion().toString();
}
}
else
{
Bundle bundle = Platform.getBundle("org.adempiere.base");
if (bundle != null) {
return bundle.getVersion().toString();
}
}
return "Unknown";
} // getVersion
@ -586,6 +593,16 @@ public final class Adempiere
log.severe ("No Database");
return false;
}
// Check Build
if (!DB.isBuildOK(Env.getCtx()))
{
if (isClient)
System.exit(1);
log = null;
return false;
}
MSystem system = MSystem.get(Env.getCtx()); // Initializes Base Context too
if (system == null)
return false;

View File

@ -606,7 +606,7 @@ public final class DB
public static boolean isBuildOK (Properties ctx)
{
// Check Build
String buildClient = Adempiere.getImplementationVersion();
String buildClient = Adempiere.getVersion();
String buildDatabase = "";
boolean failOnBuild = false;
String sql = "SELECT LastBuildInfo, IsFailOnBuildDiffer FROM AD_System";
@ -650,10 +650,18 @@ public final class DB
log.warning(msg);
return true;
}
JOptionPane.showMessageDialog (null,
msg,
title, JOptionPane.ERROR_MESSAGE);
Env.exitEnv(1);
if (Ini.isClient())
{
JOptionPane.showMessageDialog (null,
msg,
title, JOptionPane.ERROR_MESSAGE);
Env.exitEnv(1);
}
else
{
log.log(Level.SEVERE, msg);
}
return false;
} // isDatabaseOK

View File

@ -4,28 +4,28 @@ root.folder.data=data
root.folder.setup=setup
#linux 64 bits
root.linux.gtk.x86_64=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh
root.linux.gtk.x86_64=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh,file:sign-database-build.sh
root.linux.gtk.x86_64.folder.utils=utils.unix
root.linux.gtk.x86_64.permissions.755=*.sh,**/*.sh
#linux
root.linux.gtk.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh
root.linux.gtk.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh,file:sign-database-build.sh
root.linux.gtk.x86.folder.utils=utils.unix
root.linux.gtk.x86.permissions.755=*.sh,**/*.sh
#mac
root.macosx.cocoa.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh
root.macosx.cocoa.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh,file:sign-database-build.sh
root.macosx.cocoa.x86.folder.utils=utils.unix
root.macosx.cocoa.x86.permissions.755=*.sh,**/*.sh
#mac 64
root.macosx.cocoa.x86_64=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh
root.macosx.cocoa.x86_64=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh,file:sign-database-build.sh
root.macosx.cocoa.x86_64.folder.utils=utils.unix
root.macosx.cocoa.x86_64.permissions.755=*.sh,**/*.sh
#windows
root.win32.win32.x86=file:setup.bat,file:console-setup.bat,file:idempiere-server.bat,file:setup-alt.bat,file:console-setup-alt.bat
root.win32.win32.x86=file:setup.bat,file:console-setup.bat,file:idempiere-server.bat,file:setup-alt.bat,file:console-setup-alt.bat,file:sign-database-build.bat
root.win32.win32.x86.folder.utils=utils.windows
#windows 64
root.win32.win32.x86_64=file:setup.bat,file:console-setup.bat,file:idempiere-server.bat,file:setup-alt.bat,file:console-setup-alt.bat
root.win32.win32.x86_64=file:setup.bat,file:console-setup.bat,file:idempiere-server.bat,file:setup-alt.bat,file:console-setup-alt.bat,file:sign-database-build.bat
root.win32.win32.x86_64.folder.utils=utils.windows
#solaris
root.solaris.gtk.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh
root.solaris.gtk.x86=file:setup.sh,file:console-setup.sh,file:idempiere-server.sh,file:setup-alt.sh,file:console-setup-alt.sh,file:sign-database-build.sh
root.solaris.gtk.x86.folder.utils=utils.unix
root.solaris.gtk.x86.permissions.755=*.sh,**/*.sh

View File

@ -0,0 +1,19 @@
@Title Sign Database Build
@Echo off
@REM Sign Database Build
idempiere --launcher.ini setup.ini -application org.adempiere.base.SignDatabaseBuildApplication
@Echo ErrorLevel = %ERRORLEVEL%
@IF NOT ERRORLEVEL = 1 GOTO NEXT
@Echo ***************************************
@Echo Check the error message above.
@Echo ***************************************
@Pause
@Exit
@Echo .
@Echo For problems, check log file in base directory
@Rem Wait 10 second
@PING 1.1.1.1 -n 1 -w 10000 > NUL

View File

@ -0,0 +1,9 @@
#!/bin/sh
#
echo Sign Database Build
# Sign Database Build
./idempiere --launcher.ini setup.ini -application org.adempiere.base.SignDatabaseBuildApplication
echo .
echo For problems, check log file in base directory

View File

@ -287,13 +287,6 @@ public final class AMenu extends CFrame
if (!login.isConnected() || !login.isOKpressed())
AEnv.exit(1);
}
// Check Build
if (!DB.isBuildOK(m_ctx))
AEnv.exit(1);
// Check DB (AppsServer Version checked in Login)
DB.isDatabaseOK(m_ctx);
} // initSystem
// UI