FreenetIS
 All Classes Namespaces Functions Variables Pages
Static Public Member Functions | Public Attributes | List of all members
Version Class Reference

Class for versioning of FreenetIS. More...

Static Public Member Functions

static get_version ()
 Gets version of Freenetis code.
static get_db_version ($cache=TRUE)
 Gets version of Freenetis database.
static is_db_up_to_date ()
 Check if the version of database is equal.
static compare ($version1, $version2)
 Compares two valid versions of FreenetIS.
static make_db_up_to_date ()
 Makes database updates if there are any.

Public Attributes

const VERSION_REGEX = '^(([0-9]+\.[0-9]+\.[0-9]+)(~(alpha|beta|dev|rc)[0-9]*)?)$'
 Regex for valitadation of versions.

Detailed Description

Class for versioning of FreenetIS.

Manages source code and database versions and it performs database upgrade.

Author
Ondrej Fibich
See Also
Controller

Member Function Documentation

static Version::compare (   $version1,
  $version2 
)
static

Compares two valid versions of FreenetIS.

Parameters
string$version1
string$version2
Returns
integer -1 if the first version is lower than the second version, 0 if they are equal, and 1 if the second is lower
Exceptions
InvalidArgumentExceptionOn invalid version
static Version::get_db_version (   $cache = TRUE)
static

Gets version of Freenetis database.

Parameters
$cacheMay be value returned from cache [optional]
Returns
string Version
static Version::get_version ( )
static

Gets version of Freenetis code.

Returns
string Version
static Version::is_db_up_to_date ( )
static

Check if the version of database is equal.

Returns
boolean true if versions are equal
static Version::make_db_up_to_date ( )
static

Makes database updates if there are any.

Updates are located at /db_upgrades. Each upgrade has a name that consist of 'upgrade' and version (similar to version in /version.php).

If any error occure during an upgrade. A location of the error is stored in the config DB table in a form of a midpoint. The upgrade starts from the stored midpoind in the next attempt to do the upgrade. Midpoint for before function is a number lower than zero and for after function is it a number greater than a count of SQL commands in the upgrade.

Exceptions
Database_Downgrate_ExceptionOn not allowed database downgrade. (e.g. FN: 1.0.0 - DB: 1.1.0)
Old_Mechanism_ExceptionOn old upgrade mechanism
Not_Enabled_Upgrade_ExceptionOn not enabled upgrade between DB versions
ExceptionOn any other error

The documentation for this class was generated from the following file: