ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

Functions | Variables
package_version.php File Reference

Go to the source code of this file.

## Functions
| _compare_versions ($TmpVersion, $Sel)
| _check_tmp_version ($Tmp, &$Sel, &$PackageDirectory, &$pi)
| _get_package_version ($PackageName, $PackageVersion, $ROOT_DIR=INSTALL_DIR)
| _get_package_real_version ($PackageName, $PackageVersion, $ROOT_DIR=INSTALL_DIR)

## Variables
| $FullClassNameCacheChanged = false
| $FullClassNameCache = array()
| $PackageRealVersionCacheChanged = false
| $PackageRealVersionCache = array()

## Function Documentation

_check_tmp_version | ( |  | $Tmp,
|  | & | $Sel,
|  | & | $PackageDirectory,
|  | & | $pi
| ) |  |

Function returns real version of the package.

Parameters

  $Tmp | - Version.
  $Sel | - Version.
  $PackageDirectory | - Package directory.
  $pi | - Package info.

Returns
  true/false.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 99 of file package_version.php.

{
try
{
$TmpVersion = explode( '.' , str_replace( $Tmp , '' , $pi[ 0 ] ) );
if( _compare_versions( $TmpVersion , $Sel ) )
{
$Sel = $TmpVersion;
$PackageDirectory = $pi[ 1 ];
return( true );
}
return( false );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_compare_versions | ( |  | $TmpVersion,
|  |  | $Sel
| ) |  |

Version comparison.

Parameters

  $TmpVersion | - Version.
  $Sel | - Version.

Returns
  true/false.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 48 of file package_version.php.

{
try
{
return(
$TmpVersion[ 0 ] > $Sel[ 0 ] ||
( $TmpVersion[ 0 ] == $Sel[ 0 ] && $TmpVersion[ 1 ] > $Sel[ 1 ] ) ||
( $TmpVersion[ 0 ] == $Sel[ 0 ] && $TmpVersion[ 1 ] == $Sel[ 1 ] &&
$TmpVersion[ 2 ] > $Sel[ 2 ] )
);
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_get_package_real_version | ( |  | $PackageName,
|  |  | $PackageVersion,
|  |  | $ROOT_DIR = `INSTALL_DIR`
| ) |  |

Function returns real version of the package.

Parameters

  $PackageName | - Name of the package.
  $PackageVersion | - Package's version. In case string 'last' is passed, then method returns the latest version.
  $ROOT_DIR | - Name of the root directory. In this directory all package processing will be run.

Returns
  Reference on package's object. If an error occured then method returns false.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 214 of file package_version.php.

{
try
{
global $PackageRealVersionCache;
$Key = "$PackageName $PackageVersion $ROOT_DIR";
if( isset( $PackageRealVersionCache[ $Key ] ) === false )
{
global $PackageRealVersionCacheChanged;
$PackageRealVersionCacheChanged = true;
$PackageRealVersionCache[ $Key ] = _get_package_version( $PackageName , $PackageVersion , $ROOT_DIR );
}
return( $PackageRealVersionCache[ $Key ] );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_get_package_version | ( |  | $PackageName,
|  |  | $PackageVersion,
|  |  | $ROOT_DIR = `INSTALL_DIR`
| ) |  |

Function returns real version of the package.

Parameters

  $PackageName | - Name of the package.
  $PackageVersion | - Package's version. In case string 'last' is passed, then method returns the latest version.
  $ROOT_DIR | - Name of the root directory. In this directory all package processing will be run.

Returns
  Reference on package's object. If an error occured then method returns false.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 151 of file package_version.php.

{
try
{
if( $PackageVersion === 'last' )
{
$PackagesInfo = _load_packages_list( $ROOT_DIR );
$Dir = '';
$Sel = array( '0' , '0' , '0' );
$Tmp = $PackageName.'.';
foreach( $PackagesInfo as $pi )
{
$FastCheck = $pi[ 0 ][ 0 ] === $Tmp[ 0 ] && strpos( $pi[ 0 ] , $Tmp ) === 0;
if( $FastCheck && _check_tmp_version( $Tmp , $Sel , $Dir , $pi ) )
{
break;
}
}
$PackageVersion = implode( '.' , $Sel );
if( $Dir === '' )
{
throw( new Exception( 'Package '.$Tmp.$PackageVersion.' was not found' ) );
}
}
return( $PackageVersion );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

## Variable Documentation

$FullClassNameCache = array()

Definition at line 17 of file package_version.php.

$FullClassNameCacheChanged = false

Definition at line 16 of file package_version.php.

$PackageRealVersionCache = array()

Definition at line 20 of file package_version.php.

$PackageRealVersionCacheChanged = false

Definition at line 19 of file package_version.php.