Skip to content

Option to restore item from recycle bin #529

@davidherney

Description

@davidherney

Hi @tmuras...

Some items take too long to restore from the web, especially when it is a quiz with very large question pools.
I implemented a script to restore items based on their ID. It's very basic, but you might want to add it to Moosh, it's very useful for solving that performance issue.

    $itemid = (int)$itemid;

    $item = $DB->get_record('tool_recyclebin_course', ['id' => $itemid]);

    if (!$item) {
        echo "Item not found: $itemid\n";
        die;
    }

    $context = context_course::instance($item->courseid, MUST_EXIST);
    $recyclebin = new \tool_recyclebin\course_bin($context->instanceid);

    echo "Restoring item with ID: $itemid\n";
    $recyclebin->restore_item($item);
    die;

Saludos

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions