ขั้นตอนการอัพเดต Drupal 8
To update from one 8.x.x version of Drupal to any later 8.x.x version, do the following:
- Log in as a user with the permission "Administer software updates".
In the command line (shell), navigate into your drupal installation:
Put site into maintenance mode through the Drupal admin interface. Go to Administration > Configuration > Development > Maintenance mode. Enable the "Put site into maintenance mode" checkbox and save the configuration.
Or via drush:
drush sset system.maintenance_mode 1 drush cr
Remove the 'core' and 'vendor' directories. Also remove all of the files in the top-level directory, except any that you added manually.
rm -rf core vendor rm -f *.* .*
If you made modifications to files like .htaccess, composer.json, or robots.txt you will need to re-apply them from your backup, after the new files are in place.
Sometimes an update includes changes to default.settings.php (this will be noted in the release notes). If that's the case, follow these steps:
- Locate your settings.php file in the /sites/* directory. (Typically sites/default.)
- Make a backup copy of your settings.php file, with a different file name.
- Make a copy of the new default.settings.php file, and name the copy settings.php (overwriting your previous settings.php file).
- Copy the custom and site-specific entries from the backup you made into the new settings.php file. You will definitely need the lines giving the database information, and you will also want to copy in any other customizations you have added.
You can find the release notes for your version athttps://www.drupal.org/project/drupal. At bottom of the project page under "Downloads" use the link for your version of Drupal to view the release notes. If your version is not listed, use the 'View all releases' link. From this page you can scroll down or use the filter to find your version and its release notes.
Download the latest Drupal 8.x.x release from https://www.drupal.org to a directory outside of your web root. Extract the archive and copy the files into your Drupal directory.
On a typical Unix/Linux command line, use the following commands to download and extract:
wget https://www.drupal.org/files/projects/drupal-x.y.z.tar.gz tar -zxvf drupal-x.y.z.tar.gz
This creates a new directory drupal-x.y.z/ containing all Drupal files and directories. Copy the files into your Drupal installation directory:
cp -Rf drupal-x.y.z/* drupal-x.y.z/.* /path/to/your/installation
Or you can use this if you're already in your drupal installation directory, and want overwrite everything WITHOUT being prompted to overwrite each file:
yes | cp -Rf drupal-x.y.z/* drupal-x.y.z/.* ./
If you do not have command line access to your server, download the archive from https://www.drupal.org using your web browser, extract it, and then use an FTP client to upload the files to your web root.
- Re-apply any modifications to files such as .htaccess, composer.json, or robots.txt.
- If using Composer to manage PHP libraries, update your /vendor directory with the following command:
- composer update drupal/core --with-dependencies
Run update.php by visiting http://www.example.com/update.php (replacewww.example.com with your domain name). This will update the core database tables.
If you are unable to access update.php do the following:
- Open settings.php with a text editor.
- Find the line that says:
$settings['update_free_access'] = FALSE;
- Change it into:
$settings['update_free_access'] = TRUE;
- Try again to run update.php.
- Once the update is done, $settings['update_free_access'] must be reverted to FALSE.
Or via drush:
drush updb drush entup
- Go to Administration > Reports > Status report. Verify that everything is working as expected.
- Ensure that $settings['update_free_access'] is FALSE in settings.php.
Go to Administration > Configuration > Development > Maintenance mode. Disable the "Put site into maintenance mode" checkbox and save the configuration.
Or via drush:
drush sset system.maintenance_mode 0 drush cr