Forums | Mahara Community

Support /
Automate page deletion in Mahara

Chris K's profile picture
Posts: 3

08 August 2023, 3:51

Our users have several hundreds of pages to delete.  Is there some way to automate deleting portfolios and their pages ?  

On our instance of Mahara we also have to disable "block locks" from pages, otherwise the delete operation crashes.

We are running Mahara 19.04.0 on Linux.  Database is MySQL.
We will update to a more recent version soon but can't do this immediately.

I checked out the wiki and the API documentation but didn't find a way to do this.  Maybe i overlooked something ?

Any way of doing this with SQL queries, API calls or other means ?

Thanks !

Doris ⚡'s profile picture
Posts: 81

09 August 2023, 12:23

Hi Chris,

There are many references that pages link to, so the last resort would be using a large chain of SQL queries. If you delete these manually with SQL without cleaning up all the foreign key references, you might get unexpected errors later. If you go for this option, it's a good idea to create a backup before you start altering data in the database.

I would look in the  htdocs/lib/view.php file where you can find the page deletion function to help you investigate, or write an upgrade step into your htdocs/lib/db/upgrade.php file to do the bulk deletion.

Bulk deletion of pages is not yet a function in Mahara. You may create a feature request in our bug and wishlist item tracker.

This might require more effort than it would take to upgrade the site to a more recent version (22.10 at minimum), where your site will be within the range of supported versions for which we can provide assistance.

However, to give a personalised solution (especially for a non-supported version) would be more than general forum support. You're welcome to look at getting a subscription for more in-depth support, personal consulting, and assistance with writing an upgrade step to run an automated bulk deletion of pages.

Kind regards,


Kristina Hoeppner's profile picture
Posts: 4706

22 September 2023, 9:44

Hi Chris,

Automating the deleting of portfolios can have unintended consequences because you'd need to set a rule of which portfolios to delete, but is it certain that the person is ready for them to be deleted?

One way of more easily delete pages in bulk would be to place them all in a collection and then delete the collection. In Mahara 21.04 we introduced the option to delete a collection and all it's related pages. An upgrade of your site would make that functionality available.



3 results