Commit 4b1f57b9 authored by issam.taboubi's avatar issam.taboubi Committed by Robert Lyon
Browse files

Bug 1724603: Adding 'owner' column to update for update_hierarchy_path()



To make use of the indexing on that colum to speed things up

behatnotneeded

Change-Id: I4503b8c4b600fea28de9ffff854ec1f40ea5a2e0
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent bddbc2b1
......@@ -1425,8 +1425,20 @@ abstract class ArtefactType implements IArtefactType {
// - Do this for all items that start with the item's path.
// The WHERE clause must be like this to avoid /1% matching /10.
$length = strlen($oldparent->path) + 1;
$params = array($newparent->path, $length, $this->path, db_like_escape("{$this->path}/") . '%');
$sql = "UPDATE {artefact} SET path = ? || SUBSTR(path, ?) WHERE (path = ? OR path LIKE ? )";
if (!empty($this->institution)) {
$ownertype = 'institution';
$ownerid = $this->institution;
}
else if (!empty($this->group)) {
$ownertype = '"group"';
$ownerid = $this->group;
}
else {
$ownertype = 'owner';
$ownerid = $this->owner;
}
$params = array($newparent->path, $length, $ownerid, $this->path, db_like_escape("{$this->path}/") . '%');
$sql = "UPDATE {artefact} SET path = ? || SUBSTR(path, ?) WHERE " . $ownertype . " = ? AND (path = ? OR path LIKE ? )";
execute_sql($sql, $params);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment