Příspěvky uživatele Alain Raap

I don’t know, we can only use the software releases that are distributed in our environment, and they are always behind the versions in the outside world.

Just for testing i’ll hack the environment.xml version, but that’s not an ideal situation.
We'd like to test a Moodle 4.3 upgrade and are using Moodle 4.1 on Redhat 8. I found out that Moodle 4.3 requires MariaDB 10.6 that isn't available yet on both Redhat 8 and 9. Support Center will make MariaDB 10.6 available in Redhat 9.5 (October 2024) and that's too late for us to test this upgrade or to anticipate on the new Moodle 4.5 LTS version. 
Are there Moodle admins here with the same upgrade problem?
Průměr hodnocení: -
Hi Nilesh,

I've used the open source Learning Locker LRS for a poc some years ago, now it's an enterprise LRS distributed by Learningpool.
There is a plugin in the Moodle plugins section that can connect with this LRS that I used.

https://learningpool.com/learning-record-store/

https://moodle.org/plugins/logstore_xapi
I see in our muc/config.php this section:

'definitionmappings' => array (
0 => array (
'store' => 'Redis',
'definition' => 'core/coursemodinfo',
'sort' => 1,
),
),
'locks' => array (
'cachelock_file_default' => array (
'name' => 'cachelock_file_default',
'type' => 'cachelock_file',
'dir' => 'filelocks',
'default' => true,
),
),

It seems to me that the locks are being written to the filesystem instead of to the caching server?
Or am I wrong? I was searching in the code for the error thrown, and I only found it in the 
caching module of file caching, that's why I am confused about these config settings.

Here's the code in the php file /[www root]/cache/locks/file/lib.php:

    public function lock($key, $ownerid, $block = false) {
        // Get the name of the lock file we want to use.
        $lockfile = $this->get_lock_file($key);

        // Attempt to create a handle to the lock file.
        // Mode xb is the secret to this whole function.
        //   x = Creates the file and opens it for writing. If the file already exists fopen returns false and a warning is thrown.
        //   b = Forces binary mode.
        $result = @fopen($lockfile, 'xb');

        // Check if we could create the file or not.
        if ($result === false) {
            // Lock exists already.
            if ($this->maxlife !== null && !array_key_exists($key, $this->locks)) {
                $mtime = filemtime($lockfile);
                if ($mtime < time() - $this->maxlife) {
                    $this->unlock($key, true);
                    $result = $this->lock($key, false);
                    if ($result) {
                        return true;
                    }
                }
            }
            if ($block) {
                // OK we are blocking. We had better sleep and then retry to lock.
                $iterations = 0;
                $maxiterations = $this->blockattempts;
                while (($result = $this->lock($key, false)) === false) {
                    // Usleep causes the application to cleep to x microseconds.
                    // Before anyone asks there are 1'000'000 microseconds to a second.
                    usleep(rand(1000, 50000)); // Sleep between 1 and 50 milliseconds.
                    $iterations++;
                    if ($iterations > $maxiterations) {
                        // BOOM! We've exceeded the maximum number of iterations we want to block for.
                        throw new cache_exception('ex_unabletolock');
                    }
                }
            }

            return false;
        } else {
            // We have the lock.
            fclose($result);
            $this->locks[$key] = $lockfile;
            return true;
        }
    }