Hi Mark. I have been able to resolve the issue. It was with the cache files in the /var/moodledata/cache directory. I did not have permission to empty the folder so I used the command;
chmod -R 0777 /var/moodledata/cache to allow everyone access to the directory. I then deleted the files in the directory and it worked.