Sfoglia il codice sorgente

Changes for elgg 1.12

Kévio Castro 10 anni fa
parent
commit
3c0d587248
3 ha cambiato i file con 17 aggiunte e 43 eliminazioni
  1. 3 0
      elgg-docker.sublime-project
  2. 3 35
      elgg-install.php
  3. 11 8
      elgg-install.sh

+ 3 - 0
elgg-docker.sublime-project

@@ -3,6 +3,9 @@
 	[
 		{
 			"path": "."
+		},
+		{
+			"path": "/home/kevio/WebProjects/resap2"
 		}
 	]
 }

+ 3 - 35
elgg-install.php

@@ -2,11 +2,8 @@
 /**
  * Docker CLI Elgg installer script 
  */
-$autoload_path = '/var/www/html/vendor/autoload.php';
-$autoload_available = include_once($autoload_path);
-if (!$autoload_available) {
-	die("Couldn't include '$autoload_path'. Did you run `composer install`?");
-}
+require_once getenv('ELGG_PATH')."vendor/autoload.php";
+$installer = new ElggInstaller();
 
 $params = array(
 	// database parameters
@@ -33,36 +30,7 @@ if (strlen($params['password']) < 6) {
     exit(1);
 }
 
-$createHtaccess = (file_exists($params['path'].'.htaccess')) ? false : true;
-
-$installer = new ElggInstaller();
-$installer->batchInstall($params, $createHtaccess);
-
-/**
- * Elgg create symbolic links on instalation with composer 
- * See "post-install-cmd": "\\Elgg\\Composer\\PostInstall::execute", for details.
- * Links are created on your local machine.
- * The links need to be changed to the container directories
- */
-$path_mod_root = getenv('ELGG_PATH').'mod/';
-$mods = scandir($path_mod_root);
-
-foreach ($mods as $key => $folder) {
-	if (is_link($path_mod_root.$folder)) {
-		unlink($path_mod_root.$folder);
-	}
-}
-
-$path_mod_vendor = getenv('ELGG_PATH').'vendor/elgg/elgg/mod/';
-$mods = scandir($path_mod_vendor);
-
-foreach ($mods as $key => $folder) {
-	if (is_dir($path_mod_vendor.$folder) && 
-		!is_link($path_mod_root.$folder) &&
-		!is_dir($path_mod_root.$folder)) {
-		symlink($path_mod_vendor.$folder, $path_mod_root.$folder);	
-	}
-}
+$installer->batchInstall($params, true);
 
 echo "Installation is complete.\n";
 echo "Open in your browser: {$params['wwwroot']}\n";

+ 11 - 8
elgg-install.sh

@@ -1,5 +1,4 @@
 #!/bin/sh
-
 set -e
 
 WAIT_MYSQL_START="30" # In seconds
@@ -7,6 +6,7 @@ MYSQL_PORT="$MYSQL_PORT"
 MYSQL_USER="$MYSQL_USER"
 MYSQL_PASS="$MYSQL_PASS"
 ELGG_DB_HOST="$ELGG_DB_HOST"
+ELGG_DB_NAME="$ELGG_DB_NAME"
 
 #wait for mysql
 i=0
@@ -19,12 +19,15 @@ while ! netcat $ELGG_DB_HOST $MYSQL_PORT >/dev/null 2>&1 < /dev/null; do
   echo "$(date) - waiting for ${ELGG_DB_HOST}:${MYSQL_PORT}... $i/$WAIT_MYSQL_START."
   sleep 1
 done
-echo "The MySQL server is ready."
 
-echo "Starting installation elgg."
-#This directory will hold Elgg's ``settings.php`` file after installation.
-if [ ! -d "${ELGG_PATH}elgg-config/" ]; then
-	mkdir "${ELGG_PATH}elgg-config/"
-	chown -R www-data:www-data "${ELGG_PATH}elgg-config/"
-fi
+# echo "The MySQL server is ready."
+# echo "Starting installation elgg."
+
+# Remove existing configuration files 
+rm -rf engine/settings.php
+rm -rf .htaccess
+
+# Dop existing tables
+mysql -u$MYSQL_USER -p$MYSQL_PASS -h$ELGG_DB_HOST --silent --skip-column-names -e "SHOW TABLES" $ELGG_DB_NAME | xargs -L1 -I% echo 'DROP TABLE `%`;' | mysql -u$MYSQL_USER -p$MYSQL_PASS -h$ELGG_DB_HOST -v $ELGG_DB_NAME
+
 php	/elgg-docker/elgg-install.php