Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Importing a database dump properly

ran81 edited this page Nov 4, 2013 · 1 revision

Below is an example of a shell script that allows you to import a database dump (*.sql file) for an already installed OpenScholar site.

##Using the script In your OpenScholar directory run the command: bash import.sh <path-to-sql-dump> <url-of-the-www-directory> For example: bash import.sh /tmp/backup-file.sql http://localhost/openscholar/www

#!/bin/bash

# Usage example:
# bash import.sh /tmp/backup-file.sql http://localhost/openscholar/www

cd www
drush sql-drop -y
echo "Importing SQL file."
`drush sql-connect` < $1
drush updb -y
drush fra -y
drush cc all
drush vrd -y --uri=$2
drush dl acquia_connector -y --uri=$2
drush en acquia_search -y
drush en dblog -y
drush en devel -y
drush en os_search_solr -y

# Remove existing Apache Solr index.
drush php-eval "apachesolr_environment_delete('acquia_search_server_1');"

# Add a local Apache Solr index.
drush php-eval "apachesolr_environment_save(array('env_id' => 'default', 'name' => 'default', 'url' => 'http://localhost:8983/solr', 'service_class' => ''));"


# Index site content using Apache Solr.
# @todo: Allow switch to index Solr.
# drush solr-mark-all; drush solr-index

# Set the file system.
drush vset file_public_path "sites/default/files"
drush vset file_private_path ""
drush vset file_temporary_path "/tmp"

# Open site as admin.
drush uli --uri=$2

Clone this wiki locally