diff -r 8978cb3541ca -r 9d7225c0db6d install/includes/payload.php --- a/install/includes/payload.php Thu Jan 17 19:49:14 2008 -0500 +++ b/install/includes/payload.php Thu Jan 17 23:28:43 2008 -0500 @@ -339,3 +339,76 @@ return true; } +function stg_aes_cleanup() +{ + global $db, $session, $paths, $template, $plugins; // Common objects + $q = $db->sql_query('DELETE FROM ' . table_prefix . 'config WHERE config_name = \'install_aes_key\' OR config_name = \'site_aes_key\';'); + if ( !$q ) + $db->_die(); + return true; +} + +function _stg_rename_config_revert() +{ + if ( file_exists('./config.php') ) + { + @rename('./config.php', './config.new.php'); + } + + $handle = @fopen('./config.php.new', 'w'); + if ( !$handle ) + return false; + $contents = ''; + fwrite($handle, $contents); + fclose($handle); + return true; +} + +function stg_build_index() +{ + global $db, $session, $paths, $template, $plugins; // Common objects + if ( $paths->rebuild_search_index() ) + return true; + return false; +} + +function stg_rename_config() +{ + if ( !@rename(ENANO_ROOT . '/config.new.php', ENANO_ROOT . '/config.php') ) + { + echo '
Can\'t rename config.php
'; + _stg_rename_config_revert(); + return false; + } + + if ( filesize(ENANO_ROOT . '/.htaccess.new') > 1 ) + { + // rename/possibly concatenate .htaccess.new + $htaccess_base = ''; + if ( file_exists(ENANO_ROOT . '/.htaccess') ) + $htaccess_base .= @file_get_contents(ENANO_ROOT . '/.htaccess'); + if ( strlen($htaccess_base) > 0 && !preg_match("/\n$/", $htaccess_base) ) + $htaccess_base .= "\n\n"; + $htaccess_base .= @file_get_contents(ENANO_ROOT . '/.htaccess.new'); + if ( file_exists(ENANO_ROOT . '/.htaccess') ) + { + $hh = @fopen(ENANO_ROOT . '/.htaccess', 'w'); + if ( !$hh ) + return false; + fwrite($hh, $htaccess_base); + fclose($hh); + @unlink(ENANO_ROOT . '/.htaccess.new'); + return true; + } + else + { + return @rename(ENANO_ROOT . '/.htaccess.new', ENANO_ROOT . '/.htaccess'); + } + } + else + { + @unlink(ENANO_ROOT . '/.htaccess.new'); + } + return true; +} +