Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Leveraged Andy's Installer class to automate installation of

cvs demo, Developer Appliance, and ubuntu packages.
Can also be utilized to install from command line
or scripts.
Instructions and details can be found in:
contrib/util/installScripts/InstallerAuto.php.
  • Loading branch information...
commit 7094eff0977eda68d4daf86ac928c71e9f3dc910 1 parent 229b49e
bradymiller authored
View
7 Tests/BaseHarness.class.php
@@ -18,16 +18,15 @@ public static function get_installer()
'igroup' => 'test_igroup',
'pass' => 'test_pass',
'server' => 'localhost',
- 'port' => '',
+ 'loginhost' => 'localhost',
+ 'port' => '3306',
'root' => 'root',
'rootpass' => getenv('EMR_ROOT_DATABASE_PASSWORD'),
'dbname' => 'openemr_test_suite',
'collate' => 'utf8_general_ci',
- 'openemrBasePath' => '',
- 'openemrWebPath' => '',
'site' => 'default',
);
- return new Installer( $fixture_cgi, '' );
+ return new Installer( $fixture_cgi );
}
View
14 Tests/InstallerTest.php
@@ -19,17 +19,15 @@ protected function setUp()
'igroup' => 'initialgroup',
'pass' => 'validpassword',
'server' => 'localhost',
+ 'loginhost' => 'localhost',
'port' => '3306',
'root' => 'root',
'rootpass' => 'notapass',
'dbname' => 'openemr_test_suite',
'collate' => '',
- 'openemrBasePath' => '',
- 'openemrWebPath' => '',
'site' => 'default',
);
- $this->manualPath = '';
- $this->installer = new Installer( $this->post_variables, $this->manualPath );
+ $this->installer = new Installer( $this->post_variables );
}
public function testAttributes()
@@ -53,7 +51,7 @@ public function testLoginValidator( $login, $expected_return )
{
$post_variables = $this->post_variables;
$post_variables['login'] = $login;
- $installer = new Installer( $post_variables, $this->manualPath );
+ $installer = new Installer( $post_variables );
$this->assertEquals($expected_return, $installer->login_is_valid(), "testing login: '$login'" );
}
@@ -73,7 +71,7 @@ public function testIuserIsInvalid()
{
$post_variables = $this->post_variables;
$post_variables['iuser'] = 'initial user';
- $installer = new Installer( $post_variables, $this->manualPath );
+ $installer = new Installer( $post_variables );
$this->assertEquals(FALSE, $installer->iuser_is_valid());
}
@@ -87,7 +85,7 @@ public function testPasswordIsInvalid()
{
$post_variables = $this->post_variables;
$post_variables['pass'] = '';
- $installer = new Installer( $post_variables, $this->manualPath );
+ $installer = new Installer( $post_variables );
$this->assertEquals(FALSE, $installer->password_is_valid());
}
@@ -161,4 +159,4 @@ public function tearDown()
You should have received a copy of the GNU General Public Licence along with
this file. If not see <http://www.gnu.org/licenses/>.
*/
-?>
+?>
View
4 acl_setup.php
@@ -30,11 +30,11 @@
// On 06/2009, added pertinent comments below each entry to allow capture
// of these terms by the translation engine.
- include_once('library/acl.inc');
+ require_once(dirname(__FILE__).'/library/acl.inc');
if (! $phpgacl_location) die("You must first set up library/acl.inc to use phpGACL!");
- include_once("$phpgacl_location/gacl_api.class.php");
+ require_once("$phpgacl_location/gacl_api.class.php");
$gacl = new gacl_api();
View
99 contrib/util/installScripts/InstallerAuto.php
@@ -0,0 +1,99 @@
+<?php
+// Copyright (C) 2010 Brady Miller <brady@sparmy.com>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This script is for automatic installation and ocnfiguration
+// of OpenEMR.
+//
+// This script is meant to be run as php command line (php-cli),
+// and needs to be first activated by removing the 'exit' line
+// at top (via sed command).
+//
+// Two modes include:
+//
+// 1) Generic (no parameters); uses default configuration settings.
+// php -f InstallerAuto.php
+//
+// 2) Custom; can send configuration setting(s) via command line. Note
+// that the ordering and number of custom settings that can be sent
+// is flexible.
+// php -f iuser=[iuser] iuname=[iuname] igroup=[igroup] server=[server]
+// port=[port] root=[root] rootpass=[rootpass] login=[login] pass=[pass]
+// dbname=[dbname] collate=[collate] site=[site]
+//
+// Examples:
+// php -f InstallerAuto.php
+// php -f InstallerAuto.php rootpass=howdy pass=hey
+//
+
+// This exit is to avoid malicious use of this script.
+exit;
+
+require_once(dirname(__FILE__).'/../../../library/classes/Installer.class.php');
+
+// Set up default configuration settings
+$installSettings = array();
+$installSettings['iuser'] = 'admin';
+$installSettings['iuname'] = 'Administrator';
+$installSettings['igroup'] = 'Default';
+$installSettings['server'] = 'localhost'; // mysql server
+$installSettings['loginhost'] = 'localhost'; // php/apache server
+$installSettings['port'] = '3306';
+$installSettings['root'] = 'root';
+$installSettings['rootpass'] = 'BLANK';
+$installSettings['login'] = 'openemr';
+$installSettings['pass'] = 'openemr';
+$installSettings['dbname'] = 'openemr';
+$installSettings['collate'] = 'utf8_general_ci';
+$installSettings['site'] = 'default';
+
+// Collect parameters(if exist) for installation configuration settings
+for ($i=1;$i < count($argv); $i++) {
+ $indexandvalue = explode("=",$argv[$i]);
+ $index = $indexandvalue[0];
+ $value = $indexandvalue[1];
+ $installSettings[$index] = $value;
+}
+
+// Process rootpass and collate setting (convert BLANK to empty)
+if ($installSettings['rootpass'] == "BLANK") $installSettings['rootpass'] = '';
+if ($installSettings['collate'] == "BLANK") $installSettings['collate'] = '';
+
+class InstallerAuto
+{
+ protected $installer;
+ protected $post_variables;
+
+ function __construct()
+ {
+ global $installSettings;
+ $this->post_variables = array( 'iuser' => $installSettings['iuser'],
+ 'iuname' => $installSettings['iuname'],
+ 'igroup' => $installSettings['igroup'],
+ 'server' => $installSettings['server'],
+ 'loginhost' => $installSettings['loginhost'],
+ 'port' => $installSettings['port'],
+ 'root' => $installSettings['root'],
+ 'rootpass' => $installSettings['rootpass'],
+ 'login' => $installSettings['login'],
+ 'pass' => $installSettings['pass'],
+ 'dbname' => $installSettings['dbname'],
+ 'collate' => $installSettings['collate'],
+ 'site' => $installSettings['site']
+ );
+ $this->installer = new Installer( $this->post_variables );
+ if ( ! $this->installer->quick_install() ) {
+ echo "ERROR: " . $this->installer->error_message . "\n";
+ }
+ echo $this->installer->debug_message . "\n";
+ }
+}
+
+// Run Installer
+new InstallerAuto();
+
+?>
View
87 contrib/util/installScripts/cvsDemoInstall
@@ -23,28 +23,16 @@ LOG=$WEB/log/logSetup.txt
CVS=/home/openemr/cvs
TMPDIR=/tmp/openemr-tmp
-# OTHER VARIABLES
-setHost="localhost" #mysql server (if not different from php, then localhost)
-setLoginhost="localhost" #php/apache server (if not different from mysql, then localhost)
-setPort="3306" #MySQL port
-setDbname="openemr" #MySQL openemr database name
-setLogin="openemr" #username to MySQL openemr database
-setPass="openemr" #password to MySQL openemr database
-setRoot="root" #MySQL server root username
-setRootpass="" #MySQL server root password
-setColl="utf8_general_ci" #collation for mysql
-setIuser="admin" #initial user login name
-setIuname="Administrator" #initial user full name
-setIgroup="Default" #practice group name
-setInst="1" #CONSTANT, don't set
+# PATH OF INSTALL SCRIPT
+INST=$OPENEMR/contrib/util/installScripts/InstallerAuto.php
+INSTTEMP=$OPENEMR/contrib/util/installScripts/InstallerAutoTemp.php
#INSTALL AND CONFIGURE OPENEMR
echo "Configuring OpenEMR"
echo "Configuring OpenEMR" >> $LOG
+#
# Set file and directory permissions
chmod 666 $OPENEMR/sites/default/sqlconf.php
-chmod 666 $OPENEMR/gacl/gacl.ini.php
-chmod 666 $OPENEMR/gacl/gacl.class.php
chown -R apache:apache $OPENEMR/sites/default/documents
chown -R apache:apache $OPENEMR/sites/default/edi
chown -R apache:apache $OPENEMR/sites/default/era
@@ -54,62 +42,19 @@ chown -R apache:apache $OPENEMR/interface/main/calendar/modules/PostCalendar/pnt
chown -R apache:apache $OPENEMR/interface/main/calendar/modules/PostCalendar/pntemplates/compiled
chown -R apache:apache $OPENEMR/gacl/admin/templates_c
#
-# CONVERT setup.php file to script, then run it
-#
-cp $OPENEMR/setup.php $OPENEMR/TEMPsetup.php
-# Set the path variable in setup.php
-sed -e 's@\$manualPath = \"\"\;@\$manualPath = \"'$OPENEMR'\/\"\;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
-mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
-# Set the variables in setup.php
-sed -e 's@\/\/END POST VARIABLES@\
- $host = '\'''$setHost''\'';\
- $server = '\'''$setHost''\'';\
- $port = '$setPort';\
- $dbname = '\'''$setDbname''\'';\
- $root = '\'''$setRoot''\'';\
- $login = '\'''$setLogin''\'';\
- $pass = '\'''$setPass''\'';\
- $loginhost = '\'''$setLoginhost''\'';\
- $rootpass = '\'''$setRootpass''\'';\
- $iuser = '\'''$setIuser''\'';\
- $iuname = '\'''$setIuname''\'';\
- $igroup = '\'''$setIgroup''\'';\
- $collate = '\'''$setColl''\'';\
- $inst = 1;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
-mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
-# Remove form functionality
-sed -e 's@<INPUT TYPE='\''SUBMIT'\'' VALUE='\''Continue'\''>@ @' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
-mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
-#prepare gacl/setup.php script
-cp $OPENEMR/gacl/setup.php $OPENEMR/gacl/TEMP2setup.php
-sed -e 's@.\/gacl\/gacl.ini.php@'$OPENEMR'\/gacl\/gacl.ini.php@' <$OPENEMR/gacl/setup.php >$OPENEMR/gacl/TEMPsetup.php
-mv -f $OPENEMR/gacl/TEMPsetup.php $OPENEMR/gacl/setup.php
-sed -e 's@.\/gacl\/admin\/gacl_admin.inc.php@'$OPENEMR'\/gacl\/admin\/gacl_admin.inc.php@' <$OPENEMR/gacl/setup.php >$OPENEMR/gacl/TEMPsetup.php
-mv -f $OPENEMR/gacl/TEMPsetup.php $OPENEMR/gacl/setup.php
-sed -e 's@.\/gacl\/schema.xml@'$OPENEMR'\/gacl\/schema.xml@' <$OPENEMR/gacl/setup.php >$OPENEMR/gacl/TEMPsetup.php
-mv -f $OPENEMR/gacl/TEMPsetup.php $OPENEMR/gacl/setup.php
-#prepare library/acl.inc script
-cp $OPENEMR/library/acl.inc $OPENEMR/library/TEMP2acl.inc
-sed -e 's@\$phpgacl_location = \"gacl\";@\$phpgacl_location = \"'$OPENEMR'\/gacl\";@' <$OPENEMR/library/acl.inc >$OPENEMR/library/TEMPacl.inc
-mv -f $OPENEMR/library/TEMPacl.inc $OPENEMR/library/acl.inc
-# (step 3) Set up OpenEMR and MySQL
-sed -e 's@$state = $_POST\["state"\];@$state = 3;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
-mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
-php -f $OPENEMR/TEMPsetup.php >> $LOG
-# (step 4) Configure sqlconf.php file
-sed -e 's@$state = 3;@$state = 4;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
-mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
-php -f $OPENEMR/TEMPsetup.php >> $LOG
-rm -f $OPENEMR/TEMPsetup.php
+# Run installer class for the demo (note to avoid malicious use, script is activated by removing an exit command,
+# and the active script is then removed after completion.
+sed -e 's@^exit;@ @' <$INST >$INSTTEMP
+php -f $INSTTEMP >> $LOG
+rm -f $INSTTEMP
+#
#reinstitute file permissions
chmod 644 $OPENEMR/sites/default/sqlconf.php
-#replace original acl.inc and gacl/setup.php script
-mv $OPENEMR/library/TEMP2acl.inc $OPENEMR/library/acl.inc
-mv $OPENEMR/gacl/TEMP2setup.php $OPENEMR/gacl/setup.php
echo "Done configuring OpenEMR"
echo "Done configuring OpenEMR" >> $LOG
#NOW DEAL WITH STUFF SPECIFIC TO THE CVS DEMO AND DEVELOPER APPLIANCE
+#
#Connect to a new mandriva package repository (official repository no longer supports mandriva 2008)
echo "Updating new Mandriva Package repository. This is a 100MB download, so may take several minutes."
echo "Updating new Mandriva Package repository. This is a 100MB download, so may take several minutes." >> $LOG
@@ -117,11 +62,13 @@ urpmi.addmedia main http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/m
urpmi.addmedia --update main_updates http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/media/main/updates with media_info/hdlist.cz
urpmi.addmedia contrib http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/media/contrib/release with media_info/hdlist.cz
urpmi.addmedia --update contrib_updates http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/media/contrib/updates with media_info/hdlist.cz
+#
#Install php-gd (graphics), php-mbstring (multibyte character support), php-zip, php-xsl and perl-CGI packages
# and restart apache (done after below suhosin patch).
echo "Installing gd(graphics) and mbstring(multibyte support) and zip php packages and xsl php package and perl-CGI package..."
echo "Installing gd(graphics) and mbstring(multibyte support) and zip php packages and xsl php package and perl-CGI package..." >> $LOG
urpmi --auto php-gd php-mbstring php-zip php-xsl perl-CGI >> $LOG
+#
#Patch the suhosin bug
SUHOSINCONF=/etc/php.d/Z98_suhosin.ini
echo "Disabling suhosin patch which is not compatible with OpenEMR"
@@ -136,6 +83,7 @@ echo ""
sed -i 's/^extension = suhosin.so/; extension = suhosin.so/' $SUHOSINCONF
service httpd restart
echo ""
+#
#Replace manual with newest version from cvs
echo "Configuring appliance"
echo "Configuring appliance" >> $LOG
@@ -144,11 +92,13 @@ chown openemr:openemr /home/openemr/docs/manual.txt
cp -f $OPENEMR/contrib/util/installScripts/cvsDemoMisc/developerApplianceManual.txt $WEB/manual.txt
echo "Done configuring appliance"
echo "Done configuring appliance" >> $LOG
+#
#Package the cvs version into a tarball and zip file to be available thru web browser
# This is basically to allow download of most recent cvs version from the cvs Demo appliance
# It will also ease transfer/testing openemr on windows systems when using the Developer appliance
echo "Creating OpenEMR CVS packages"
echo "Creating OpenEMR CVS packages" >> $LOG
+#
# Prepare the cvs package
mkdir -p $TMPDIR
cp -rf $CVS/openemr $TMPDIR/
@@ -162,20 +112,25 @@ chmod -R a+w $TMPDIR/openemr/sites/default/letter_templates
chmod -R a+w $TMPDIR/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/cache
chmod -R a+w $TMPDIR/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/compiled
chmod -R a+w $TMPDIR/openemr/gacl/admin/templates_c
+#
# Create the web file directory
mkdir $WEB/files
+#
# Save the tar.gz cvs package
cd $TMPDIR
tar -czf $WEB/files/openemr-cvs.tar.gz openemr
cd $WEB/files
md5sum openemr-cvs.tar.gz > openemr-linux-md5.txt
+#
# Save the .zip cvs package
cd $TMPDIR
zip -rq $WEB/files/openemr-cvs.zip openemr
cd $WEB/files
md5sum openemr-cvs.zip > openemr-windows-md5.txt
+#
# Create the time stamp
date > date-cvs.txt
+#
# Clean up
rm -fr $TMPDIR
echo "Done creating OpenEMR CVS packages"
View
4 contrib/util/ubuntu_package_scripts/development/README.Debian
@@ -48,5 +48,5 @@ just installed it is very helpful.
Authors of debianized OpenEMR:
------------------------------
--- Brady Miller <brady@sparmy.com> Wed, 22 Sep 2010 22:16:23 -0700
--- Amalu Obinna <amaluobinna@aol.com> Wed, 22 Sep 2010 22:16:23 -0700
+-- Brady Miller <brady@sparmy.com> Mon, 04 Oct 2010 02:38:33 -0700
+-- Amalu Obinna <amaluobinna@aol.com> Mon, 04 Oct 2010 02:38:33 -0700
View
6 contrib/util/ubuntu_package_scripts/development/changelog.Debian
@@ -1,3 +1,9 @@
+cvs-openemr (1.0.0-6) stable; urgency=low
+
+ * start utilizing the InstallerAuto class
+
+ -- Brady Miller <brady@sparmy.com> Mon, 04 Oct 2010 02:38:33 -0700
+
cvs-openemr (1.0.0-5) stable; urgency=low
* change in directory architecture
View
2  contrib/util/ubuntu_package_scripts/development/control
@@ -1,5 +1,5 @@
Package: cvs-openemr
-Version: 1.0.0-4
+Version: 1.0.0-6
Maintainer: Brady Miller <brady@sparmy.com>
Installed-Size: 46000
Priority: optional
View
2  contrib/util/ubuntu_package_scripts/development/copyright
@@ -1,5 +1,5 @@
This package was debianized by Brady Miller <brady@sparmy.com> on
-Wed, 22 Sep 2010 22:16:23 -0700.
+Mon, 04 Oct 2010 02:38:33 -0700.
Upstream Author:
http://www.oemr.org
View
95 contrib/util/ubuntu_package_scripts/development/postinst
@@ -8,7 +8,7 @@
# authors: Brady Miller <brady@sparmy.com>
# Amalu Obinna <amaluobinna@aol.com>
#
-# date: 05/14/10
+# date: 10/04/2010
#
# Debian package post installation script steps:
# 1) Collect mysql root password
@@ -48,6 +48,9 @@ case "$1" in
#web user and group
WEB_GROUP=www-data
WEB_USER=www-data
+ #auto installer location
+ INST=$OPENEMR/contrib/util/installScripts/InstallerAuto.php
+ INSTTEMP=$OPENEMR/contrib/util/installScripts/InstallerAutoTemp.php
#Standardized echo function to send to both echo and to log file
# requires one parameter (string)
@@ -193,33 +196,26 @@ case "$1" in
output_both "Installing/Configuring OpenEMR cvs version..."
mv $TMPDIR/openemr $OPENEMR
- # CONFIGURE OPENEMR BELOW
-
- # Create a random password for the openemr mysql user
- password=$(makepasswd --char=12)
-
- # openemr installation VARIABLES
- setHost="$INSTALL_SITE" #mysql server (if not different from php, then localhost)
- setLoginhost="$INSTALL_SITE" #php/apache server (if not different from mysql, then localhost)
- setPort="3306" #MySQL port
- setDbname="$INSTALL_DATABASE" #MySQL openemr database name
- setLogin="$INSTALL_USER" #username to MySQL openemr database
- setPass="$password" #password to MySQL openemr database
- setRoot="root" #MySQL server root username
- setRootpass="$MPASS" #MySQL server root password
- setColl="utf8_general_ci" #collation for mysql
- setIuser="admin" #initial user login name
- setIuname="Administrator" #initial user full name
- setIgroup="Default" #practice group name
- setInst="1" #CONSTANT, don't set
-
#go to openemr directory
cd $OPENEMR
#secure openemr
chown -Rf root:root $OPENEMR
+
+ #INSTALL AND CONFIGURE OPENEMR
+ # Create a random password for the openemr mysql user
+ password=$(makepasswd --char=12)
+
+ # openemr installation VARIABLES
+ if [ "$MPASS" == "" ] ; then
+ rootpass="rootpass=BLANK" #MySQL server root password
+ else
+ rootpass="rootpass=$MPASS" #MySQL server root password
+ fi
+ login="login=$INSTALL_USER" #username to MySQL openemr database
+ pass="pass=$password" #password to MySQL openemr database
+ dbname="dbname=$INSTALL_DATABASE" #MySQL openemr database name
- #INSTALL AND CONFIGURE OPENEMR
# Set file and directory permissions
chmod 666 $OPENEMR/library/sqlconf.php
chown -R $WEB_GROUP.$WEB_USER $SITEDIR/documents
@@ -231,56 +227,11 @@ case "$1" in
chown -R $WEB_GROUP.$WEB_USER $OPENEMR/interface/main/calendar/modules/PostCalendar/pntemplates/compiled
chown -R $WEB_GROUP.$WEB_USER $OPENEMR/gacl/admin/templates_c
#
- # CONVERT setup.php file to script, then run it
- #
- cp -f $OPENEMR/setup.php $OPENEMR/TEMPsetup.php
- # Set the path variable in setup.php
- sed -e 's@\$manualPath = \"\"\;@\$manualPath = \"'$OPENEMR'\/\"\;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
- mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
- # Set the variables in setup.php
- sed -e 's@\/\/END POST VARIABLES@\
- $host = '\'''$setHost''\'';\
- $server = '\'''$setHost''\'';\
- $port = '$setPort';\
- $dbname = '\'''$setDbname''\'';\
- $root = '\'''$setRoot''\'';\
- $login = '\'''$setLogin''\'';\
- $pass = '\'''$setPass''\'';\
- $loginhost = '\'''$setLoginhost''\'';\
- $rootpass = '\'''$setRootpass''\'';\
- $iuser = '\'''$setIuser''\'';\
- $iuname = '\'''$setIuname''\'';\
- $igroup = '\'''$setIgroup''\'';\
- $collate = '\'''$setColl''\'';\
- $inst = 1;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
- mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
- # Remove form functionality
- sed -e 's@<INPUT TYPE='\''SUBMIT'\'' VALUE='\''Continue'\''>@ @' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
- mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
- #prepare gacl/setup.php script
- cp $OPENEMR/gacl/setup.php $OPENEMR/gacl/TEMP2setup.php
- sed -e 's@.\/gacl\/gacl.ini.php@'$OPENEMR'\/gacl\/gacl.ini.php@' <$OPENEMR/gacl/setup.php >$OPENEMR/gacl/TEMPsetup.php
- mv -f $OPENEMR/gacl/TEMPsetup.php $OPENEMR/gacl/setup.php
- sed -e 's@.\/gacl\/admin\/gacl_admin.inc.php@'$OPENEMR'\/gacl\/admin\/gacl_admin.inc.php@' <$OPENEMR/gacl/setup.php >$OPENEMR/gacl/TEMPsetup.php
- mv -f $OPENEMR/gacl/TEMPsetup.php $OPENEMR/gacl/setup.php
- sed -e 's@.\/gacl\/schema.xml@'$OPENEMR'\/gacl\/schema.xml@' <$OPENEMR/gacl/setup.php >$OPENEMR/gacl/TEMPsetup.php
- mv -f $OPENEMR/gacl/TEMPsetup.php $OPENEMR/gacl/setup.php
- #prepare library/acl.inc script
- cp $OPENEMR/library/acl.inc $OPENEMR/library/TEMP2acl.inc
- sed -e 's@\$phpgacl_location = \"gacl\";@\$phpgacl_location = \"'$OPENEMR'\/gacl\";@' <$OPENEMR/library/acl.inc >$OPENEMR/library/TEMPacl.inc
- mv -f $OPENEMR/library/TEMPacl.inc $OPENEMR/library/acl.inc
- # (step 3) Set up OpenEMR and MySQL
- sed -e 's@$state = $_POST\["state"\];@$state = 3;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
- mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
- php -f $OPENEMR/TEMPsetup.php >> $LOG
- # (step 4) Configure sqlconf.php file
- sed -e 's@$state = 3;@$state = 4;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
- mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
- php -f $OPENEMR/TEMPsetup.php >> $LOG
- rm -f $OPENEMR/TEMPsetup.php
- #replace original acl.inc and gacl/setup.php script
- mv $OPENEMR/library/TEMP2acl.inc $OPENEMR/library/acl.inc
- mv $OPENEMR/gacl/TEMP2setup.php $OPENEMR/gacl/setup.php
+ # Run Auto Installer
+ #
+ sed -e 's@^exit;@ @' <$INST >$INSTTEMP
+ php -f $INSTTEMP $rootpass $login $pass $dbname >> $LOG
+ rm -f $INSTTEMP
# NO NEED to secure files since this is a development/testing version
View
2  gacl/gacl.class.php
@@ -55,7 +55,7 @@ class gacl {
/*
--- phpGACL Configuration path/file ---
*/
- var $config_file = './gacl.ini.php';
+ var $config_file = '';
/*
--- Private properties ---
View
1  gacl/setup.php
@@ -11,7 +11,6 @@
$db_host = $gacl->_db_host;
$db_user = $gacl->_db_user;
$db_password = $gacl->_db_password;
-$db_name = $gacl->_db_name;
$failed = 0;
View
2  interface/usergroup/adminacl.php
@@ -511,7 +511,7 @@ function generic_click(cthis) {
<body class="body_top">
<span class='title'><?php xl('Access Control List Administration','e'); ?></span>&nbsp;
- <?php if ($phpgacl_location == ($GLOBALS['fileroot']."/gacl")) {
+ <?php if ($phpgacl_location) {
echo "<a href='../../gacl/admin/acl_admin.php' onclick='top.restoreSession()'><span class='back'>(" . xl('Advanced') . ")</span></a>";
} ?>
<br><br>
View
22 library/acl.inc
@@ -5,29 +5,19 @@
// for users who are using an external version of php-GACL.
// Also note that php-GACL access controls can be turned off
// below.
- if (isset ($GLOBALS['fileroot'])) {
- //normal use during OpenEMR
- $phpgacl_location = $GLOBALS['fileroot'] . "/gacl";
- }
- else {
- //special case during OpenEMR and php-GACL install/upgrade scripts,
- //which are run from main OpenEMR directory.
- $phpgacl_location = "gacl";
- }
- if (isset ($GLOBALS['phpmyadmin_acl_check'])) {
- //use for phpmyadmin acl check (ie. no globals.php is included)
- $phpgacl_location = "../gacl";
- }
+
+ $phpgacl_location = dirname(__FILE__).'/../gacl';
+
//
// If using an external version of phpGACL, then uncomment the following
// line and manually place the path below. IN THIS CASE YOU MUST ALSO
-// COMMENT OUT ALL THREE $phpgacl_location ASSIGNMENTS ABOVE, OR BACKUPS WILL
+// COMMENT OUT ABOVB $phpgacl_location ASSIGNMENT ABOVE, OR BACKUPS WILL
// NOT RESTORE PROPERLY!
//
//$phpgacl_location = "/var/www/gacl";
//
// If you want to turn off php-GACL, then uncomment the following line.
-// IN THIS CASE YOU MUST ALSO COMMENT OUT ALL $phpgacl_location ASSIGNMENTS
+// IN THIS CASE YOU MUST ALSO COMMENT OUT ABOVE $phpgacl_location ASSIGNMENT(S)
// ABOVE, OR BACKUPS WILL NOT RESTORE PROPERLY!
//
//unset($phpgacl_location);
@@ -414,7 +404,7 @@
if (empty($arr_group_titles)) break;
}
}
- return;
+ return true;
}
//
View
89 library/classes/Installer.class.php
@@ -2,45 +2,44 @@
/* Copyright © 2010 by Andrew Moore */
/* Licensing information appears at the end of this file. */
-set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) );
-set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/..');
-
class Installer
{
- public function __construct( $cgi_variables, $manualPath )
+ public function __construct( $cgi_variables )
{
- $this->login = $cgi_variables['login'];
+ // Installation variables
$this->iuser = $cgi_variables['iuser'];
$this->iuname = $cgi_variables['iuname'];
$this->igroup = $cgi_variables['igroup'];
- $this->pass = $cgi_variables['pass'];
- $this->server = $cgi_variables['server'];
+ $this->server = $cgi_variables['server']; // mysql server (usually localhost)
+ $this->loginhost = $cgi_variables['loginhost']; // php/apache server (usually localhost)
$this->port = $cgi_variables['port'];
$this->root = $cgi_variables['root'];
$this->rootpass = $cgi_variables['rootpass'];
+ $this->login = $cgi_variables['login'];
+ $this->pass = $cgi_variables['pass'];
$this->dbname = $cgi_variables['dbname'];
$this->collate = $cgi_variables['collate'];
$this->site = $cgi_variables['site'];
- $this->loginhost = 'localhost';
+ // Make this true for IPPF.
+ $this->ippf_specific = false;
- $this->manualPath = $manualPath;
- $GLOBALS['OE_SITE_DIR'] = $this->manualPath . "sites/" . $this->site;
- require_once 'acl.inc'; // Have to delay this until after $GLOBALS['OE_SITE_DIR'] is set
+ // Record name of sql access file
+ $GLOBALS['OE_SITE_DIR'] = dirname(__FILE__) . '/../../sites/' . $this->site;
$this->conffile = $GLOBALS['OE_SITE_DIR'] . '/sqlconf.php';
- $this->openemrBasePath = $cgi_variables["openemrBasePath"];
- $this->openemrWebPath = $cgi_variables["openemrWebPath"];
- $this->gaclSetupScript1 = $this->manualPath . "gacl/setup.php";
- $this->gaclSetupScript2 = $this->manualPath . "acl_setup.php";
+ // Record names of sql table files
+ $this->main_sql = dirname(__FILE__) . '/../../sql/database.sql';
+ $this->translation_sql = dirname(__FILE__) . '/../../contrib/util/language_translations/currentLanguage_utf8.sql';
+ $this->ippf_sql = dirname(__FILE__) . "/../../sql/ippf_layout.sql";
- // Make this true for IPPF.
- $this->ippf_specific = false;
+ // Record name of php-gacl installation files
+ $this->gaclSetupScript1 = dirname(__FILE__) . "/../../gacl/setup.php";
+ $this->gaclSetupScript2 = dirname(__FILE__) . "/../../acl_setup.php";
$this->error_message = '';
$this->dbh = false;
- require_once($this->conffile);
}
public function login_is_valid()
@@ -72,7 +71,7 @@ public function password_is_valid()
public function root_database_connection()
{
- $this->dbh = $this->connect_to_database( $this->server, $this->root, $this->rootpass );
+ $this->dbh = $this->connect_to_database( $this->server, $this->root, $this->rootpass, $this->port );
if ( $this->dbh ) {
return $this->dbh;
} else {
@@ -83,7 +82,7 @@ public function root_database_connection()
public function user_database_connection()
{
- $this->dbh = $this->connect_to_database( $this->server, $this->login, $this->pass );
+ $this->dbh = $this->connect_to_database( $this->server, $this->login, $this->pass, $this->port );
if ( ! $this->dbh ) {
$this->error_message = "unable to connect to database as user: '$this->login'";
return FALSE;
@@ -190,10 +189,12 @@ public function write_configuration_file() {
fwrite($fd,"\$dbase\t= '$this->dbname';\n\n") or $it_died++;
fwrite($fd,"//Added ability to disable\n") or $it_died++;
fwrite($fd,"//utf8 encoding - bm 05-2009\n") or $it_died++;
+ fwrite($fd,"global \$disable_utf8_flag;\n") or $it_died++;
fwrite($fd,"\$disable_utf8_flag = false;\n") or $it_died++;
$string = '
$sqlconf = array();
+global $sqlconf;
$sqlconf["host"]= $host;
$sqlconf["port"] = $port;
$sqlconf["login"] = $login;
@@ -211,20 +212,21 @@ public function write_configuration_file() {
';
?><?php // done just for coloring
- fwrite($fd,$string) or $it_died++;
+ fwrite($fd,$string) or $it_died++;
+ fclose($fd) or $it_died++;
-//it's rather irresponsible to not report errors when writing this file.
- if ($it_died != 0) {
- $this->error_message = "ERROR. Couldn't write $it_died lines to config file '$this->conffile'.\n";
- return FALSE;
- }
- fclose($fd);
+ //it's rather irresponsible to not report errors when writing this file.
+ if ($it_died != 0) {
+ $this->error_message = "ERROR. Couldn't write $it_died lines to config file '$this->conffile'.\n";
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
public function insert_globals() {
- require_once("library/globals.inc.php");
+ function xl($s) { return $s; }
+ require(dirname(__FILE__) . '/../globals.inc.php');
foreach ($GLOBALS_METADATA as $grpname => $grparr) {
foreach ($grparr as $fldid => $fldarr) {
list($fldname, $fldtype, $flddef, $flddesc) = $fldarr;
@@ -238,6 +240,7 @@ public function insert_globals() {
}
}
}
+ return TRUE;
}
public function install_gacl()
@@ -253,8 +256,8 @@ public function install_gacl()
$this->error_message = "install_gacl failed: unable to require gacl script 2";
return FALSE;
}
- // return TRUE;
- return $install_results_1 . $install_results_2;;
+ $this->debug_message .= $install_results_1 . $install_results_2;
+ return TRUE;
}
public function configure_gacl()
@@ -288,8 +291,7 @@ public function quick_install() {
if ( ! $this->user_database_connection() ) {
return False;
}
- $dump_results = $this->load_dumpfiles();
- if (! $dump_results ) {
+ if (! $this->load_dumpfiles() ) {
return False;
}
if ( ! $this->add_initial_user() ) {
@@ -298,9 +300,16 @@ public function quick_install() {
if ( ! $this->write_configuration_file() ) {
return False;
}
- require $GLOBALS['OE_SITE_DIR'] . "/sqlconf.php";
- require_once 'translation.inc.php';
- $this->insert_globals();
+ if ( ! $this->insert_globals() ) {
+ return False;
+ }
+ if ( ! $this->install_gacl()) {
+ return False;
+ }
+ if ( ! $this->configure_gacl()) {
+ return False;
+ }
+
return True;
}
@@ -318,7 +327,7 @@ private function execute_sql( $sql ) {
}
}
- private function connect_to_database( $server, $user, $password, $port='3306' )
+ private function connect_to_database( $server, $user, $password, $port )
{
if ($server == "localhost")
$dbh = mysql_connect($server, $user, $password);
@@ -339,10 +348,10 @@ private function set_collation()
// including the correct translation dumpfile
// The keys are the paths of the dumpfiles, and the values are the titles
private function dumpfiles() {
- $dumpfiles = array( $this->manualPath."sql/database.sql" => 'Main',
- $this->manualPath."contrib/util/language_translations/currentLanguage_utf8.sql" => "Language Translation (utf8)" );
+ $dumpfiles = array( $this->main_sql => 'Main',
+ $this->translation_sql => "Language Translation (utf8)" );
if ($this->ippf_specific) {
- $dumpfiles[ $this->manualPath."sql/ippf_layout.sql" ] = "IPPF Layout";
+ $dumpfiles[ $this->ippf_sql ] = "IPPF Layout";
}
return $dumpfiles;
}
View
2  sites/default/sqlconf.php
@@ -3,6 +3,7 @@
// MySQL Config
// Referenced from /library/sqlconf.php.
+global $disable_utf8_flag;
$disable_utf8_flag = false;
$host = 'localhost';
@@ -12,6 +13,7 @@
$dbase = 'openemr';
$sqlconf = array();
+global $sqlconf;
$sqlconf["host"]= $host;
$sqlconf["port"] = $port;
$sqlconf["login"] = $login;
Please sign in to comment.
Something went wrong with that request. Please try again.