Permalink
Browse files

MDL-27695 doc link checks ->release before including version.php now

  • Loading branch information...
1 parent 7bfc876 commit d17b16b6973f66dfb9442dfa26cc33592758f75a Sam Hemelryk committed Jun 8, 2011
Showing with 11 additions and 4 deletions.
  1. +11 −4 lib/weblib.php
View
15 lib/weblib.php
@@ -6968,10 +6968,17 @@ function doc_link($path='', $text='', $iconpath='') {
$lang = str_replace('_utf8', '', current_language());
- //derive branch from the first three letters of version.php's $release with the period taken out.($CFG->release isn't populated yet during upgrade)
- include($CFG->dirroot.'/version.php');
- preg_match('/^(.)\.(.)/', $release, $matches);
- $branch = $matches[1].$matches[2];
+ if (!empty($CFG->release)) {
+ $release = $CFG->release;
+ } else {
+ //derive branch from the first three letters of version.php's $release with the period taken out.($CFG->release isn't populated yet during upgrade)
+ include($CFG->dirroot.'/version.php');
+ }
+ if (preg_match('/^(.)\.(.)/', $release, $matches)) {
+ $branch = $matches[1].$matches[2];
+ } else {
+ $branch = '.';
+ }
$str = '<a href="' .$CFG->docroot. '/' .$branch. '/' .$lang. '/' .$path. '"' .$target. '>';

0 comments on commit d17b16b

Please sign in to comment.