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