updating a drupal site

every drupal version contains an upgrade.txt file with useful instructions. To clarify a bit more, assuming the availability of cpanel.

backup = save the database with cpanel
open cpanel, go to phpmyadmin, click on the database name (in blue, with a number that represents the amount of tables in parenthesis next to it), click export (on the right side), make sure all tables are selected (select all), select sql, keep structure and data at deafult checkmarks, checkmark save database, checkmark gzipped, click go - download starts, save on computer.

backup = save the filesystem
open cpanel, go to file manager, go to public html, checkmark select all, click compress, checkmark gzipped, choose a name, click save - download starts, save on computer. alternative: save the entire site, include site settings and server email files by saving the "home" directory instead of just public html.

keep those safe, you'll need those in the next step and in case something goes wrong.

prepare files for re-insertion into the new code base. two ways: a) extract the back-up and pick out the needed files, or download them separately from cpanel. The following are needed: .htaccess, robots.txt files from the drupal root, and the entire sites directory. Also any other custom files that you may have (php.ini, fantastico list?).

Create a new working copy for the new file system. Copy the following directories from the previous directory to the new emtpy file system directory:

- cgi-bin (if you have it)
- sites

and these files:

- .htaccess
- fantastico-fileslist.txt (if you installed by fantastico)
- robots.txt
- php.ini (if you made one)

download the new core form the drupal site, i.e. Drupal 6.32, save and extract it.

compare .htaccess and robots.txt files in the root, and settings.php in sites, between the new core version and the corresponding files in your new current file system version.

synchronise the new versions of standard code of the new files with your specific modifications from previous versions (compare your settings.php file with the new version default.settings.php). overwrite the files in the newly made current filesystem folder with the synchronised versions. - now you have all relevant user files that are part of the system update in the new directory on your computer.

from new core version that you downloaded and extracted, make a copy and delete the following directory from the copy:

- sites

delete the following files:

- .htaccess
- robots.txt

rename this modified core directory to something like Drupal-6.32-minus-sites-htaccess-robots, and compress it with gzip.

log in to your site as user1. you need to be user1 in order to finish the update later. remain logged in as user1.

set the site theme to Garland. put the site into maintenance mode.

you are about to delete most of the old core files. go to the cpanel file manager and select all drupal directories and files (usually in public_html). then, you must deselect (unmark) the following, so that you will *not delete* them:

- cgi-bin (if you have it)
- sites
- symbolic links representing sub/addon domains (if you made them)
- fantastico-fileslist.txt (if you installed by fantastico)
- php.ini (if you made one)
- that should be it, but check for any non-Drupal files that you might need to keep

prepare to delete the entire selected lot: double check that you are not deleting the unchecked items above or something else that you want to keep.

delete the entire selection. refresh a few times to ensure deletion.

upload the gzipped modified Drupal file, in this example the Drupal-6.32-minus-sites-htaccess-robots file. reload page. extract the file. it creates a directory with the same name. enter this directory, select all files, move all files up one directory, that is into the main drupal location (public_html). remove the remaining empty directory.

upload the modified .htaccess, robots.txt, settings.php files.

update the site by entering domain.com/update.php in the address bar. follow the site update/upgrade screens.

this completes the file system update. Note that the core has been replaced, but you have kept sites, .htaccess (possibly updated), robots.txt (possibly updated). You have also kept non-Drupal files, in case there were any.

when all is ok, copy an unzipped version of the new core files minus sites, htaccess and robots (your Drupal-6.32-minus-sites-htaccess-robots) into your computer's new current file system directory. double check that server and computer files are identical.

core update is done. that leaves any module updates.

ps: there surely are other ways to go about it, i found this the fastest and most foolproof.

the sites directory must stay in place. it is not removed and re-uploaded because cpanel appears to disallow removal (better said, after deletion it reappears), unless a number of file permissions are changed, exclusively in cpanel. So it's faster and safer just to let it remain while being sure not to upload the Drupal-supplied sites directory.

Comments

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <div>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
Thanks for your help in stopping spam.
Image CAPTCHA
Enter the characters shown in the image.