BUG 5978 Add getVersion to System class and use it instead of PM_VERSION

Instead of every page defining it's own PM_VERSION interpretation,
there is now a single getVersion function in the System class to
always get the right version.
This commit is contained in:
Alexandre Rosenfeld
2011-04-13 16:04:36 -04:00
parent 721a87f6c0
commit f0277f02fb
12 changed files with 62 additions and 101 deletions

View File

@@ -97,13 +97,11 @@ if(isset($_POST['action'])) {
G::LoadCLass('net');
$net = new NET(G::getIpAddress());
if( !defined("PM_VERSION")){
define('PM_VERSION', 'development');
}
G::LoadClass("system");
$META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n".
" @Ver: 1.0 Oct-2009\n".
" @Processmaker version: ".PM_VERSION."\n".
" @Processmaker version: ".System::getVersion()."\n".
" -------------------------------------------------------\n".
" @Export Date: ".date("l jS \of F Y h:i:s A")."\n".
" @Server address: ".getenv('SERVER_NAME')." (".getenv('SERVER_ADDR').")\n".
@@ -237,9 +235,7 @@ if(isset($_POST['function'])) {
G::LoadCLass('net');
$net = new NET(G::getIpAddress());
if( !defined("PM_VERSION")){
define('PM_VERSION', 'development');
}
G::LoadClass("system");
$EXPORT_TRACEBACK = Array();
foreach ($tables as $uid) {
$aTable = new additionalTables();
@@ -297,4 +293,4 @@ function includeClasses($sDirectory, &$aClasses, $bRecursive = false) {
}
}
}
}
}

View File

@@ -116,4 +116,4 @@ if (! defined ( 'SKIP_RENDER_SYSTEM_INFORMATION' )) {
$G_PUBLISH = new Publisher ( );
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/dbInfo', '', $Fields, 'appNew2' );
G::RenderPage ( 'publish', 'raw' );
}
}

View File

