Moodle not able to expand menus or retrieve images after moving moodle to a new server

Moodle not able to expand menus or retrieve images after moving moodle to a new server

by Yunuen Carrillo -
Number of replies: 4

Hi,

I have made a copy of my moodle system version 2.6 into a new server. This is a migration test.

After the migration, the themes and images are not displaying and menus collapse / expand are not working.

I attempted to apply a Clean theme, uninstall the customised one. Moodle applied the clean theme but it is not displaying it, it just keeps to the same basic styling. 

It seems to me that it doesn't find the path to images.

Example:

it is looking for moodle/theme/image.php/clean/url/1460550952/icon, I looked on moodledata folder under cache folder, localcachefolder and not success, that path is not correct.

You will see in the image attached that there are several 404 files but I do not know where I should be looking for them, other than cache and localcache folders.

This moodle 2.6 is on Linux, shared hosting,  php 5.6 and mysql 5.5

I am still using a temporary URL, once all is working then I will apply the former URL.

Can anyone advice on this?

Many thanks.

Attachment notFoundImagesPath.jpg
Average of ratings: -
In reply to Yunuen Carrillo

Re: Moodle not able to expand menus or retrieve images after moving moodle to a new server

by Yunuen Carrillo -

I also would like to add that I read the File API to see how the contextid is formed. I found out that there is a table for context and this one has a field "path" however I still cannot understand where that path id relative to.

I am sure I passed all my moodledata folder and that I have replaced the strings according to migration guidance.

Why are themes not able to be applied, why are icons not found and images not found? Is there an issue with my database?

Please kindly could anyone advice?

Many thanks.

In reply to Yunuen Carrillo

Re: Moodle not able to expand menus or retrieve images after moving moodle to a new server

by Ken Task -
Picture of Particularly helpful Moodlers
For internal links Moodle uses it's config.php file $CFG->wwwroot for all links *and* records those links in the database.     One of the steps to a migration is to find all those records (which could be spread over many tables) and do a search/replace.

One could do this in two ways:
1. edit the sql dump file from active server (the one you will import into the DB of the 'test site') prior to importing into new server's DB  using any text editor that has search and replace.    Search for: 'http://oldsite/' replace with 'http://newserver/'
2. run the admin tool for search/replace http://site/admin/tool/replace/

In both cases be sure you use 'http://' in front and the trailing '/' at the end.

There is a way to 'cheat' on a test site so you don't have to change anything related to moodle and that is to use entries in a workstations host file.   I do this often and it works.  One only has to remember that the host file will take precedence over DNS so one cannot work on both the test site AND the real site at same time from the workstation using this 'trick'.

Example:  real site FQDN  sos.tcea.org - whose IP address is xxx.xxx.xxx.xxx.
and I've copied the site to another test machine that does not have any FQDN ... just an IP address (which doesn't have to be public internet ... could be on a private network)

Making no changes to the site an entry in the host file of the workstation to be used.
Host file entry
yyy.yyy.yyy.yyy sos.tcea.org sos
where yyy.yyy.yyy.yyy is the 'temporary' work IP address'.
No need to restart anything, just open browser and go to the site by it's true domain name.
Host file is checked to find the IP and you should be now looking at the test site.

To avoid confusion, I'd add something on the front page - Section 0 on front page is a good place - that shows me this is the test site.   You can always remove that later.

'spirit of sharing', Ken
please feel free to rate useful if this helps ...

In reply to Ken Task

Re: Moodle not able to expand menus or retrieve images after moving moodle to a new server

by Yunuen Carrillo -
Thanks for replying Ken.
I had already done the steps 1 and 2 that you recommend.
However when searching on the db for those strings a second time I spotted that some of the links where referencing to the root + including 2 folders (/v2/moodle/)  that were in previous versions. I replaced that string by a ( / ). still no joy.

Problem is that no theme can be displayed properly, doesnt find css files.

I also found table mdl_host. This had the test site url but ip address was still pointing to live domain ip address. I changed the IP to the DNS ip the test domain has. Didn't make any difference.

In resume, files up, links updated with new root. Courses displaying but no themes, no images, no wysiwyg tool. When file has in table field "SERVERFiles: " how is this translated into path?

Thank you