← Back to team overview

mahara-contributors team mailing list archive

[Bug 1788303] Re: logs Filling with error after upgrade

 

** Changed in: mahara
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1788303

Title:
  logs Filling with error after upgrade

Status in Mahara:
  Incomplete

Bug description:
  Mahara 18.04.2 (Upgraded)

  Mahara 17.04.2 Upgrading to 18.04.2
  Brower: chrome
  OS: Unbutu
  PHP: 7.0

  Logs on server filling up with this message:
  [21-Aug-2018 16:18:56 Pacific/Auckland] [WAR] b1 (lib/mahara.php:2047) Undefined index: onview
    
  etc....

  
  The 'on view' in the $logdata array has not been set when called at line 2047
  Perhaps change to:
  $commenttypeid = isset($logdata['onview'])? $logdata['onview'] : 0;
  would resolve (unless this is a deeper logging issue) 

  
  Code seems to be around when older versions of Mahara get upgraded:

  lib/mahara.php:2047 
  // Include the old time column as well to cater for
          // older versions of Mahara getting upgraded.
          // Their event_log table will have not gone
          // through the table alters during this
          // part of the upgrade.
          // The date it changed was 2017090800.
          $logentry->time = $logentry->ctime;

          // find out who 'owns' the event
          list ($ownerid, $ownertype) = event_find_owner_type($logentry);
          $logentry->ownerid = $ownerid;
          $logentry->ownertype = $ownertype;
          insert_record('event_log', $logentry);
          // If we are adding a comment to a page that is shared to a group
          // we need to add a 'sharedcommenttogroup' event
          if ($reftype == 'comment' && empty($logdata['group'])) {
              if (!empty($logdata['onartefact'])) {
                  $commenttype = 'artefact';
                  $commenttypeid = $logdata['onartefact'];
                  $wheresql = " IN (SELECT view FROM {view_artefact} WHERE " . $commenttype . " = ?) ";
              }
              else {
                  $commenttype = 'view';
                  $commenttypeid = $logdata['onview'];
                  $wheresql = " = ? ";
              }
              if ($groupids = get_records_sql_array("SELECT \"group\" FROM {view_access}
                                                  WHERE view " . $wheresql . "
                                                  AND \"group\" IS NOT NULL", array($commenttypeid))) {
                  foreach ($groupids as $groupid) {
                      $logentry->event = 'sharedcommenttogroup';
                      $logentry->data = null;
                      $logentry->ownerid = $groupid->group;
                      $logentry->ownertype = 'group';
                      insert_record('event_log', $logentry);
                  }
              }
          }

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1788303/+subscriptions


References