Project

General

Profile

« Previous | Next » 

Revision 2015

Added by darkviper almost 11 years ago

  1. some fixes in upgrade-script and UpgradeHelper.
    ! update initialize.php for secure use of setup.ini.php

View differences:

UpgradeHelper.php
137 137
				      . '<li>setup.ini.php.new</li></ul>';
138 138
				self::dieWithMessage($sMsg);
139 139
			} else { // ok, let's change the files now!
140
				if (file_exists($aAppPath.'setup.ini.php')) {
140
				if (file_exists($sAppPath.'setup.ini.php')) {
141 141
				// if 'setup.ini.php' exists
142
					if (!is_writeable($aAppPath.'setup.ini.php')) {
142
					if (!is_writeable($sAppPath.'setup.ini.php')) {
143 143
					// but it's not writable
144 144
						$sMsg = 'The file \'setup.ini.php\' already exists but is not writeable!';
145 145
						self::dieWithMessage($sMsg);
146 146
					}
147 147
				} else {
148 148
				// try to rename 'setup.ini.php.new' into 'setup.ini.php'
149
					if (!rename($aAppPath.'setup.ini.php.new', $aAppPath.'setup.ini.php')) {
150
						$sMsg = 'Can not rename \''.$aAppPath.'setup.ini.php.new\' into \''.$aAppPath.'setup.ini.php\' !!<br />'
151
						      . 'Create an empty file \''.$aAppPath.'setup.ini.php\' and make it writeable for the server!';
149
					if (!rename($sAppPath.'setup.ini.php.new', $sAppPath.'setup.ini.php')) {
150
						$sMsg = 'Can not rename \''.$sAppPath.'setup.ini.php.new\' into \''.$sAppPath.'setup.ini.php\' !!<br />'
151
						      . 'Create an empty file \''.$sAppPath.'setup.ini.php\' and make it writeable for the server!';
152 152
						self::dieWithMessage($sMsg);
153 153
					}
154 154
				}
......
172 172
					$aSetupConsts['ADMIN_DIRECTORY'] = trim(str_replace('\\', '/', preg_replace('/^'.preg_quote(WB_PATH, '/').'/', '', ADMIN_PATH)), '/').'/';
173 173
					$aSetupConsts['WB_URL'] = rtrim(str_replace('\\', '/', WB_URL), '/').'/';
174 174
				// Try and write settings to config file
175
					if (writeSetupIni($sAppPath, $aSetupConsts)) {
176
						if (writeConfig($sAppPath)) {
175
					if (self::writeSetupIni($sAppPath, $aSetupConsts)) {
176
						if (self::writeConfig($sAppPath)) {
177 177
							return true;
178 178
						} else {
179 179
							$sMsg ='Error writing \''.$sAppPath.'config.php\'!';
......
228 228
		   ."user    = \"".$aSetupValues['DB_USERNAME']."\"\n"
229 229
		   ."pass    = \"".$aSetupValues['DB_PASSWORD']."\"\n"
230 230
		   ."host    = \"".$aSetupValues['DB_HOST']."\"\n"
231
		   ."port    = \"".$aSetupValues['DB_PORT']."3306\"\n"
231
		   ."port    = \"".$aSetupValues['DB_PORT']."\"\n"
232 232
		   ."name    = \"".$aSetupValues['DB_NAME']."\"\n"
233 233
		   ."charset = \"".$aSetupValues['DB_CHARSET']."\"\n"
234 234
		   ."table_prefix = \"".$aSetupValues['TABLE_PREFIX']."\"\n"

Also available in: Unified diff