Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-27481

Prevent profiling data to be sent to DB on installation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • Component/s: Libraries, Performance
    • Environment:
      xhprof installed and enabled in config.php installing from scratch.
    • Database:
      Any
    • Testing Instructions:
      Hide

      Complexity: high

      Requirements: xhprof php extension enabled, hacking abilities and install new sites.

      Steps:

      • Proceed with the installation of one moodle 2.1dev site.
      • Once config.php is available, add these settings to it in order to guarantee that profiling runs will happen always:

      $CFG->earlyprofilingenabled = true;
      $CFG->profilingautofrec = 1;
      $CFG->profilingincluded = '/*view.php,/*index.php';
      $CFG->profilingallowme = true;
      $CFG->profilingallowall = true;

      • TEST1: Without the patch, error happens consistently, related to profiling_stop() not being able to save information to DB.
      • TEST2: With the patch, the installation goes along all its pages and ends normally (because no DB operation is performed until the table exists).

      Note1: You can perform TEST1 by hacking lib/xhprof/xhprof_moodle.php and changing this line:

      if (!in_array('profiling', $tables)) {

      by this:

      if (1== 2 and !in_array('profiling', $tables)) {

      (that invalidates the test so the old behavior - TEST1 - can be tested)

      Note2: Don't forget to delete the hack done for TEST1 in order to check TEST2 properly, hehe

      Show
      Complexity: high Requirements: xhprof php extension enabled, hacking abilities and install new sites. Steps: Proceed with the installation of one moodle 2.1dev site. Once config.php is available, add these settings to it in order to guarantee that profiling runs will happen always: $CFG->earlyprofilingenabled = true; $CFG->profilingautofrec = 1; $CFG->profilingincluded = '/*view.php,/*index.php'; $CFG->profilingallowme = true; $CFG->profilingallowall = true; TEST1: Without the patch, error happens consistently, related to profiling_stop() not being able to save information to DB. TEST2: With the patch, the installation goes along all its pages and ends normally (because no DB operation is performed until the table exists). Note1: You can perform TEST1 by hacking lib/xhprof/xhprof_moodle.php and changing this line: if (!in_array('profiling', $tables)) { by this: if (1== 2 and !in_array('profiling', $tables)) { (that invalidates the test so the old behavior - TEST1 - can be tested) Note2: Don't forget to delete the hack done for TEST1 in order to check TEST2 properly, hehe
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      prevent_profiling_before_install

      Description

      Right now, although highly improbable in real sites, it is possible to enable and configure profiling runs from the config.php.

      When the profiling run ends, it sends results to database ('profiling' table). And it can be missing on early installation stages.

      The fix simply checks if the table already exists, guarantying that no database operation will happen if missing.

        Attachments

          Activity

            People

            • Assignee:
              stronk7 Eloy Lafuente (stronk7)
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Integrator:
              Sam Hemelryk
              Tester:
              Glenn Ansley
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Matteo Scaramuccia, Jake Dallimore, Jun Pataleta
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                1/Jul/11