@@ -11,11 +11,7 @@ $sWE_USR = $oData->WE_USR;
$withWS = $sWE_TYPE == 'WS';
if (file_exists ( PATH_METHODS . 'login/version-pmos.php' )) {
include_once (PATH_METHODS . 'login/version-pmos.php');
} else {
define ( 'PM_VERSION', 'Dev.' );
}
G::LoadClass("system");
try {
$pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP;
@@ -87,7 +83,7 @@ try {
$template->assign ( 'dynaform', $dynTitle );
$template->assign ( 'timestamp', date ( 'l jS \of F Y h:i:s A' ) );
$template->assign ( 'ws', SYS_SYS );
$template->assign ( 'version', PM_VERSION );
$template->assign ( 'version', System::getVersion() );
$fileName = $pathProcess . $dynTitle . 'Post.php';
file_put_contents ( $fileName, $template->getOutputContent () );

View File

@@ -75,13 +75,7 @@ function file_get_conditional_contents($szURL){
function buildData(){
G::LoadClass ( 'serverConfiguration' );
$oServerConf = & serverConf::getSingleton ();
if (! defined ( 'PM_VERSION' )) {
if (file_exists ( PATH_METHODS . 'login/version-pmos.php' )) {
require_once (PATH_METHODS . 'login/version-pmos.php');
} else {
define ( 'PM_VERSION', 'Development Version' );
}
}
G::LoadClass("system");
$os = '';
if (file_exists ( '/etc/redhat-release' )) {
@@ -106,7 +100,7 @@ $oServerConf = & serverConf::getSingleton ();
$params ['os'] = $os;
$params ['webserver'] = getenv ( 'SERVER_SOFTWARE' );
$params ['php'] = phpversion ();
$params ['pmVersion'] = PM_VERSION;
$params ['pmVersion'] = System::getVersion();
if(class_exists('pmLicenseManager')){
$params ['pmProduct'] = 'PMEE';
}else{
@@ -210,4 +204,4 @@ $oServerConf = & serverConf::getSingleton ();
$this->saveSingleton ();
*/
}
}

View File

@@ -35,13 +35,7 @@ G::LoadSystem('i18n_po');
//$timer = new Benchmark_Timer();
//$timer->start();
if (!defined('PM_VERSION')) {
if (file_exists ( PATH_METHODS . 'login/version-pmos.php')) {
include (PATH_METHODS . 'login/version-pmos.php');
} else {
define('PM_VERSION', 'Development Version');
}
}
G::LoadClass("system");
//creating the .po file
if( ! isset($_GET['LOCALE']) )
@@ -79,7 +73,7 @@ if( ! isset($langRecord['LAN_NAME']) )
$sLanguage = $langRecord['LAN_NAME'];
//setting headers
$poFile->addHeader('Project-Id-Version' , 'ProcessMaker ' . PM_VERSION);
$poFile->addHeader('Project-Id-Version' , 'ProcessMaker ' . System::getVersion());
$poFile->addHeader('POT-Creation-Date' , '');
$poFile->addHeader('PO-Revision-Date' , date('Y-m-d H:i:s'));
$poFile->addHeader('Last-Translator' , '');

View File

@@ -89,11 +89,9 @@ try {
$oClass->iPMVersion = 0;
}
if ($oClass->iPMVersion > 0) {
if (!defined('PM_VERSION')) {
define('PM_VERSION', 0);
}
if (PM_VERSION > 0) {
if ($oClass->iPMVersion > PM_VERSION) {
G::LoadClass("system");
if (System::getVersion() > 0) {
if ($oClass->iPMVersion > System::getVersion()) {
//throw new Exception('This plugin needs version ' . $oClass->iPMVersion . ' or higher of ProcessMaker');
}
}

View File

@@ -117,14 +117,7 @@ switch ($RBAC->userCanAccess('PM_SETUP'))
break;
}
//get the current process
if (file_exists(PATH_METHODS . 'login/version-pmos.php'))
{
include(PATH_METHODS . 'login/version-pmos.php');
}
else {
define('PM_VERSION', '1.2.2740');
}
G::LoadClass("system");
$id = $_GET['id'];
@@ -156,7 +149,7 @@ switch ($RBAC->userCanAccess('PM_SETUP'))
$fields['className'] = $id;
$fields['version'] = $oConf->version;
$fields['description'] = $oConf->description;
$fields['PMversion'] = PM_VERSION;
$fields['PMversion'] = System::getVersion();
savePluginFile ( 'skinPluginMainClass' , $pathHome . $id . '.php', $fields );
savePluginFile ( 'skinPluginClass' , $pathBase . 'class.' . $id . '.php', $fields );

View File

@@ -54,14 +54,7 @@ switch ($RBAC->userCanAccess('PM_SETUP'))
break;
}
//get the current process
if (file_exists(PATH_METHODS . 'login/version-pmos.php'))
{
include('version-pmos.php');
}
else {
define('PM_VERSION', '1.8.320');
}
G::LoadClass("system");
$id = strip_tags ( str_replace ( ' ', '_', trim ($_POST['form']['NAME']) ) );
$desc = $_POST['form']['DESCRIPTION'];
@@ -99,4 +92,4 @@ switch ($RBAC->userCanAccess('PM_SETUP'))
PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images'. PATH_SEP
);
G::Header ( 'Location: ../../' . $id . '/setup/skinsList' );
G::Header ( 'Location: ../../' . $id . '/setup/skinsList' );

View File

@@ -63,19 +63,12 @@ if( $access != 1 ){
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'UPGRADE';
if ( !defined ( 'PM_VERSION' ) ) {
if (file_exists(PATH_METHODS . 'login/version-pmos.php')) {
include(PATH_METHODS . 'login/version-pmos.php');
}
else {
define('PM_VERSION', 'Development Version');
}
}
G::LoadClass("system");
$Fields['PM_VERSION'] = PM_VERSION;
$Fields['PM_VERSION'] = System::getVersion();
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/upgrade', '', $Fields, 'upgrade_System');
G::RenderPage('publishBlank', 'blank');