├── README.md └── wp-remote-install.php /README.md: -------------------------------------------------------------------------------- 1 | WordPress Remote Installer 2 | ========================== 3 | 4 | Installing WordPress is relatively easy. Their developers have done alot of work and spent alot of time making the actual installation as easy as possible, but problems persist, specifically getting WordPress onto the actual server to run that installation. 5 | 6 | Some webhosts offer services allowing for WordPress to be automatically installed into a site, but these installs often contain bloatware in the form of extensions or themes which, frankly, are useless. 7 | 8 | ## The Old Way 9 | Previously, the only way to install WordPress onto webhosts who do not offer automated installs (or onto webhosts who do, but where you want to avoid that bloatware) was by: 10 | 11 | 1. Going to the WordPress website 12 | 2. Downloading the latest version of WordPress 13 | 3. Extracting WordPress on your computer 14 | 4. Connecting to the Server with an FTP client 15 | 5. Uploading the numerous WordPress files 16 | 17 | ## The New Way 18 | The WordPress Remote Installer aims to eliminate almost all of these steps, instead, installing WordPress would be as simple as: 19 | 20 | 1. Upload **wp-remote-install.php** 21 | 2. (Optional) Upload **wp-remote-plugins.txt** and/or **wp-remote-themes.txt** 22 | 3. Go to **http://yourserver.com/wp-remote-install.php** 23 | 24 | The script then performs all the following for you: 25 | 26 | 1. Downloads the latest version of WordPress 27 | 2. Extracts it onto your server 28 | 3. (Optionally) Downloads and extracts your listed Plugins and/or Themes into the new install of WordPress 29 | 4. Deletes itself 30 | 5. Redirects you to the WordPress Installer 31 | 32 | The bonus being that all of the downloading of WordPress, its Plugins and Themes happen between your server and the WordPress servers - through links far faster than the connection to your home. 33 | 34 | ## Requirements 35 | In order for this script to work, your webserver must: 36 | 37 | - Be empty 38 | - Have **allow\_url\_fopen** enabled 39 | 40 | (Pretty simple requirements, really. Most webservers will satisfy these needs.) 41 | 42 | ## Installation 43 | Pretty straight-forward, really... 44 | 45 | 1. Connect to your webserver via FTP 46 | 2. Upload **wp-remote-install.php** 47 | 3. Go to **http://yourserver.com/wp-remote-install.php** 48 | 4. Complete the WordPress Install 49 | 5. Have a beer. -------------------------------------------------------------------------------- /wp-remote-install.php: -------------------------------------------------------------------------------- 1 | 'https://' . GITHUB_USERNAME . '.github.io/' . GITHUB_PROJECT .'/list-plugin.txt' , 19 | 20 | # Can be an Array of URLs for each Theme, or a string URL for a text file with URLs for each Theme on a new line 21 | 'themes' => 'https://' . GITHUB_USERNAME . '.github.io/' . GITHUB_PROJECT .'/list-theme.txt' 22 | 23 | ); 24 | 25 | // Delete Directory and Contents 26 | function deleteAll( $dir ){ 27 | $directory_contents = scandir( $dir ); 28 | foreach( array_diff( array( '.' , '..' ) , scandir( $dir ) ) as $k => $item ){ 29 | if( is_dir( $item ) ){ 30 | deleteAll( $item ); 31 | }else{ 32 | unlink( $item ); 33 | } 34 | } 35 | rmdir( $dir ); 36 | } 37 | 38 | // Function for Extraction 39 | function extractSubFolder( $zipFile , $target = null , $subFolder = null ){ 40 | if( is_null( $target ) ) 41 | $target = dirname( __FILE__ ); 42 | $zip = new ZipArchive; 43 | $res = $zip->open( $zipFile ); 44 | if( $res === TRUE ){ 45 | if( is_null( $subFolder ) ){ 46 | $zip->extractTo( $target ); 47 | }else{ 48 | for( $i = 0 , $c = $zip->numFiles ; $i < $c ; $i++ ){ 49 | $entry = $zip->getNameIndex( $i ); 50 | //Use strpos() to check if the entry name contains the directory we want to extract 51 | if( $entry!=$subFolder.'/' && strpos( $entry , $subFolder.'/' )===0 ){ 52 | $stripped = substr( $entry , 9 ); 53 | if( substr( $entry , -1 )=='/' ){ 54 | // Subdirectory 55 | $subdir = $target.'/'.substr( $stripped , 0 , -1 ); 56 | if( !is_dir( $subdir ) ) 57 | mkdir( $subdir ); 58 | }else{ 59 | $stream = $zip->getStream( $entry ); 60 | $write = fopen( $target.'/'.$stripped , 'w' ); 61 | while( $data = fread( $stream , 1024 ) ){ 62 | fwrite( $write , $data ); 63 | } 64 | fclose( $write ); 65 | fclose( $stream ); 66 | } 67 | } 68 | } 69 | } 70 | $zip->close(); 71 | return true; 72 | } 73 | die( 'Unable to open '.$zipFile ); 74 | return false; 75 | } 76 | 77 | // Function to Cleanse Webroot 78 | function rrmdir( $dir ){ 79 | if( is_dir( $dir ) ){ 80 | $objects = scandir( $dir ); 81 | foreach( $objects as $object ){ 82 | if( $object!='.' && $object!='..' ){ 83 | if( filetype( $dir.'/'.$object )=='dir' ) 84 | rrmdir( $dir.'/'.$object ); 85 | else 86 | unlink( $dir.'/'.$object ); 87 | } 88 | } 89 | reset( $objects ); 90 | rmdir( $dir ); 91 | }else{ 92 | unlink( $dir ); 93 | } 94 | } 95 | function cleanseFolder( $exceptFiles = null ){ 96 | if( $exceptFiles == null ) 97 | $exceptFiles[] = basename( __FILE__ ); 98 | $contents = glob('*'); 99 | foreach( $contents as $c ){ 100 | if( !in_array( $c , $exceptFiles ) ) 101 | rrmdir( $c ); 102 | } 103 | } 104 | function downloadFromURL( $url = null , $local = null ){ 105 | $result = null; 106 | if( is_null( $local ) ) 107 | $local = basename( $url ); 108 | if( $content = @file_get_contents( $url ) ){ 109 | $result = @file_put_contents( $local , $content ); 110 | }elseif( function_exists( 'curl_init' ) ){ 111 | $fp = fopen( dirname(__FILE__) . '/' . $local , 'w+' ); 112 | $ch = curl_init( str_replace( ' ' , '%20' , $url ) ); 113 | curl_setopt($ch , CURLOPT_TIMEOUT , 50 ); 114 | curl_setopt($ch , CURLOPT_FILE , $fp ); 115 | curl_setopt($ch , CURLOPT_FOLLOWLOCATION , true ); 116 | $result = curl_exec( $ch ); 117 | curl_close( $ch ); 118 | fclose( $fp ); 119 | }else{ 120 | $result = false; 121 | } 122 | return $result; 123 | } 124 | function getGithubVersion(){ 125 | $versionURL = 'https://' . GITHUB_USERNAME . '.github.io/' . GITHUB_PROJECT .'/version.txt'; 126 | $remoteVersion = null; 127 | if( !( $remoteVersion = @file_get_contents( $versionURL ) ) 128 | && function_exists( 'curl_init' ) ){ 129 | $ch = curl_init( str_replace( ' ' , '%20' , $versionURL ) ); 130 | curl_setopt($ch , CURLOPT_TIMEOUT , 50 ); 131 | curl_setopt($ch , CURLOPT_RETURNTRANSFER , true ); 132 | curl_setopt($ch , CURLOPT_HEADER , false ); 133 | curl_setopt($ch , CURLOPT_FOLLOWLOCATION , true ); 134 | $remoteVersion = curl_exec( $ch ); 135 | curl_close( $ch ); 136 | } 137 | return $remoteVersion; 138 | } 139 | 140 | // Declare Parameters 141 | $step = 0; 142 | if( isset( $_POST['step'] ) ) 143 | $step = (int) $_POST['step']; 144 | 145 | ?> 146 | 147 |
148 | 149 | 150 |The WordPress Remote Installer is a script designed to streamline the installation of the WordPress Content Management System. Some users have limited experience using FTP, some webhosts do not allow files to be decompressed after being uploaded, and some people want to make their WordPress installs faster and simpler.
167 |Using the WordPress Remote Installer is simple - upload a single PHP file to your server, access it via a web-browser and simply follow the prompts through 7 easy steps, at the end of which, the Wordpress Installer will commence.
168 | 171 |You are using Version . Version is available through Github.
172 | 175 | 179 | ini_get( 'allow_url_fopen' ) , 191 | 'pass' => 'allow_url_open is Enabled' , 192 | 'fail' => 'allow_url_open is Disabled' 193 | ) , 194 | array( 195 | 'result' => !count( array_diff( glob( '*' ) , array( basename( __FILE__ ) , 'version.txt' ) ) ) , 196 | 'pass' => 'The server is empty (apart from this file)' , 197 | 'fail' => 'The server is not empty.' 198 | ) 199 | ); 200 | ?> 201 | 202 |All Files Deleted from the Directory as requested.
207 | 210 |NOTE: We are unable to proceed until the above issue(s) are resolved.
227 | 232 | 235 | 239 | 247 | 248 |NOTE: We are unable to proceed until the above issue(s) are resolved.
300 | 303 | 307 | 323 | 324 |List the Download URLs, or the slugs (e.g "classic-editor"), for all WordPress Plugins, one per line
326 | 331 | 338 | 339 |List the Download URLs for all WordPress Themes, one per line
406 | 411 | 418 | 419 |