Server : Apache System : Linux cs317.bluehost.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : andertr9 ( 1047) PHP Version : 8.2.18 Disable Function : NONE Directory : /opt/eig_wp/wp_install/ |
Upload File : |
<? //ini_set("display_errors", 1); //error_reporting(E_ALL); include("/opt/eig_wp/wp_install/includes.php"); $total_start = microtime(true); $install_options = setup_options( array( "db_name" => "::", "db_user" => "::", "db_password" => "::", "table_prefix" => "", "site_url" => "", "brand" => "", "host_id" => "", "token" => "", "blog_title" => "Welcome", "user_name" => "admin", "install_path" => "", # This will be a required arg in the next version. ) ); $usefiles['mustuse_check'] = "/opt/eig_wp/wp_install/files/mu-plugins.txt"; $usefiles['plugins_check'] = "/opt/eig_wp/wp_install/files/plugins.txt"; $usefiles['mustuse_tar'] = "/opt/eig_wp/wp_install/files/mu-plugins.tar.gz"; $usefiles['plugins_tar'] = "/opt/eig_wp/wp_install/files/plugins.tar.gz"; $usefiles['wp_tar'] = "/opt/eig_wp/wp_install/files/latest.tar.gz"; if ( posix_getuid() < 500 ) { die("[ERROR]\tUID < 500\n\n"); } $pwu_data = posix_getpwuid(posix_geteuid()); $posix_username = $pwu_data['name']; $homedir = "/home/" . $posix_username; if ( getenv("HOME") ) { $homedir = getenv("HOME"); } $install_path = $homedir . "/public_html/"; if ( !empty($install_options['install_path']) ) { $install_path = $install_options['install_path']; } if ( file_exists("$install_path/wp-config.php") ) { die("WP was is already installed ($install_path/wp-config.php)\n"); } if ( ! is_dir("$install_path") ) { //die("No dir.. something is wrong. ($install_path)\n"); mkdir("$install_path"); } foreach ($usefiles as $key => $value) { if ( file_exists($value) ) { echo "[OK]\tFile: $value exists\n"; } else { echo "[ERROR]\tFile: $value is missing\n"; exit; } } system("tar xf " . $usefiles['wp_tar'] . " --strip-components=1 -C $install_path"); system("tar xf " . $usefiles['plugins_tar'] . " -C $install_path/wp-content/"); system("tar xf " . $usefiles['mustuse_tar'] . " -C $install_path/wp-content/"); # Spot check if ( ! is_dir("$install_path/wp-content/") ) { die("wp-content dir missing\n"); } chdir("$install_path"); create_wpconf ( $install_options['db_name'], $install_options['db_user'], $install_options['db_password'], $install_options['table_prefix'] ); define( 'WP_INSTALLING', true ); include("wp-config.php"); require_once( 'wp-load.php' ); require_once( 'wp-admin/includes/upgrade.php' ); require_once( 'wp-includes/wp-db.php' ); // blog title, username, user_email, public (bool), deprecated_value, user_pass, lang wp_install( $install_options['blog_title'], $install_options['user_name'], $install_options['admin_email'], '1', ''); // Turn off default password nag -- Maybe we should have it look up // username instead of assuming its ID 1 update_user_option( 1, 'default_password_nag', false, true ); if ( ! $install_options['site_url'] ) { list($host) = explode('.', gethostname() ); $url = "http://" . $host . ".temp.domains/~" . $posix_username; } else { $url = $install_options['site_url']; } update_option_audit( 'siteurl', $url ); update_option_audit( 'home', $url ); update_option_audit( 'close_comments_for_old_posts' , '1'); update_option_audit( 'close_comments_days_old', '28'); update_option_audit( 'comments_per_page', '20'); update_option_audit( 'mm_install_date', date('Y-m-d') ); update_option_audit( 'mm_coming_soon', 'true'); update_option_audit( 'mm_brand', $install_options['brand'] ); update_option_audit( 'host_id', $install_options['host_id'] ); //update_option_audit( '_mm_refresh_token', $install_options['token'] ); update_option_audit( "permalink_structure", '/%postname%/' ); mu_plugin_check($usefiles['mustuse_check']); activate_plugin_list($usefiles['plugins_check']); update_option_audit( "enduance_page_cache", '2' ); $GLOBALS['wp_rewrite'] = new WP_Rewrite(); $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() ); insert_with_markers( ".htaccess", 'WordPress', $rules ); //wp_function_check(function() {insert_with_markers( ".htaccess", 'WordPress', $rules )}); //wp_function_check( function() { return insert_with_markers( ".htaccess", 'WordPress', $rules ); } ); $total_end = microtime(true); $time = round(($total_end - $total_start),5); //echo "Total install time ($time) seconds\n"; echo " ****************************** ****************************** ****************************** ****************************** WP Blog installed at $url/ Total install time ($time) seconds ****************************** ****************************** ****************************** ****************************** "; ?>