Git Product home page Git Product logo

Comments (9)

jpahullo avatar jpahullo commented on September 4, 2024

Hi!

Thanks for the feedback @fernandezalerrt .

Which version of the plugin are you using?

We are using this plugin in our production site without any error.

On https://moodle.org/plugins/tool_mergeusers/versions you can see a specific version for Moodle 4.1, and it is not the last version. Have you checked that? If you are using this git repo to get it, it is related to the branch MOODLE_401_STABLE of this repo.

If it still applies this error, please, enable developer debug level, and paste here the trace of the error.

Thanks,

Jordi

PD: I think you have contacted me privately on moodle.org. This issue is more relevant for this kind of thinkgs. Thanks again for contacting.

from moodle-tool_mergeusers.

fernandezalerrt avatar fernandezalerrt commented on September 4, 2024

from moodle-tool_mergeusers.

fernandezalerrt avatar fernandezalerrt commented on September 4, 2024

from moodle-tool_mergeusers.

fernandezalerrt avatar fernandezalerrt commented on September 4, 2024

from moodle-tool_mergeusers.

jpahullo avatar jpahullo commented on September 4, 2024

Hi,

Thanks for the feedback and the effort for providing it.

However, if it was caused by a cache issue during upgrade or installation, it is just that.

Regarding your important question:

Is there a way I can execute the plugin via API?
Our principal users' database is in another web, I want to merge users in
Moodle when I merge users in the principal database.

Yes, you can.

How? The answer is a bit longer than before, hehe.

It is documented on the README.md:

https://github.com/jpahullo/moodle-tool_mergeusers#command-line-script

And this is what we have implemented in our institution to have an unattended merging process every day.

The idea behind the Gathering interface is that it provides the list of merging actions to perform. You can implement it, in your case, for instance, accessing to an external database (infrastructure and firewalling issues are on your hands), or getting the list of merging actions from a REST API that you can get from the Moodle side. So, in summary, your Gathering implementation, say FernandezGathering is the reponsible to provide the list of action. The how? is what you have to implement in your new class.

Following the above example, you would have:

  1. A new file inside this plugin, in your Moodle (do not contribute it, if it is something specific for you), like admin/tool/mergeusers/lib/FernandezGathering.php.
  2. Add or edit the configuration file admin/tool/mergeusers/config/config.local.php with something like:
<?php

return array(

    // gathering tool
    'gathering' => 'FernandezGathering',
);
  1. Add the cli script admin/tool/mergeusers/cli/climerger.php into the crontab of your server, as often as you consider. We have it in our institution once a day, according to the rest of corporate processes.

And mainly, this is all! The big effort for you is to analyse if you can build the list of merging actions from a FernandezGathering.php from the Moodle side. And if so, implement it. When implementing it, given that the plugin expects user.ids, you will have to translate inside the FernandezGathering the external username/idnumber/whatever to a Moodle user.id, and provide the source id (to remove) and the target id (to keep).

As an example, we have implemented it in our institution by asking the list from an external database. So, it is possible. In that implementation, we also consider edge cases, like users not found yet on Moodle and so, informing why the merging action is not being performed right now. Actually, our implementation also consider a number of attempts to retry the merging actions. It is all in your hands. Here, the important thing is to keep the order of the merging action list. Since edge cases my arise, like from A to B, later B to C, and later C to A. These merging actions in a different order will produce a different result. In that case, the final user (the person with that username) will not get the whole Moodle content/activit/etc under its user profile or may not know which is the actual username to use each time.

Thanks for contacting,

Jordi

from moodle-tool_mergeusers.

fernandezalerrt avatar fernandezalerrt commented on September 4, 2024

from moodle-tool_mergeusers.

jpahullo avatar jpahullo commented on September 4, 2024

The same to you @fernandezalerrt !

from moodle-tool_mergeusers.

jpahullo avatar jpahullo commented on September 4, 2024

By the way, @fernandezalerrt ,

The last, but not the least: a merging action is an idempotent operation. That means that if you repeat the same operation a second time, a third time, from the same two user ids, the result will be the same. This is why we added retries on our Gathering implementation. The only difference my appear on the actions being done inside every merging action: while the first one will contain a bunch of operations, the second one and the others, should contain almost nothing.

Thanks,

Jordi

from moodle-tool_mergeusers.

fernandezalerrt avatar fernandezalerrt commented on September 4, 2024

from moodle-tool_mergeusers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.