Changeset 4105

Show
Ignore:
Timestamp:
06/21/07 12:25:19 (6 years ago)
Author:
p_lindheimer
Message:

allow depends_on version comparisons to handle multiple digit version numbers as well as non-digits (e.g. 2.2.0beta1), may also be related to #1982

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php

    r4063 r4105  
    13381338        switch ($type) { 
    13391339          case 'version': 
    1340             if (preg_match('/^(lt|le|gt|ge|==|=|eq|!=|ne)?\s*(\d(\.\d)*)$/i', $value, $matches)) { 
     1340            if (preg_match('/^(lt|le|gt|ge|==|=|eq|!=|ne)?\s*(\d+(\.[^\.]+)*)$/i', $value, $matches)) { 
    13411341              // matches[1] = operator, [2] = version 
    13421342              $ver = getversion(); 
     
    13481348          break; 
    13491349          case 'module': 
    1350             if (preg_match('/^([a-z0-9_]+)(\s+(lt|le|gt|ge|==|=|eq|!=|ne)?\s*(\d(\.\d)*))?$/i', $value, $matches)) { 
     1350            if (preg_match('/^([a-z0-9_]+)(\s+(lt|le|gt|ge|==|=|eq|!=|ne)?\s*(\d+(\.[^\.]+)*))?$/i', $value, $matches)) { 
    13511351              // matches[1] = modulename, [3]=comparison operator, [4] = version 
    13521352              $modules = module_getinfo($matches[1]); 
     
    14011401            $engine_dependency = true; 
    14021402             
    1403             if (preg_match('/^([a-z0-9_]+)(\s+(lt|le|gt|ge|==|=|eq|!=|ne)?\s*(\d(\.\d)*))?$/i', $value, $matches)) { 
     1403            if (preg_match('/^([a-z0-9_]+)(\s+(lt|le|gt|ge|==|=|eq|!=|ne)?\s*(\d+(\.[^\.]+)*))?$/i', $value, $matches)) { 
    14041404              // matches[1] = engine, [3]=comparison operator, [4] = version 
    14051405              $operator = (!empty($matches[3]) ? $matches[3] : 'ge'); // default to >=