diff --git a/oldstuff/.gitignore b/oldstuff/.gitignore deleted file mode 100644 index 1a3c9782..00000000 --- a/oldstuff/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -info.php -config.php -latest.zip diff --git a/oldstuff/eesite b/oldstuff/eesite deleted file mode 100644 index d9441073..00000000 --- a/oldstuff/eesite +++ /dev/null @@ -1,640 +0,0 @@ -# Easy Engine Site Settings -elif [ "$1" = "site" ] -then - - # Easy Engine Read - if [ "$2" = "read" ] - then - - if [ "$3" = "available" ] - then - - # Display The List Of Available Sites - echo -e "\033[34m List Of Available Websites \e[0m" - ls /etc/nginx/sites-available/ \ - || OwnError "Unable To Display The List Of Available Websites" - - elif [ "$3" = "enabled" ] - then - - # Display The List Of Enabled Sites - echo -e "\033[34m List Of Enabled Websites \e[0m" - ls /etc/nginx/sites-enabled/ \ - || OwnError "Unable To Display The List Of Enabled Websites" - - elif [ "$3" != "all" ] && [ "$3" != "active" ] && [ -n "$3" ] - then - - # Check The Website Is Exist - ls /etc/nginx/sites-available/$3 &> /dev/null \ - || OwnError "The $3 Is Not Found In Available Websites List" - if [ $? -eq 0 ] - then - - # Display The Specific Site Configuration - echo -e "\033[34m Display The $3 Configuration Settings \e[0m" - cat /etc/nginx/sites-available/$3 \ - || OwnError "Unable To Display The $3 Configuration Settings" - fi - - else - EngineHelp - - fi - - - # Easy Engine Create - elif [ "$2" = "create" ] - then - - if [ -n "$3" ] - then - - # Remove http:// https:// & www. - DOMAIN=$(echo $3 | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'www.''") - - # Creating Site - echo -e "\033[34m Creating $DOMAIN, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/singlesite/basic.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Create Configuration File For $DOMAIN" - - # Creating Symbolic Link - echo -e "\033[34m Creating Symbolic Link \e[0m" - ln -s /etc/nginx/sites-available/$DOMAIN /etc/nginx/sites-enabled/ \ - || OwnError "Unable To Create Symbolic Link For $DOMAIN" - - # Take Nginx Configuration In Git Version Control - EEGITDIR=/etc/nginx - EEGITMESSAGE="Created New Website $DOMAIN" - EEGITCOMMIT - - # Creating Htdocs & Logs Directory - echo -e "\033[34m Creating htdocs & logs Directory \e[0m" - (mkdir -p /var/www/$DOMAIN/htdocs; mkdir -p /var/www/$DOMAIN/logs) \ - || OwnError "Unable To Create htdocs & logs Directory" - - # Creating Symbolic Links For Logs - echo -e "\033[34m Creating Symbolic Link For Logs \e[0m" - ln -s /var/log/nginx/$DOMAIN.access.log /var/www/$DOMAIN/logs/access.log \ - && ln -s /var/log/nginx/$DOMAIN.error.log /var/www/$DOMAIN/logs/error.log \ - || OwnError "Unable To Create Symbolic Link For $DOMAIN Logs" - - - if [ "$4" = "--with-wordpress" ] - then - - # Download Latest Wordpress - echo -e "\033[34m Downloading WordPress \e[0m" - wget -cO /var/www/$DOMAIN/htdocs/latest.tar.gz \ - http://wordpress.org/latest.tar.gz - - # Extracting Wordpress - tar --strip-components=1 -zxf /var/www/$DOMAIN/htdocs/latest.tar.gz \ - -C /var/www/$DOMAIN/htdocs/ - - # Removing Wordpress Archive - rm /var/www/$DOMAIN/htdocs/latest.tar.gz - - # Call MYSQLINFO Function For MySQL Values - MYSQLINFO - - # Modify wp-config.php & Move Outside The Webroot - cp -v /var/www/$DOMAIN/htdocs/wp-config-sample.php \ - /var/www/$DOMAIN/wp-config.php - - sed -i "s/database_name_here/$WPDBNAME/" \ - /var/www/$DOMAIN/wp-config.php - - sed -i "s/username_here/$MYSQLUSER/" \ - /var/www/$DOMAIN/wp-config.php - - sed -i "s/password_here/$MYSQLPASS/" \ - /var/www/$DOMAIN/wp-config.php - - sed -i "s/localhost/$MYSQLHOST/" \ - /var/www/$DOMAIN/wp-config.php - - sed -i "s/wp_/$WPDBPREFIX/" \ - /var/www/$DOMAIN/wp-config.php - - printf '%s\n' "g/put your unique phrase here/d" \ - a "$(curl -L https://api.wordpress.org/secret-key/1.1/salt/)" . w \ - | ed -s /var/www/$DOMAIN/wp-config.php - - fi - - # Call NGINXUSERINFO Function For NGINX User Details - NGINXUSERINFO - - # Change Ownership - echo -e "\033[34m Changing Ownership \e[0m" - #echo $NGINXUSER $DOMAIN - chown -R $NGINXUSER:$NGINXUSER /var/www/$DOMAIN/ - - # Reload Nginx Configuration - NGINXRELOAD - - # Start PHP-FPM If Not Running - PHPSTART - - # Display Success Message - echo -e "\033[34m http://$DOMAIN Domain Successfully Created \e[0m" - - else - EngineHelp - fi - - - # Easy Engine Update - elif [ "$2" = "update" ] - then - - if [ -n "$3" ] - then - - # Remove http:// https:// & www. - DOMAIN=$(echo $3 | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'www.''") - - # Make Backup Directory For Storing Older Nginx Configurations - if [ ! -d /etc/nginx/sites-available/backups/ ] - then - mkdir -p /etc/nginx/sites-available/backups/ - fi - - if [ "$4" = "singlesite" ] - then - - if [ "$5" = "w3total" ] - then - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For W3TotalCache, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/singlesite/w3-total-cache.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Installing W3 Total Cache - cd /var/www/$DOMAIN/htdocs/ - wp plugin install w3-total-cache || OwnError "Unable To Install W3 Total Cache Plugin" - - # Activate W3 Total Cache - wp plugin activate w3-total-cache || OwnError "Unable To Activate W3 Total Cache Plugin" - - # Call NGINXUSERINFO Function For NGINX User Details - NGINXUSERINFO - - # Give Ownership To $NGINXUSER - chown -R $NGINXUSER:$NGINXUSER /var/www/$DOMAIN/ - - # Display W3 Total Cache URL For Settings - echo -e "\033[34m Please Configure W3 Total Cache Settings \e[0m" - echo -e "\033[34m W3 Total Cache: http://$DOMAIN/wp-admin/admin.php?page=w3tc_general \e[0m" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - elif [ "$5" = "wpsuper" ] - then - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For WPSuperCache, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/singlesite/wp-super-cache.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Installing WP Super Cache - cd /var/www/$DOMAIN/htdocs/ - wp plugin install wp-super-cache || OwnError "Unable To Install WP Super Cache Plugin" - - # Activate WP Super Cache - wp plugin activate wp-super-cache || OwnError "Unable To Activate WP Super Cache Plugin" - - # Call NGINXUSERINFO Function For NGINX User Details - NGINXUSERINFO - - # Give Ownership To $NGINXUSER - chown -R $NGINXUSER:$NGINXUSER /var/www/$DOMAIN/ - - # Display W3 Total Cache URL For Settings - echo -e "\033[34m Please Configure WP Super Cache Settings \e[0m" - echo -ne "\033[34m WP Super Cache:\e[0m" - echo -e "\033[34m http://$DOMAIN/wp-admin/options-general.php?page=wpsupercache \e[0m" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - elif [ "$5" = "fastcgi" ] - then - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For Fastcgi Cache, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/singlesite/fastcgi-cache.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Installing Nginx Helper - cd /var/www/$DOMAIN/htdocs/ - wp plugin install nginx-helper || OwnError "Unable To Install Nginx Helper" - - # Activate Nginx Helper - wp plugin activate nginx-helper || OwnError "Unable To Activate Nginx Helper Plugin" - - # Call NGINXUSERINFO Function For NGINX User Details - NGINXUSERINFO - - # Give Ownership To $NGINXUSER - chown -R $NGINXUSER:$NGINXUSER /var/www/$DOMAIN/ - - # Display W3 Total Cache URL For Settings - echo -e "\033[34m Please Configure Nginx Helper Settings \e[0m" - echo -e "\033[34m Nginx Helper: http://$DOMAIN/wp-admin/options-general.php?page=nginx \e[0m" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - else - EngineHelp - fi - - - elif [ "$4" = "multisite" ] - then - - # Presetup For WordPress MU - sed -i "/WP_DEBUG/a \define('WP_ALLOW_MULTISITE', true);" /var/www/$DOMAIN/wp-config.php - sed -i "/WP_ALLOW_MULTISITE/a \define('WPMU_ACCEL_REDIRECT', true);" /var/www/$DOMAIN/wp-config.php - - if [ "$5" = "subdomain" ] - then - - # Configure Network Setup - echo -e "\033[34m Please Open Following URL & Click On Sub-Domains & Install \e[0m" - echo -e "\033[34m Configure Network Setup: http://$DOMAIN/wp-admin/network.php \e[0m" - echo -e "\033[34m Press Enter, Once You Setup Network: \e[0m" - read - - # Add Rules In wp-config.php gile - sed -i "/WPMU_ACCEL_REDIRECT/a \define('MULTISITE', true);\n\ - define('SUBDOMAIN_INSTALL', true);\n\ - \$base = '/';\n\ - define('DOMAIN_CURRENT_SITE', '$DOMAIN');\n\ - define('PATH_CURRENT_SITE', '/');\n\ - define('SITE_ID_CURRENT_SITE', 1);\n\ - define('BLOG_ID_CURRENT_SITE', 1);\n" /var/www/$DOMAIN/wp-config.php - - # Make Blogs.Dir - mkdir /var/www/$DOMAIN/htdocs/wp-content/blogs.dir - - # Call NGINXUSERINFO Function For NGINX User Details - NGINXUSERINFO - - # Give Ownership To NGINXUSER - chown -R $NGINXUSER:$NGINXUSER /var/www/$DOMAIN/htdocs/wp-content/blogs.dir - - if [ "$6" = "basic" ] - then - - # Installing Nginx Helper - cd /var/www/$DOMAIN/htdocs/ - wp plugin install nginx-helper || OwnError "Unable To Install Nginx Helper" - - # Activate Nginx Helper - wp plugin activate nginx-helper || OwnError "Unable To Activate Nginx Helper Plugin" - - # Call NGINXUSERINFO Function For NGINX User Details - NGINXUSERINFO - - # Give Ownership To $NGINXUSER - chown -R $NGINXUSER:$NGINXUSER /var/www/$DOMAIN/ - - # Display W3 Total Cache URL For Settings - echo -e "\033[34m Please Configure Nginx Helper Settings \e[0m" - echo -e "\033[34m Please Open Following URL & Click Enable Map \e[0m" - echo -ne "\033[34m Nginx Helper:\e[0m" - echo -e "\033[34m http://$DOMAIN/wp-admin/options-general.php?page=nginx \e[0m" - echo -e "\033[34m Press Enter, Once You Setup Nginx Helper Plugin: \e[0m" - read - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For Basic WPMU, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/multisite/subdomain/basic.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - - elif [ "$6" = "w3total" ] - then - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For W3TotalCache, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/multisite/subdomain/w3-total-cache.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - - elif [ "$6" = "wpsuper" ] - then - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For WPSuperCache, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/multisite/subdomain/wp-super-cache.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - - elif [ "$6" = "fastcgi" ] - then - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For Fastcgi Cache, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/multisite/subdomain/fastcgi-cache.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - else - EngineHelp - fi - - - elif [ "$5" = "subdirectory" ] - then - # Configure Network Setup - echo -e "\033[34m Please Open Following URL & Click On Sub-Directories & Install \e[0m" - echo -e "\033[34m Configure Network Setup: http://$DOMAIN/wp-admin/network.php \e[0m" - echo -e "\033[34m Press Enter, Once You Setup Network: \e[0m" - read - - # Add Rules In wp-config.php gile - sed -i "/WPMU_ACCEL_REDIRECT/a \define('MULTISITE', true);\n\ - define('SUBDOMAIN_INSTALL', false);\n\ - \$base = '/';\n\ - define('DOMAIN_CURRENT_SITE', '$DOMAIN');\n\ - define('PATH_CURRENT_SITE', '/');\n\ - define('SITE_ID_CURRENT_SITE', 1);\n\ - define('BLOG_ID_CURRENT_SITE', 1);\n" /var/www/$DOMAIN/wp-config.php - - # Make Blogs.Dir - mkdir /var/www/$DOMAIN/htdocs/wp-content/blogs.dir - - # Call NGINXUSERINFO Function For NGINX User Details - NGINXUSERINFO - - # Give Ownership To NGINXUSER - chown -R $NGINXUSER:$NGINXUSER /var/www/$DOMAIN/htdocs/wp-content/blogs.dir - - if [ "$6" = "basic" ] - then - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For Basic WPMU, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/multisite/subdir/basic.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - - elif [ "$6" = "w3total" ] - then - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For W3TotalCache, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/multisite/subdir/w3-total-cache.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - - elif [ "$6" = "wpsuper" ] - then - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For WPSuperCache, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/multisite/subdir/wp-super-cache.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - - elif [ "$6" = "fastcgi" ] - then - - # Taking Backup - mv /etc/nginx/sites-available/$DOMAIN \ - /etc/nginx/sites-available/backups/$DOMAIN.$(date +%d%m%Y.%H%M%S) - - # Updating Site - echo -e "\033[34m Updating $DOMAIN For Fastcgi Cache, Please Wait... \e[0m" - sed "s/example.com/$DOMAIN/g" \ - /usr/share/easyengine/nginx/multisite/subdir/fastcgi-cache.conf \ - > /etc/nginx/sites-available/$DOMAIN \ - || OwnError "Unable To Update Configuration File For $DOMAIN" - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m Nginx Configuration For $DOMAIN Is Successfully Updated \e[0m" - - else - EngineHelp - fi - - else - EngineHelp - fi - - else - EngineHelp - fi - - - else - EngineHelp - fi - - - # Easy Engine Delete - elif [ "$2" = "delete" ] - then - - if [ -n "$3" ] - then - - # Remove http:// & www. - DOMAIN=$(echo $3 | sed "s'http://''" | sed "s'www.''") - - # Delete Site - echo -e "\033[34m Deleting $DOMAIN, Please Wait... \e[0m" - rm /etc/nginx/sites-available/$DOMAIN /etc/nginx/sites-enabled/$DOMAIN - - # Remove Symbolic Links For Logs Files - echo -e "\033[34m Remove Symbolic Link For $DOMAIN Logs... \e[0m" - rm /var/www/$DOMAIN/logs/{access,error}.log - - if [ "$4" = "--database" ] - then - - # Get The Database Details - MYSQLUSER=$(grep DB_USER /var/www/$DOMAIN/wp-config.php \ - | cut -d"'" -f4) - - MYSQLPASS=$(grep DB_PASSWORD /var/www/$DOMAIN/wp-config.php \ - | cut -d"'" -f4) - - WPDBNAME=$(grep DB_NAME /var/www/$DOMAIN/wp-config.php \ - | cut -d"'" -f4) - - # Remove Database - echo -e "\033[34m Removing Database $WPDBNAME... \e[0m" - mysql -u $MYSQLUSER -p$MYSQLPASS -e "drop database \`$WPDBNAME\`" \ - || OwnError "Unable To Drop $WPDBNAME Database" - - elif [ "$4" = "--webroot" ] - then - - # Remove Webroot For $DOMAIN - echo -e "\033[34m Removing /var/www/$DOMAIN Directory... \e[0m" - rm -rf /var/www/$DOMAIN/ - - elif [ "$4" = "--all" ] - then - - # Get The Database Details - MYSQLUSER=$(grep DB_USER /var/www/$DOMAIN/wp-config.php \ - | cut -d"'" -f4) - - MYSQLPASS=$(grep DB_PASSWORD /var/www/$DOMAIN/wp-config.php \ - | cut -d"'" -f4) - - WPDBNAME=$(grep DB_NAME /var/www/$DOMAIN/wp-config.php \ - | cut -d"'" -f4) - - # Remove Database - echo -e "\033[34m Removing Database $WPDBNAME... \e[0m" - mysql -u $MYSQLUSER -p$MYSQLPASS -e "drop database \`$WPDBNAME\`" \ - || OwnError "Unable To Drop $WPDBNAME Database" - - # Remove Webroot For $DOMAIN - echo -e "\033[34m Removing /var/www/$DOMAIN Directory... \e[0m" - rm -rf /var/www/$DOMAIN - - else - EngineHelp - - fi - - # Reload Nginx Configuration - NGINXRELOAD - - # Display Success Message - echo -e "\033[34m http://$DOMAIN Successfully Deleted \e[0m" - - else - EngineHelp - fi - - - # Easy Engine Help - else - EngineHelp - fi diff --git a/oldstuff/php/config-sample.php b/oldstuff/php/config-sample.php deleted file mode 100755 index a2582b92..00000000 --- a/oldstuff/php/config-sample.php +++ /dev/null @@ -1,39 +0,0 @@ - diff --git a/oldstuff/php/create.php b/oldstuff/php/create.php deleted file mode 100755 index 42fccd25..00000000 --- a/oldstuff/php/create.php +++ /dev/null @@ -1,158 +0,0 @@ - /dev/null"; -$result = system($command); - -//Error check -if ($result != '') { - die("\nError encountered while extracting latest wordpress in directory " . $domain['rootdir'] . "\n"); -} - -$command = "mv " . $domain['htdocs'] . "/wordpress/* " . $domain['htdocs'] . "/"; -echo "\n COMMAND :: $command \n"; -$result = system($command); - -//Error check -if ($result != '') { - die("\nError encountered while moving latest wordpress in directory " . $domain['rootdir'] . "\n" . $result); -} - -/** - * MySQL Creation - */ - -$command = "mysql -h " . $local_env['mysql_host'] . " -u " . $local_env['mysql_user'] . " -p" . $local_env['mysql_pass'] . " -e 'create database `'" . $domain['name'] . "'` '"; -$result = system($command); - -/* - * Create wp-config.php - */ -$wp_config_sample = $domain['htdocs'] . "/wp-config-sample.php"; - -$command = "sed s/database_name_here/{$domain['name']}/ $wp_config_sample | sed s/username_here/{$local_env['mysql_user']}/ | sed s/password_here/{$local_env['mysql_pass']}/ > {$domain['htdocs']}/wp-config.php"; - -$result = system($command); - -/** - * Chown - */ -$command = "chown -R " . $local_env['nginx_user'] . ":" . $local_env['nginx_group'] . " " . $domain['rootdir']; -echo "\n COMMAND :: $command \n"; -$result = system($command); - -//Error check -if ($result != '') { - die("\nError encountered while charging owner of " . $domain['rootdir'] . "\n" . $result); -} - - -/** - * ALL SEENS WELL - Restart nginx - */ -echo "\n Relaoding nginx configuration...\n\n"; -system('service nginx reload'); - -/** - * THE END - */ -//just echo URL for new domain like http://$domain -//user will click it and verify if its working fine! ;-) - -echo $domain['name'] . " Successfully created\n\n"; - -?> diff --git a/oldstuff/php/example.com b/oldstuff/php/example.com deleted file mode 100755 index 92244579..00000000 --- a/oldstuff/php/example.com +++ /dev/null @@ -1,22 +0,0 @@ -server{ - server_name www.example.com example.com; - - access_log /var/log/nginx/example.com.access.log ; - error_log /var/log/nginx/example.com.error.log; - - root /var/www/example.com/htdocs; - index index.php index.html index.htm; - - ## PHP with FATSCGI - location ~ \.php$ { - include /etc/nginx/fastcgi_params; - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - } - - #root dir - location / { - autoindex on; - try_files $uri $uri/ /index.php; - } -} diff --git a/oldstuff/php/init.php b/oldstuff/php/init.php deleted file mode 100755 index 28346bde..00000000 --- a/oldstuff/php/init.php +++ /dev/null @@ -1,54 +0,0 @@ - diff --git a/oldstuff/php/move.php b/oldstuff/php/move.php deleted file mode 100755 index 78590706..00000000 --- a/oldstuff/php/move.php +++ /dev/null @@ -1,156 +0,0 @@ - $domain - */ -function move_domain($usr_domain) { - global $local_env, $remote_env; - - if(trim($usr_domain) == ''){ - echo "\n CURRENT DOMAIN IS SKIPPED\n"; - return; - } - - /* - * Set domain environment values - */ - $domain['name'] = $usr_domain; - $domain['conf'] = $local_env['nginx_dir_sites_avilable'] . '/' . $domain['name']; - $domain['rootdir'] = $local_env['webroot'] . '/' . $domain['name']; - $domain['htdocs'] = $domain['rootdir'] . '/' . $local_env['htdocs'] ; - $domain['logs'] = $domain['rootdir'] . '/' . $local_env['logs'] ; - - /** - * Check if domain config file already exists - */ - if (file_exists($domain['conf'])) { - echo "\nConfiguration files for domain '" . $domain['name'] . "'already exists :: " . $domain['conf']; - echo "\nDo you want to overwrite previous configuration? [Y/N] (default=Y)"; - - if (in_array(strtolower(fgets(STDIN)), array('n', 'no'))) { - die("\nYou choose to terminate this script! Bye-Bye!!! \n"); - } - } - - /** - * At this point - either domain config file doesn't exist or user showed interest in overwriting it - * In either case... - * Create nginx conf for $domain in /etc/nginx/sites-available/$domain - * TODO :: Provide options to add supercache and/or w3total cache rules - */ - /** - * Create config file - */ - $nginx_conf = file_get_contents($local_env['default_conf']); - $nginx_conf = str_replace($local_env['default_domain'], $domain['name'], $nginx_conf); - file_put_contents($domain['conf'], $nginx_conf); - -//Error Check - if config file is created successfully or not - if (!file_exists($domain['conf'])) { - die("\nError encounterd while creating " . $domain['conf']); - } - - /** - * Linking config file - */ - echo "\nCreating Symbolic Link..\n"; - $command = "sudo ln -s " . $domain['conf'] . " " . $local_env['nginx_dir_sites_enabled']; - $result = system($command); - -//Error check - if linking config file succeed - if ($result != '') { - die("\nError encountered while creating script. Please check if file '" . $domain['conf'] . "'is created or not!\n"); - } - -//Go Ahead. -// echo "Nginx configuration for '" . $domain['name'] . "' is created successfully"; - - /** - * Create webroot dirs for new domain - */ -//create dirs - $result = system("mkdir " . $domain['rootdir']); - $result = system("mkdir " . $domain['htdocs']); - $result = system("mkdir " . $domain['logs']); - -//create log files - $result = system("touch " . $domain['logs'] . "/access.log"); - $result = system("touch " . $domain['logs'] . "/error.log"); - -//Error check - if ($result != '') { - die("\nError encountered while creating websites directories & files for " . $domain['name'] . "\n"); - } - - /** - * moving wordpress in new webroot dir - */ -//export remote db - $command = "rsync --exclude '*.iso' -avz {$remote_env['ssh_user']}@{$remote_env['host']}:{$remote_env['webroot']}/{$domain['name']}/htdocs/* {$domain['htdocs']}/"; - $result = system($command); - - - /** - * MySQL Moving - */ - $wp_config = get_defines($domain['htdocs'] . '/wp-config.php'); - - $command = "mysqldump -u {$wp_config['DB_USER']} -p{$wp_config['DB_PASSWORD']} -h {$remote_env['host']} --databases '{$wp_config['DB_NAME']}' > {$domain['rootdir']}/{$domain['name']}.sql"; -// echo "\n" . $command . "\n"; - $result = system($command); - - $command = "mysql -h {$local_env['mysql_host']} -u {$local_env['mysql_user']} -p{$local_env['mysql_pass']} < {$domain['rootdir']}/{$domain['name']}.sql"; -// echo "\n\n" . $command . "\n"; - $result = system($command); - - /* - * Create wp-config.php - */ - //this may not be needed as we already have wp-config.php present for remote WordPress - //@TODO we need to replace DB_HOST though - - - /** - * Chown - */ - $command = "chown -R " . $local_env['nginx_user'] . ":" . $local_env['nginx_group'] . " " . $domain['rootdir']; - echo "\n COMMAND :: $command \n"; - $result = system($command); - -//Error check - if ($result != '') { - die("\nError encountered while chaging owner of " . $domain['rootdir'] . "\n" . $result); - } -} -?> \ No newline at end of file diff --git a/oldstuff/php/remove.php b/oldstuff/php/remove.php deleted file mode 100755 index 25c64788..00000000 --- a/oldstuff/php/remove.php +++ /dev/null @@ -1,107 +0,0 @@ - \ No newline at end of file diff --git a/oldstuff/php/test.php b/oldstuff/php/test.php deleted file mode 100755 index a83076cf..00000000 --- a/oldstuff/php/test.php +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/oldstuff/php/touch.php b/oldstuff/php/touch.php deleted file mode 100755 index 2e15746f..00000000 --- a/oldstuff/php/touch.php +++ /dev/null @@ -1,123 +0,0 @@ - diff --git a/oldstuff/zzz/make_site.sh b/oldstuff/zzz/make_site.sh deleted file mode 100755 index 5b920803..00000000 --- a/oldstuff/zzz/make_site.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -#This script makes virtual host, site directories and log files -#Author : Pragati Sureka - -if [[ $(/usr/bin/id -u) -ne 0 ]]; then - echo "make_vsite:You need to run this script as root(or use sudo)" - exit -fi - -# Check for proper number of command line args. -if [ $# -ne 1 ] -then - echo "Usage: `basename $0` example.com" - echo " " - exit -fi - -sed s/[[:blank:]]*//g $1 > $1 - -#Script Variables -WEBROOT="/var/www" -SKELFILE="/etc/nginx/sites-available/example.com" -VSITEDIR="/etc/nginx/sites-available" -ESITEDIR="/etc/nginx/sites-enabled" -USER="www-data" -GROUP="www-data" -SERVER_RELOAD="service nginx restart" -WP_ZIP="/home/rtcamp/wordpress/latest.zip" #wordpress 3.0 - -#make directories and touch log files -mkdir $WEBROOT/$1 -mkdir $WEBROOT/$1/htdocs -mkdir $WEBROOT/$1/logs -touch $WEBROOT/$1/logs/error.log -touch $WEBROOT/$1/logs/access.log - -#download latest wordpress and extract it to proper location -cd $WEBROOT/$1 -#wget www.wordpress.org/latest.zip -unzip -q -o $WP_ZIP -mv wordpress/* htdocs/ -rm -rf $WEBROOT/$1/wordpress -#rm $WEBROOT/$1/latest.zip -chown -R $USER:$GROUP $WEBROOT/$1 -#chmod g+rw -R $WEBROOT/$1 - -#create database -mysql -u USER -pPASS -e 'create database `'$1'` ' - -#create wp-config.php file -CONFIGSAMPLE=$WEBROOT/$1/htdocs/wp-config-sample.php -sed s/database_name_here/$1/ $CONFIGSAMPLE | sed s/username_here/USER/ | sed s/password_here/PASS/ > $WEBROOT/$1/htdocs/wp-config.php - -#copy skeleton file and enable site -sed s/example.com/$1/ $SKELFILE > $VSITEDIR/$1 -ln -s $VSITEDIR/$1 $ESITEDIR/ -echo "127.0.0.1 $1" >> /etc/hosts -$SERVER_RELOAD -if [ $? -ne 0 ]; then - #rm -rf $WEBROOT/$1 - unlink $ESITEDIR/$1 - $SERVER_RELOAD - sed -i".bak" '$d' /etc/hosts - echo "ERROR CREATING PLEASE CONTACT pragati.sureka@rtcamp.com FOR ASSISTANCE!" -fi \ No newline at end of file diff --git a/oldstuff/zzz/make_vhost.sh b/oldstuff/zzz/make_vhost.sh deleted file mode 100755 index e16eb614..00000000 --- a/oldstuff/zzz/make_vhost.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -#This script makes virtual host, site directories and log files -#Author : Pragati Sureka, rahul286 - -if [[ $(/usr/bin/id -u) -ne 0 ]]; then - echo "make_vsite:You need to this script as root(or use sudo)" - exit -fi - -#Script Variables -WEBROOT="/var/www" -SKELFILE="/etc/apache2/sites-available/skeleton" -VSITEDIR="/etc/apache2/sites-available" -USER="www-data" -GROUP="www-data" -SERVER_RELOAD="/etc/init.d/apache2 reload" - -#make directories and touch log files -mkdir $WEBROOT/$1 -mkdir $WEBROOT/$1/htdocs -mkdir $WEBROOT/$1/logs -touch $WEBROOT/$1/logs/error.log -touch $WEBROOT/$1/logs/custom.log - -#copy skeleton file and enable site -sed s/site/$1/ $SKELFILE > $VSITEDIR/$1 -a2ensite $1 &> /dev/null -echo "127.0.0.1 $1" >> /etc/hosts -$SERVER_RELOAD &> /dev/null -if [ $? -ne 0 ]; then - rm -rf $WEBROOT/$1 - a2dissite $1 - sed -i".bak" '$d' /etc/hosts - echo "ERROR CREATING PLEASE CONTACT pragati.sureka@rtcamp.com FOR ASSISTANCE!" -fi diff --git a/oldstuff/zzz/restart.sh b/oldstuff/zzz/restart.sh deleted file mode 100755 index ade0275a..00000000 --- a/oldstuff/zzz/restart.sh +++ /dev/null @@ -1,3 +0,0 @@ -service mysql stop -service php5-fpm restart -service mysql start