Moodle
  1. Moodle
  2. MDL-27695

Moodle Docs links need to be fixed to point to correct versions of docs

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.9.12, 2.0.3, 2.1
    • Fix Version/s: 1.9.13, 2.0.4
    • Component/s: Documentation
    • Labels:
      None
    • Testing Instructions:
      Hide

      All the "Moodle docs" links at the footer of pages in 1.9, 2.0 and 2.1 should be going to the correct docs (if not the exact version, then the latest available version for that language). Try different langauges too.

      Show
      All the "Moodle docs" links at the footer of pages in 1.9, 2.0 and 2.1 should be going to the correct docs (if not the exact version, then the latest available version for that language). Try different langauges too.
    • Workaround:
      Hide

      None

      Show
      None
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      17374

      Description

      Moodle contains a config setting "docroot" which defaults to "http://docs.moodle.org"

      Leave the default as it is.

      However, in lib/weblib.php update get_docs_url() so that instead of producing URLS like:

      $CFG->docroot/en/blah

      it now produces

      $CFG->docroot/20/en/blah

      Where "20" in the example is derived from the first three letters of $CFG->release with the period taken out.

      eg '2.0.3+ (Build: 20110511)' ---> '20'

      This needs to be fixed for 1.9, 2.0 and 2.1.

        Issue Links

          Activity

          Hide
          Martin Dougiamas added a comment -

          Apu, can you do this? Should be 5 min.

          Show
          Martin Dougiamas added a comment - Apu, can you do this? Should be 5 min.
          Hide
          Aparup Banerjee added a comment - - edited

          done, ready for review/integration
          (ps: please excuse the commit's ascii art)

          Show
          Aparup Banerjee added a comment - - edited done, ready for review/integration (ps: please excuse the commit's ascii art)
          Hide
          Rossiani Wijaya added a comment -

          Hi Apu,

          I tested the patches and it looks great in all branch.

          submitting this for integration.

          Show
          Rossiani Wijaya added a comment - Hi Apu, I tested the patches and it looks great in all branch. submitting this for integration.
          Hide
          Ralf Hilgenstock added a comment -

          Hello

          if I understand this solution for 1.9 correct each admin has to change the system settings in 1.9. systems that the correct docs are linked.

          Sorry, but this is not a good solution. Most admin don't know the changes and will not change the settings, so in consequencs 1.9 docs are not available for users. Isn't there a way to redirect from docs.moodle.org to the new 1.9 locations?

          Show
          Ralf Hilgenstock added a comment - Hello if I understand this solution for 1.9 correct each admin has to change the system settings in 1.9. systems that the correct docs are linked. Sorry, but this is not a good solution. Most admin don't know the changes and will not change the settings, so in consequencs 1.9 docs are not available for users. Isn't there a way to redirect from docs.moodle.org to the new 1.9 locations?
          Hide
          Sam Hemelryk added a comment -

          Hi Apu,

          Failing this week, you cannot rely on $CFG being set as during installation it won't be.
          A quick test installation confirms this with the following errors:

          Notice: Undefined offset: 1 in /var/git/integration/master/lib/weblib.php on line 2821
          Notice: Undefined offset: 2 in /var/git/integration/master/lib/weblib.php on line 2821

          I'm not too sure what the best bet is here, perhaps there is no way around it but to hard code it, or hard code a default.

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - Hi Apu, Failing this week, you cannot rely on $CFG being set as during installation it won't be. A quick test installation confirms this with the following errors: Notice: Undefined offset: 1 in /var/git/integration/master/lib/weblib.php on line 2821 Notice: Undefined offset: 2 in /var/git/integration/master/lib/weblib.php on line 2821 I'm not too sure what the best bet is here, perhaps there is no way around it but to hard code it, or hard code a default. Cheers Sam
          Hide
          Aparup Banerjee added a comment - - edited

          hm, Is there an issue for usage of $CFG->docroot in the function too?

          also, instead of hardcode, perhaps run an isset()? then we can fall back on the default url?

          Show
          Aparup Banerjee added a comment - - edited hm, Is there an issue for usage of $CFG->docroot in the function too? also, instead of hardcode, perhaps run an isset()? then we can fall back on the default url?
          Hide
          Aparup Banerjee added a comment -

          as scrum-ded, added include and used $release.
          all branches updated. (i also just rebased all of them)

          Ralf, the solution for 1.9 doesn't need any changes when using docs.moodle.org

          however do note that with a custom docroot url, the server will need to handle the new url.

          (http://moodle.org/mod/forum/discuss.php?d=176545)

          Show
          Aparup Banerjee added a comment - as scrum-ded, added include and used $release. all branches updated. (i also just rebased all of them) Ralf, the solution for 1.9 doesn't need any changes when using docs.moodle.org however do note that with a custom docroot url, the server will need to handle the new url. ( http://moodle.org/mod/forum/discuss.php?d=176545 )
          Hide
          Sam Hemelryk added a comment -

          Thanks Apu, this has been integrated now.
          As discussed I did change it to look first at $CFG->release and only include version.php if it wasn't set up.

          Show
          Sam Hemelryk added a comment - Thanks Apu, this has been integrated now. As discussed I did change it to look first at $CFG->release and only include version.php if it wasn't set up.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          tested with "en", "es" and "de". All seem to point to proper site, with fallback down working ok to last available 2.1 => 2.0 => 1.9

          Show
          Eloy Lafuente (stronk7) added a comment - tested with "en", "es" and "de". All seem to point to proper site, with fallback down working ok to last available 2.1 => 2.0 => 1.9
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Offtopic, 2.0 Moodle Docs (english) for http://docs.moodle.org/20/en/course/view/topics look really awful! At least redirect like in 1.9 should be performed.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Offtopic, 2.0 Moodle Docs (english) for http://docs.moodle.org/20/en/course/view/topics look really awful! At least redirect like in 1.9 should be performed. Ciao
          Hide
          Helen Foster added a comment -

          Eloy, thanks for testing. I've redirected http://docs.moodle.org/20/en/course/view/topics

          Show
          Helen Foster added a comment - Eloy, thanks for testing. I've redirected http://docs.moodle.org/20/en/course/view/topics
          Hide
          moodle.com added a comment -

          Apu: Can you please fill in the workaround for this problem? I suspect people will be wanting to fix this before 2.1.

          Show
          moodle.com added a comment - Apu: Can you please fill in the workaround for this problem? I suspect people will be wanting to fix this before 2.1.
          Hide
          Anthony Borrow added a comment - - edited

          A slightly different issue but perhaps something we can look at is ensuring the language exists in docs. I wonder if current_language() really going to work - might we need to use get_parent_language. I'm not sure if this is something to handle on the Moodle end or the Docs end. Specifically, consider how to handle en_us and other language derivatives.

          I was at the Oklahoma Moot and this caused the more info links to not work. As an example, I was being sent to:

          http://docs.moodle.org/en_us/question/import

          instead of:

          http://docs.moodle.org/en/question/import

          Do we want the link generated to be en or en_us? If it is en_us, then Docs should redirect automatically to en if the page does not exist.

          Peace - Anthony

          Show
          Anthony Borrow added a comment - - edited A slightly different issue but perhaps something we can look at is ensuring the language exists in docs. I wonder if current_language() really going to work - might we need to use get_parent_language. I'm not sure if this is something to handle on the Moodle end or the Docs end. Specifically, consider how to handle en_us and other language derivatives. I was at the Oklahoma Moot and this caused the more info links to not work. As an example, I was being sent to: http://docs.moodle.org/en_us/question/import instead of: http://docs.moodle.org/en/question/import Do we want the link generated to be en or en_us? If it is en_us, then Docs should redirect automatically to en if the page does not exist. Peace - Anthony
          Hide
          Eloy Lafuente (stronk7) added a comment -

          This is now upstream, yay! Many thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - This is now upstream, yay! Many thanks!
          Hide
          Anthony Borrow added a comment -

          Since this issue has already been reviewed and closed, it seems best to create a new issue for better handling 'child' languages so I created and am linking this to MDL-27803. Peace - Anthony

          Show
          Anthony Borrow added a comment - Since this issue has already been reviewed and closed, it seems best to create a new issue for better handling 'child' languages so I created and am linking this to MDL-27803 . Peace - Anthony
          Hide
          Aparup Banerjee added a comment -

          The link to MDL-27803 isn't updating in the comment above, its now MDLSITE-1296

          Show
          Aparup Banerjee added a comment - The link to MDL-27803 isn't updating in the comment above, its now MDLSITE-1296
          Hide
          Ralf Hilgenstock added a comment -

          Hi Apu
          the link from a 1.9 system to docs is going to a 2.0 documentation page. This is not correct. Please try it by yourself.

          http://docs.moodle.org/en/user/view -->> http://docs.moodle.org/20/en/user/view

          If we have versioned docs it should be http://docs.moodle.org/19/en/user/view

          Show
          Ralf Hilgenstock added a comment - Hi Apu the link from a 1.9 system to docs is going to a 2.0 documentation page. This is not correct. Please try it by yourself. http://docs.moodle.org/en/user/view -->> http://docs.moodle.org/20/en/user/view If we have versioned docs it should be http://docs.moodle.org/19/en/user/view
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Sorry Ralf, but Moodle 1.9.x should be generating, since last weekly, links like:

          • The problem comes from old sites, not updated, and using the old, non-versioned links. It was decided that the default was going to be "2.0" so everybody running old sites is now being redirected there (to 2.0 docs).

          I see that decision like a good thing to call people for updating, hehe, although I agree that, right now, it is causing a lot of old sites to point to the "wrong" version of Docs.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Sorry Ralf, but Moodle 1.9.x should be generating, since last weekly , links like: http://docs.moodle.org/19/en/course/view , so they point to the correct place. The problem comes from old sites, not updated, and using the old, non-versioned links. It was decided that the default was going to be "2.0" so everybody running old sites is now being redirected there (to 2.0 docs). I see that decision like a good thing to call people for updating, hehe, although I agree that, right now, it is causing a lot of old sites to point to the "wrong" version of Docs. Ciao
          Hide
          Aparup Banerjee added a comment -

          Hi Ralf,
          Eloy is spot on. An update to 1.9.12+ (Build: 20110609) should update your moodle doc links.

          cheers!

          ps: update to -
          commit 1de5024830fc8a708fcc3d1b15ad762991c48409
          Author: Eloy Lafuente (stronk7) <stronk7@moodle.org>
          Date: Thu Jun 9 03:43:55 2011 +0200

          weekly release 1.9.12+

          Show
          Aparup Banerjee added a comment - Hi Ralf, Eloy is spot on. An update to 1.9.12+ (Build: 20110609) should update your moodle doc links. cheers! ps: update to - commit 1de5024830fc8a708fcc3d1b15ad762991c48409 Author: Eloy Lafuente (stronk7) <stronk7@moodle.org> Date: Thu Jun 9 03:43:55 2011 +0200 weekly release 1.9.12+
          Hide
          Aaron Wells added a comment -

          This fixed the doc links in page footers, but it didn't fix the doc links generated by print_error().

          For instance, in Moodle 1.9 if I try to access admin/index.php while logged in as a student, I'll get an error page with a little link that reads "More information about this error". The link leads to "http://docs.moodle.org/en/error/moodle/nopermissions", which of course redirects to the Moodle 2.0 documentation.

          Show
          Aaron Wells added a comment - This fixed the doc links in page footers, but it didn't fix the doc links generated by print_error(). For instance, in Moodle 1.9 if I try to access admin/index.php while logged in as a student, I'll get an error page with a little link that reads "More information about this error". The link leads to "http://docs.moodle.org/en/error/moodle/nopermissions", which of course redirects to the Moodle 2.0 documentation.
          Hide
          Aparup Banerjee added a comment -

          Thanks for that pick up Aaron! i've created MDL-28044 to work on it straight away.

          Show
          Aparup Banerjee added a comment - Thanks for that pick up Aaron! i've created MDL-28044 to work on it straight away.

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: