Changing the front-end content from the back-end DB

Changing the front-end content from the back-end DB

John D發表於
Number of replies: 2

Hi,

Is it possible to change the front-end content pragmatically via the back-end DB?

Say there's a need for us 

  • to systematically rename the title of all of our Assessment, Quiz, Files, etc.
  • or to change the contents of our Quiz pragmatically

Which is more suitable to be done in the back-end. 

How to make my back-end changes to be reflected/shown in the front-end please?

評比平均分數: -
In reply to John D

Re: Changing the front-end content from the back-end DB

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
I would use web services in preference to updating the database directly. If there are web service functions in existence which do what you want. You might also want to look at Moosh https://moosh-online.com/.

Failing that... you *can* update the database directly but you first need to understand the database. It's grown organically over around 20 years and the consequence of that is that it doesn't always make a great deal of sense. 

The other issue you face is that Moodle relies heavily on its cache API. So changing the database doesn't always have an immediate effect on the front-end. So - executive summary - except in exceptional (one off) circumstances, I would definitely avoid updating the database from outside Moodle on a "business as usual" basis.
 
You can also consider writing your own plugin that works with Moodle's built-in APIs directly. It's reasonably straightforward for a plugin to publish its own Web service functions if that might help.
評比平均分數:Useful (2)