Installation help

Accidently deleted public_html - best thing to do?

 
 
Picture of Melissa Benson
Accidently deleted public_html - best thing to do?
Group Particularly helpful MoodlersGroup Testers

We're running a very old version of Moodle 1.9


I was running into an issue where you'd click on an assignment and it gave me "Fatal error: Call to undefined method MoodleQuickForm_hidden::MoodleQuickForm_hidden()" so I was trying to ftp in and do some stuff and I couldn't remember my password. So I tried making new ftp accounts. Well I ended up figuring out the password and I deleted the ftp accounts I just made. I said yes to delete that users files too because I didn't have any files by that user because I jsut made it. Well somehow that deleted everything. It deleted the public_html folder and the Moodle server files. (this was using cpanel)


I'm waiting on support to see if they can help me out but it's been a good 40 minutes, no response. The database is still all there and everything...what is my best course of action here? Would it be possible (if the backups and my host can't help me) to upload a new copy of Moodle 1.9 and then things work? Sort of like if I were to have upgraded? If I can't get the Moodle server files back (I have the moodledata folder) would I lose anything? Would the courses still be there?


Any help would be great!! Ahh!

 
Average of ratings: -
Picture of Howard Miller
Re: Accidently deleted public_html - best thing to do?
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Fear not - it's the least unpleasant mistake to make. Just put it back with the same (or newer) version of the Moodle code from the download site. You'll also need any plugins you added  - although even that you can do later.

Log in as admin - go to Notifications page, go to Plugins overview and check. Done!

 
Average of ratings:Useful (1)
Picture of Melissa Benson
Re: Accidently deleted public_html - best thing to do?
Group Particularly helpful MoodlersGroup Testers

Phew, so if I can't recover the old moodle server files I can just do a new version. I'm going to try and get the old ones just because it might be smoother. Thanks!

 
Average of ratings: -
Picture of Ken Task
Re: Accidently deleted public_html - best thing to do?
Group Particularly helpful Moodlers

'just do a new version' ...    Howard already said the same ... am just re-phrasing ... Strongly suggest getting the most recent 1.9 code (1.9.19).   Then login and hit notifications.   It might be a minor upgrade 1.9.x -> 1.9.highest.  It is the path of least change and the recommended step to migrate a 1.9 to a 2.x anyway.    Do NOT go after a 2.x ... that will result in massive changes ... to DB and to data directory.

'spirit of thinkering', Ken


 
Average of ratings: -
Picture of Rick Jerz
Re: Accidently deleted public_html - best thing to do?
Group Particularly helpful Moodlers

Melissa, your solution (as provided by Howard and Ken) is essentially what you would do when upgrading Moodle.  No need to touch the mySQL database, no need to do anything with the moodledata folder.  However, there may be one important piece missing, your config.php file (normally in ../public_html/moodle), which contains information about your database, and moodledata.  So you might still need to rebuild this by hand, which should not be too hard.

The fresh copy of moodle will include an example of config.php that is pretty good as a starting point.

 
Average of ratings:Useful (1)
Picture of Visvanath Ratnaweera
Re: Accidently deleted public_html - best thing to do?
Group Particularly helpful Moodlers
The prescribed method is called http://docs.moodle.org/en/Site_backup. Since there was none so far, this is the best occasion to start one. Put a copy of $moodledata and a database dump aside, before you do anything.
 
Average of ratings: -
Picture of Ken Task
Re: Accidently deleted public_html - best thing to do?
Group Particularly helpful Moodlers

Very good point, Rick!  

Using the config-dist.php of the 1.9.19 downloaded code might need the following:

$CFG->dbtype    = 'mysql';
$CFG->dbhost    = 'localhost';  remotely hosted might have an IP address here
$CFG->dbname    = 'name_of_database_for_moodle';
$CFG->dbuser    = 'user_that_has_full_access_rights_to_moodle_db';
$CFG->dbpass    = 'password'; in clear text
$CFG->prefix    = 'mdl_';
$CFG->wwwroot   = 'http://urltomoodle'; (no trailing slash)
$CFG->dirroot   = '/path_to_code/moodle';
$CFG->dataroot  = '/path_to/moodledata';

The other item which might prove problematic depending IF your site had it ... password salt.

$CFG->passwordsaltmain = 'stringoflettersnumberssymbols';

The password salt line not present/used in versions of 1.9 prior to 1.9.6.   Anything higher might have used salted passwords.   Can't just invent one IF you had => 1.9.7.   All users passwords were not only md5 but had their passwords 'salted' using the value of the 'salt'.

Might help to know what OS and who host the site for you.

'spirit of thinkering', Ken

 
Average of ratings:Useful (1)
Picture of Melissa Benson
Re: Accidently deleted public_html - best thing to do?
Group Particularly helpful MoodlersGroup Testers

Thanks everyone. My host was finally able to go back to what we had. I'm afraid if I do an upgrade it might cause over issues. We're starting fresh on a Moodle 2 install asap smile

 
Average of ratings: -
Picture of Rick Jerz
Re: Accidently deleted public_html - best thing to do?
Group Particularly helpful Moodlers

On many hosted servers, you can have more than one install of Moodle (if you do the install yourself, no one-click install).  So you can keep your current version, and then install another version (like 2.x) based upon your servers php and mysql versions.

It is still a good time to backup your database and moodledata components.

 
Average of ratings: -
Sketch...
Re: Accidently deleted public_html - best thing to do?
Group Particularly helpful Moodlers

But you MUST backup the database and moodledata folder!  smile

 
Average of ratings: -