Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide

      These changes affect all parts of Login and backup.
      Please:

      • Log in, out and forgetting your password to receive an email.
      • Try backing up and restoring different areas of moodle.

      Check to make sure that there are no regressions.

      Show
      These changes affect all parts of Login and backup. Please: Log in, out and forgetting your password to receive an email. Try backing up and restoring different areas of moodle. Check to make sure that there are no regressions.
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-34469-master

      Description

      Replace get_context_instance with context_XXXX::instance() in set location (group 15)
      Locaitons

      • Login
      • backup

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              poltawski Dan Poltawski added a comment -

              Can we check this on some old php version?

              context_user::instance($userid)->id;

              Show
              poltawski Dan Poltawski added a comment - Can we check this on some old php version? context_user::instance($userid)->id;
              Hide
              poltawski Dan Poltawski added a comment -

              Has this been tested?

              diff --git a/backup/util/ui/restore_ui_components.php b/backup/util/ui/restore_ui_components.php
              index b95681d..868b582 100644
              --- a/backup/util/ui/restore_ui_components.php
              +++ b/backup/util/ui/restore_ui_components.php
              @@ -182,7 +182,8 @@ abstract class restore_search_base implements renderable {
                           $resultset = $DB->get_records_sql($sql, $params, $offs, $blocksz);
                           foreach ($resultset as $result) {
                               context_instance_preload($result);
              -                $context = get_context_instance($contextlevel, $result->id);
              +                $contextvariable = 'context_' . $contextlevel;
              +                $context = $contextvariable::instance($result->id);
                               if (count($requiredcaps) > 0) {
                                   if (!has_all_capabilities($requiredcaps, $context, $userid)) {
                                       continue;

              Show
              poltawski Dan Poltawski added a comment - Has this been tested? diff --git a/backup/util/ui/restore_ui_components.php b/backup/util/ui/restore_ui_components.php index b95681d..868b582 100644 --- a/backup/util/ui/restore_ui_components.php +++ b/backup/util/ui/restore_ui_components.php @@ -182,7 +182,8 @@ abstract class restore_search_base implements renderable { $resultset = $DB->get_records_sql($sql, $params, $offs, $blocksz); foreach ($resultset as $result) { context_instance_preload($result); - $context = get_context_instance($contextlevel, $result->id); + $contextvariable = 'context_' . $contextlevel; + $context = $contextvariable::instance($result->id); if (count($requiredcaps) > 0) { if (!has_all_capabilities($requiredcaps, $context, $userid)) { continue;
              Hide
              cibot CiBoT added a comment -

              Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.

              Show
              cibot CiBoT added a comment - Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.
              Hide
              abgreeve Adrian Greeve added a comment -

              Hi Dan,

              I fixed up the code that you mentioned before. I replaced it with this:

              $classname = context_helper::get_class_for_level($contextlevel);
              $context = $classname::instance($result->id);

              I've tested it and it works.
              Thanks.

              Show
              abgreeve Adrian Greeve added a comment - Hi Dan, I fixed up the code that you mentioned before. I replaced it with this: $classname = context_helper::get_class_for_level($contextlevel); $context = $classname::instance($result->id); I've tested it and it works. Thanks.
              Hide
              poltawski Dan Poltawski added a comment -

              Ah, that looks much more suitable!

              Show
              poltawski Dan Poltawski added a comment - Ah, that looks much more suitable!
              Hide
              dmonllao David Monllaó added a comment -

              All ok to me Adrian

              Show
              dmonllao David Monllaó added a comment - All ok to me Adrian
              Hide
              nebgor Aparup Banerjee added a comment -

              The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

              TIA and ciao

              Show
              nebgor Aparup Banerjee added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
              Hide
              poltawski Dan Poltawski added a comment -

              Integrated, thanks Adrian

              Show
              poltawski Dan Poltawski added a comment - Integrated, thanks Adrian
              Hide
              rwijaya Rossiani Wijaya added a comment -

              This looks good.

              Test passed.

              Show
              rwijaya Rossiani Wijaya added a comment - This looks good. Test passed.
              Hide
              poltawski Dan Poltawski added a comment -

              asko, Дзякуй, ধন্যবাদ, Благодаря, Gràcies, 感谢, 謝謝, Hvala, Díky, Tak, Bedankt, Tänan, متشکریم, Salamat, Kiitokset, Merci, Grazas, Danke, Ευχαριστώ, આભાર, תודה, धन्यवाद, Köszönjük, Takk fyrir, Terima Kasih, Grazie, ありがとうございます, Рахмет, សូមអរគុណ, 감사합니다, gratiās, Pateicamies, Ačiū, Благодарам, Tēnā koa, Kia Ora Rawa Atu, आभारी आहोत, Талархал, Takk, Dziękuję, Obrigado, Mulţumesc, Engraziel, Спасибо, Fa'afetai, Хвала, Hvala, ස්තූතියි, Vďaka, Hvala, Mahadsanid, Thanks, Gracias, Tack, Salamat, நன்றி, నెనరులు, ขอบคุณค่ะ!

              Your work has made it into this weeks Moodle release! There are no gold medals available this week - but millions around the world will benefit. Thank you!

              Show
              poltawski Dan Poltawski added a comment - asko, Дзякуй, ধন্যবাদ, Благодаря, Gràcies, 感谢, 謝謝, Hvala, Díky, Tak, Bedankt, Tänan, متشکریم, Salamat, Kiitokset, Merci, Grazas, Danke, Ευχαριστώ, આભાર, תודה, धन्यवाद, Köszönjük, Takk fyrir, Terima Kasih, Grazie, ありがとうございます, Рахмет, សូមអរគុណ, 감사합니다, gratiās, Pateicamies, Ačiū, Благодарам, Tēnā koa, Kia Ora Rawa Atu, आभारी आहोत, Талархал, Takk, Dziękuję, Obrigado, Mulţumesc, Engraziel, Спасибо, Fa'afetai, Хвала, Hvala, ස්තූතියි, Vďaka, Hvala, Mahadsanid, Thanks, Gracias, Tack, Salamat, நன்றி, నెనరులు, ขอบคุณค่ะ! Your work has made it into this weeks Moodle release! There are no gold medals available this week - but millions around the world will benefit. Thank you!

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    3/Dec/12