00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 define( "EZ_SDK_VERSION_MAJOR", 3 );
00034 define( "EZ_SDK_VERSION_MINOR", 9 );
00035 define( "EZ_SDK_VERSION_RELEASE", 5 );
00036 define( "EZ_SDK_VERSION_STATE", '' );
00037 define( "EZ_SDK_VERSION_DEVELOPMENT", false );
00038 define( "EZ_SDK_VERSION_REVISION_STRING", '$Rev: 20214 $' );
00039 define( "EZ_SDK_VERSION_ALIAS", '3.9' );
00040 define( "EZ_SDK_VERSION_REVISION", preg_replace( "#\\\$Rev:\s+([0-9]+)\s+\\\$#", '$1', EZ_SDK_VERSION_REVISION_STRING ) );
00041
00042 class eZPublishSDK
00043 {
00044
00045
00046
00047
00048
00049 function version( $withRelease = true, $asAlias = false, $withState = true )
00050 {
00051 if ( $asAlias )
00052 {
00053 $versionText = eZPublishSDK::alias();
00054 if ( $withState )
00055 $versionText .= "-" . eZPublishSDK::state();
00056 }
00057 else
00058 {
00059 $versionText = eZPublishSDK::majorVersion() . '.' . eZPublishSDK::minorVersion();
00060
00061
00062
00063
00064 if ( $withRelease )
00065 $versionText .= "." . eZPublishSDK::release();
00066 if ( $withState )
00067 $versionText .= eZPublishSDK::state();
00068 }
00069 return $versionText;
00070 }
00071
00072
00073
00074
00075 function majorVersion()
00076 {
00077 return EZ_SDK_VERSION_MAJOR;
00078 }
00079
00080
00081
00082
00083 function minorVersion()
00084 {
00085 return EZ_SDK_VERSION_MINOR;
00086 }
00087
00088
00089
00090
00091 function state()
00092 {
00093 return EZ_SDK_VERSION_STATE;
00094 }
00095
00096
00097
00098
00099 function developmentVersion()
00100 {
00101 return EZ_SDK_VERSION_DEVELOPMENT;
00102 }
00103
00104
00105
00106
00107 function release()
00108 {
00109 return EZ_SDK_VERSION_RELEASE;
00110 }
00111
00112
00113
00114
00115 function revision()
00116 {
00117 return EZ_SDK_VERSION_REVISION;
00118 }
00119
00120
00121
00122
00123 function alias()
00124 {
00125 return eZPublishSDK::version();
00126 }
00127
00128
00129
00130
00131
00132 function databaseVersion( $withRelease = true )
00133 {
00134 include_once( 'lib/ezdb/classes/ezdb.php' );
00135 $db =& eZDB::instance();
00136 $rows = $db->arrayQuery( "SELECT value as version FROM ezsite_data WHERE name='ezpublish-version'" );
00137 $version = false;
00138 if ( count( $rows ) > 0 )
00139 {
00140 $version = $rows[0]['version'];
00141 if ( $withRelease )
00142 {
00143 $release = eZPublishSDK::databaseRelease();
00144 $version .= '-' . $release;
00145 }
00146 }
00147 return $version;
00148 }
00149
00150
00151
00152
00153 function databaseRelease()
00154 {
00155 include_once( 'lib/ezdb/classes/ezdb.php' );
00156 $db =& eZDB::instance();
00157 $rows = $db->arrayQuery( "SELECT value as release FROM ezsite_data WHERE name='ezpublish-release'" );
00158 $release = false;
00159 if ( count( $rows ) > 0 )
00160 {
00161 $release = $rows[0]['release'];
00162 }
00163 return $release;
00164 }
00165 }
00166
00167 ?>