drupal_settings_dir=/var/www/html/sites/default
if [ ! -d $drupal_settings_dir ] ; then
echo "Could not find directory $drupal_settings_dir"
- echo "This suggests that you do not have a planetlab-custom drupal installed"
+ echo "This suggests you do not have a planetlab-custom drupal installed"
exit 1
fi
pushd $drupal_settings_dir
# tune $db_url
if [ ! -f settings.php.drupal ] ; then
cp settings.php settings.php.drupal
- sed -e 's|^[ \t]*\$db_url.*|require_once("plc_config.php");$db_url="pgsql://" . PLC_DB_USER . ":" . PLC_DB_PASSWORD . "@" . PLC_DB_HOST . ":" . PLC_DB_PORT . "/drupal";|' \
- settings.php.drupal > settings.php
fi
+# always do this; it's idempotent
+# hopefully it will help in various upgrade scenarios where
+# drupal was re-installed, and settings.php was left in the original drupal state
+# which results in the infamous "cannot connect to mysql database"
+sed -e 's|^[ \t]*\$db_url.*|require_once("plc_config.php");$db_url="pgsql://" . PLC_DB_USER . ":" . PLC_DB_PASSWORD . "@" . PLC_DB_HOST . ":" . PLC_DB_PORT . "/drupal";|' \
+ settings.php.drupal > settings.php
popd
# append our own database creation hacks to the drupal database schema
pushd /var/www/html/database