Posts made by Visvanath Ratnaweera

Picture of Particularly helpful Moodlers Picture of Translators
If it is a Moodle_migration just transfer moodledata/filedir/, and no other subdirectories in to moodledata.

I too can't see any connection to "dconf", is it https://linuxconfig.org/introduction-to-the-dconf-configuration-system what you mean?

And the directory '/var/www/.cache/dconf' is odd. On a Debian-derived system, the paths are more likely to be '/var/www/html/moodle/' and '/var/www/moodledata/'.
Average of ratings: Useful (1)
Picture of Particularly helpful Moodlers Picture of Translators
I experimented a bit further:

$fs = get_file_storage();
foreach(file("filedump.txt") as $filepath) {
    $fieldlist = explode(',', $filepath);
    // echo $fieldlist[0];  // id
    // echo $fieldlist[1];  // contenthash
    // echo $fieldlist[2];  // pathnamehash
    // $fieldlist[3] = $context->$fieldlist[3];  // contextid ???
    // echo $fieldlist[4];  // component
    // echo $fieldlist[5];  // filearea
    // echo $fieldlist[6];  // itemid
    // echo $fieldlist[7];  // filepath
    // echo $fieldlist[8];  // filename
    // 'contextid' => $context->id, // ID of context
    // Get file
    // $file = $fs->get_file($fileinfo['contextid'], $fileinfo['component'], $fileinfo['filearea'], $fileinfo['itemid'], $fileinfo['filepath'], $fileinfo['filename']);
    $file = $fs->get_file($fieldlist[3], $fieldlist[4], $fieldlist[5], $fieldlist[6], $fieldlist[7], $fieldlist[8]);

    // Delete it if it exists
    if ($file) {
        echo "Found";
    $file->delete();
    }
    else {
        echo "Not found";
    }
}

Sorry, I have to leave some debugging lines in the source. I think, my current problem is how to get the context from the context id. (See the ??? mid right.) If I uncomment that line I get:

PHP Notice:  Undefined variable: context in /var/www/html/bztfdevmoodle/delfiledump.php on line 22
PHP Notice:  Array to string conversion in /var/www/html/bztfdevmoodle/delfiledump.php on line 22
PHP Notice:  Trying to get property 'Array' of non-object in /var/www/html/bztfdevmoodle/delfiledump.php on line 22
PHP Notice:  Trying to access array offset on value of type null in /var/www/html/bztfdevmoodle/delfiledump.php on line 22

The cause must be obvious to the developers, who master Moodle's "context".

Picture of Particularly helpful Moodlers Picture of Translators
The smooth path is to uninstall the theme in the System administration > Plugins interface and then reinstall the theme. There are various ways of getting a theme. Ultimately they need to appear in the moodle/theme/ directly. Then Moodle detects them when the admin logs in next time and walks through the installation procedure (on the GUI).

The rough path is to just remove and replace the corresponding directory under moodle/theme/.