Changeset 2863 for trunk/upgrade.php
- Timestamp:
- Nov 12, 2008, 1:40:20 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/upgrade.php
r2862 r2863 30 30 define('PHPWG_ROOT_PATH', './'); 31 31 32 if (!file_exists(PHPWG_ROOT_PATH.'include/mysql.inc.php')) 33 { 34 die('Could not find include/mysql.inc.php file.'); 32 // load config file 33 $config_file = PHPWG_ROOT_PATH.'include/mysql.inc.php'; 34 $config_file_contents = @file_get_contents($config_file); 35 if ($config_file_contents === false) 36 { 37 die('Cannot load '.$config_file); 38 } 39 $php_end_tag = strrpos($config_file_contents, '?'.'>'); 40 if ($php_end_tag === false) 41 { 42 die('Cannot find php end tag in '.$config_file); 35 43 } 36 44 … … 225 233 $page['infos'] = array(); 226 234 $page['errors'] = array(); 235 $mysql_changes = array(); 227 236 228 237 if (isset($_POST['username']) and isset($_POST['password'])) … … 239 248 $conf['die_on_sql_error'] = false; 240 249 include($upgrade_file); 250 251 // Something to add in mysql.inc.php? 252 if (!empty($mysql_changes)) 253 { 254 $config_file_contents = 255 substr($config_file_contents, 0, $php_end_tag) . "\r\n" 256 . implode("\r\n\r\n" , $mysql_changes) . "\r\n" 257 . substr($config_file_contents, $php_end_tag); 258 259 if (!@file_put_contents($config_file, $config_file_contents)) 260 { 261 array_push($page['infos'], 262 l10n('in include/mysql.inc.php, before ?>, insert:') . ' 263 <p><textarea rows="5" cols="40">'.implode("\r\n\r\n" , $mysql_changes).'</textarea></p>' 264 ); 265 } 266 } 241 267 242 268 // Plugins deactivation … … 270 296 271 297 array_push($page['infos'], 272 l10n('delete upgrade files'),273 298 l10n('perform a maintenance check') 274 299 );
Note: See TracChangeset
for help on using the changeset viewer.