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

Prevent profiling data to be sent to DB on installation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.1
    • 2.1
    • Libraries, Performance
    • xhprof installed and enabled in config.php installing from scratch.
    • Any
    • MOODLE_21_STABLE
    • MOODLE_21_STABLE
    • prevent_profiling_before_install
    • Moderate
    • 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

      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.

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Sam Hemelryk Sam Hemelryk
            Glenn Ansley Glenn Ansley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.