Commit 5b686926 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review

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

parents 6721a874 4b1f57b9
......@@ -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