6 * Basic Information about DokuWiki
8 * @todo much of infoutils should be moved here
13 * Parse the given version string into its parts
15 * @param string $version
19 public static function parseVersionString($version)
22 'type' => '', // stable, rc
23 'date' => '', // YYYY-MM-DD
24 'hotfix' => '', // a, b, c, ...
25 'version' => '', // sortable, full version string
26 'codename' => '', // codename
27 'raw' => $version, // raw version string as given
30 if (preg_match('/^(rc)?(\d{4}-\d{2}-\d{2})([a-z]*)/', $version, $matches)) {
31 $return['date'] = $matches[2];
32 if ($matches[1] == 'rc') {
33 $return['type'] = 'rc';
35 $return['type'] = 'stable';
38 $return['hotfix'] = $matches[3];
41 throw new \
Exception('failed to parse version string');
44 [, $return['codename']] = sexplode(' ', $version, 2);
45 $return['codename'] = trim($return['codename'], ' "');
47 $return['version'] = $return['date'];
48 $return['version'] .= $return['type'] == 'rc' ?
'rc' : $return['hotfix'];