/
version.php
167 lines (154 loc) · 4.57 KB
/
version.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
//
// Created on: <29-May-2002 10:38:45 bf>
//
// ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
// SOFTWARE NAME: eZ Publish
// SOFTWARE RELEASE: 4.0.x
// COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
// SOFTWARE LICENSE: GNU General Public License v2.0
// NOTICE: >
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2.0 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 version 2.0 of the GNU General
// Public License along with this program; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
// MA 02110-1301, USA.
//
//
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
/*!
\brief contains the eZ Publish SDK version.
*/
class eZPublishSDK
{
const VERSION_MAJOR = 4;
const VERSION_MINOR = 0;
const VERSION_RELEASE = 7;
const VERSION_STATE = '';
const VERSION_DEVELOPMENT = false;
const VERSION_REVISION_STRING = '$Rev$';
const VERSION_ALIAS = '4.0';
const VERSION_REVISION = 19785;
/*!
\return the SDK version as a string
\param withRelease If true the release version is appended
\param withAlias If true the alias is used instead
*/
static function version( $withRelease = true, $asAlias = false, $withState = true )
{
if ( $asAlias )
{
$versionText = eZPublishSDK::alias();
if ( $withState )
$versionText .= "-" . eZPublishSDK::state();
}
else
{
$versionText = eZPublishSDK::majorVersion() . '.' . eZPublishSDK::minorVersion();
// $development = eZPublishSDK::developmentVersion();
// $revision = eZPublishSDK::revision();
// if ( $development !== false )
// $versionText .= '.' . $development;
if ( $withRelease )
$versionText .= "." . eZPublishSDK::release();
if ( $withState )
$versionText .= eZPublishSDK::state();
}
return $versionText;
}
/*!
\return the major version
*/
static function majorVersion()
{
return eZPublishSDK::VERSION_MAJOR;
}
/*!
\return the minor version
*/
static function minorVersion()
{
return eZPublishSDK::VERSION_MINOR;
}
/*!
\return the state of the release
*/
static function state()
{
return eZPublishSDK::VERSION_STATE;
}
/*!
\return the development version or \c false if this is not a development version
*/
static function developmentVersion()
{
return eZPublishSDK::VERSION_DEVELOPMENT;
}
/*!
\return the release number
*/
static function release()
{
return eZPublishSDK::VERSION_RELEASE;
}
/*!
\return the SVN revision number
*/
static function revision()
{
return eZPublishSDK::VERSION_REVISION;
}
/*!
\return the alias name for the release, this is often used for beta releases and release candidates.
*/
static function alias()
{
return eZPublishSDK::version();
}
/*!
\return the version of the database.
\param withRelease If true the release version is appended
*/
static function databaseVersion( $withRelease = true )
{
//include_once( 'lib/ezdb/classes/ezdb.php' );
$db = eZDB::instance();
$rows = $db->arrayQuery( "SELECT value as version FROM ezsite_data WHERE name='ezpublish-version'" );
$version = false;
if ( count( $rows ) > 0 )
{
$version = $rows[0]['version'];
if ( $withRelease )
{
$release = eZPublishSDK::databaseRelease();
$version .= '-' . $release;
}
}
return $version;
}
/*!
\return the release of the database.
*/
static function databaseRelease()
{
//include_once( 'lib/ezdb/classes/ezdb.php' );
$db = eZDB::instance();
$rows = $db->arrayQuery( "SELECT value as release FROM ezsite_data WHERE name='ezpublish-release'" );
$release = false;
if ( count( $rows ) > 0 )
{
$release = $rows[0]['release'];
}
return $release;
}
}
?>