← Back to team overview

mahara-contributors team mailing list archive

[Bug 1915352] [NEW] Problem with view_instructions_lock when deleting a page

 

Public bug reported:

When we delete a page we remove the view_instructions_lock row for the
copied views if there is a match but not for the originaltemplate if
there is a match

When we delete a view we need to do both
        delete_records('view_instructions_lock', 'view', $this->id);
and
        delete_records('view_instructions_lock', 'originaltemplate', $this->id);

We also need to have an upgrade step to fix sites where they upgraded so that the 
    "viewinstlock_ori_fk" FOREIGN KEY (originaltemplate) REFERENCES view(id)

exists on the view_instructions_lock table

This relates to a mistake in
https://reviews.mahara.org/#/c/10825/

To test:

1 Make a new site (note it has to be new and not upgraded)
2 Make a new user
3 Make an institution
4 Make an institution page for this institution and set Advanced -> Template to 'yes'
5 Go to share for the page and under Advanced options ->  Copy for new institution members to 'yes'
6 Add a user to institution
7 Delete the original institution page

You should get the following error
ERROR:  update or delete on table "view" violates foreign key constraint "viewinstlock_ori_fk" on table "view_instructions_lock"

** Affects: mahara
     Importance: High
         Status: Confirmed

** Affects: mahara/20.10
     Importance: High
         Status: Confirmed

** Affects: mahara/21.04
     Importance: High
         Status: Confirmed

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

** Changed in: mahara
   Importance: Undecided => High

** Also affects: mahara/20.10
   Importance: Undecided
       Status: New

** Also affects: mahara/21.04
   Importance: High
       Status: Confirmed

** Changed in: mahara/21.04
    Milestone: None => 21.04.0

** Changed in: mahara/20.10
    Milestone: None => 20.10.1

** Changed in: mahara/20.10
   Importance: Undecided => High

** Changed in: mahara/20.10
       Status: New => Confirmed

** Description changed:

  When we delete a page we remove the view_instructions_lock row for the
  copied views if there is a match but not for the originaltemplate if
  there is a match
+ 
+ When we delete a view we need to do both
+         delete_records('view_instructions_lock', 'view', $this->id);
+ and
+         delete_records('view_instructions_lock', 'originaltemplate', $this->id);
+ 
+ We also need to have an upgrade step to fix sites where they upgraded so that the 
+     "viewinstlock_ori_fk" FOREIGN KEY (originaltemplate) REFERENCES view(id)
+ 
+ exists on the view_instructions_lock table
  
  This relates to a mistake in
  https://reviews.mahara.org/#/c/10825/
  
  To test:
  
  1 Make a new site (note it has to be new and not upgraded)
  2 Make a new user
  3 Make an institution
  4 Make an institution page for this institution and set Advanced -> Template to 'yes'
  5 Go to share for the page and under Advanced options ->  Copy for new institution members to 'yes'
  6 Add a user to institution
  7 Delete the original institution page
  
  You should get the following error
  ERROR:  update or delete on table "view" violates foreign key constraint "viewinstlock_ori_fk" on table "view_instructions_lock"

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

Title:
  Problem with view_instructions_lock when deleting a page

Status in Mahara:
  Confirmed
Status in Mahara 20.10 series:
  Confirmed
Status in Mahara 21.04 series:
  Confirmed

Bug description:
  When we delete a page we remove the view_instructions_lock row for the
  copied views if there is a match but not for the originaltemplate if
  there is a match

  When we delete a view we need to do both
          delete_records('view_instructions_lock', 'view', $this->id);
  and
          delete_records('view_instructions_lock', 'originaltemplate', $this->id);

  We also need to have an upgrade step to fix sites where they upgraded so that the 
      "viewinstlock_ori_fk" FOREIGN KEY (originaltemplate) REFERENCES view(id)

  exists on the view_instructions_lock table

  This relates to a mistake in
  https://reviews.mahara.org/#/c/10825/

  To test:

  1 Make a new site (note it has to be new and not upgraded)
  2 Make a new user
  3 Make an institution
  4 Make an institution page for this institution and set Advanced -> Template to 'yes'
  5 Go to share for the page and under Advanced options ->  Copy for new institution members to 'yes'
  6 Add a user to institution
  7 Delete the original institution page

  You should get the following error
  ERROR:  update or delete on table "view" violates foreign key constraint "viewinstlock_ori_fk" on table "view_instructions_lock"

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


Follow ups