← Back to team overview

mahara-contributors team mailing list archive

[Bug 1359109] A change has been merged

 

Reviewed:  https://reviews.mahara.org/4283
Committed: http://gitorious.org/mahara/mahara/commit/3f6c7f8001e7c4663ad48f92bc1a14d96e5d72dc
Submitter: Robert Lyon (robertl@xxxxxxxxxxxxxxx)
Branch:    master

commit 3f6c7f8001e7c4663ad48f92bc1a14d96e5d72dc
Author: Daniel Parejo <danielparejom@xxxxxxxxx>
Date:   Tue Feb 17 12:14:37 2015 +1300

Bug 1359109: Fail deleting long group names

Patch originally submitted by Daniel Parejo in bug report

Change-Id: I33d3d9c6ff12c69ef871de47fe15524659ceba36
Signed-off-by: Robert Lyon <robertl@xxxxxxxxxxxxxxx>

-- 
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/1359109

Title:
  Fail deleting long name groups

Status in Mahara ePortfolio:
  Fix Committed

Bug description:
  When you delete a group, it concatenates '.deleted.'.time() that is
  about 19 characters. Hence, if your group name is longer than 108
  characters it will throw a DB exception for exceeding the 128
  characters field for the group name. To avoid this, I've added the
  following code to function group_delete($groupid, $shortname=null,
  $institution=null, $notifymembers=true):

  //Daniel Parejo
      $delete_name = $group->name;
      if (strlen($delete_name) > 100) {
          $delete_name = substr($delete_name, 0, 100) . '(...)';
      }
  //End added code

      update_record('group',
          array(
              'deleted' => 1,
              'name' => $delete_name . '.deleted.' . time(), //modified code
              'shortname' => null,
              'institution' => null,
              'category' => null,
              'urlid' => null,
          ),
          array(
              'id' => $group->id,
          )
      );
      db_commit();

  This solution is not perfect since it will fail if two groups that are
  not different in their 101 first characters are tried to be removed in
  the same time instant. Still, way better than before, though I think a
  more solid solution should be implemented.

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


References