From 3b6711d5ce606e43056091f9f13cedcd37ef6886 Mon Sep 17 00:00:00 2001 From: Aparup Banerjee Date: Thu, 2 Jun 2011 15:07:50 +0800 Subject: [PATCH] MDL-27695 Documentation : updated the moodle docs link at the footer of pages to point to new docs url --- lib/weblib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 9e1b939943e..205f26d6104 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2816,10 +2816,14 @@ function convert_tabrows_to_tree($tabrows, $selected, $inactive, $activated) { */ function get_docs_url($path) { global $CFG; + //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->docroot)) { - return $CFG->docroot . '/' . current_language() . '/' . $path; + return $CFG->docroot . '/' . $branch . '/' . current_language() . '/' . $path; } else { - return 'http://docs.moodle.org/en/'.$path; + return 'http://docs.moodle.org/'. $branch . '/en/' . $path; } }