Posts tonen met het label easy. Alle posts tonen
Posts tonen met het label easy. Alle posts tonen

dinsdag 17 maart 2015

Teddy woofpaw Wordpress Installer android app

Installing wordpress on your webhost has never been so easy, as with Teddy Woofpaw wordpress installer.

Step1:
Download, Install & start the wordpress installer app on your android device. (search google play for teddy wordpress installer).

Step2:
Input the credentials provided by your webhost: Domain name, ftp hostname, ftp user, ftp password & click install.


Step 3:
Enter the mysql user and password,


Done! Wordpress is up and running!

Step 4:

Official wordpress app can now be installed and used to connect to your site.







Current limitation:
will always be installed to the domain root.


Encountering a problem?
Determining the correct folder for the ftp uploads is done simply by trying to open certain folders in the right order.

The order in which the app tries to enter folders is this:

domains \  _usersupplieddomain_ \  html \ htdocs \ public_html \ www \ wwwroot

This ensures support for all modern webhosts.
Please let me know if your webhost uses an incompatible folder layout on the ftpserver, and provide me a screenshot (via email (click the keyboard) or here in the comment section), i'd be happy to update the app.


Geek talk; Technical explanation of how the app works
When the user submits the data, the app connects with the ftp.
In slow mode (max compatible), next: the app uploads http://wordpress.org/latest.zip.
Then, the app uploads an php script (click to see it).
After uploading is complete, the app opens a webview, visits the url to the php script.
In fast mode, the php script downloads http://wordpress.org/latest.zip.
The php script unzips the wordpress zip file and puts everything in place.
The php script deletes itself, and sends the webview in the app user to the wordpress first-run script with a header redirect.


maandag 16 maart 2015

Wordpress installer PHP script

Example PHP script for installing wordpress in the root of your domain.
This exact script is used in my new upcoming android app Wordpress Installer.
You can save it in a file, upload it to your host and run it in your browser.
It will download Wordpress, unzip the wordpress archive, launch the wordpress first-run script, afterwards this script will delete itself.
the $wpextr variable can be changed to install into a subfolder. Use a leading and a trailing slash.


<?php

// www.bartbosma.eu
// 2015
@ob_start();
function rrmdir($dir) {
   if (is_dir($dir)) {
     $objects = scandir($dir);
     foreach ($objects as $object) {
       if ($object != "." && $object != "..") {
         if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
       }
     }
     reset($objects);
     rmdir($dir);
   }
}
$wpextr="/wp/";
$wpextr="/";
$url = "https://wordpress.org/latest.zip";
$destination = "wordpress_latest.zip";   
if (!file_exists($destination)){
   
    if (function_exists("curl_init")){   
    $fp = fopen ($destination, 'w+');
    $ch = curl_init();
    curl_setopt( $ch, CURLOPT_URL, $url );
    curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" );
    curl_setopt( $ch, CURLOPT_BINARYTRANSFER, true );
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, false );
    curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
    curl_setopt( $ch, CURLOPT_AUTOREFERER, true );

    curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 100 );
    curl_setopt( $ch, CURLOPT_FILE, $fp );
    curl_exec( $ch );
    curl_close( $ch );
  fclose( $fp );
}else{
    if (!file_put_contents($destination, fopen($url, "r"))){
        $succes=false;
        die("Cant download file..");   
    }
   
}
if (filesize($destination) > 0) {$succes= true;echo "Archive download succes.<br />";}else{$succes=false;}


}else{
    echo "Archive already exists, no download required<br />";
$succes=true;}   


if ($succes==true)
{
$zip = new ZipArchive;
if ($zip->open($destination) === TRUE) {
    #echo $_SERVER['DOCUMENT_ROOT'].$wpextr;
    $zip->extractTo($_SERVER['DOCUMENT_ROOT'].$wpextr);
    $zip->close();
    echo 'Archive extracted succes';
    sleep(1);

if ($handle = opendir($_SERVER['DOCUMENT_ROOT'].$wpextr.'wordpress')) {
    while (false !== ($fileName = readdir($handle))) {
        if ($fileName!==".." ||$fileName!==".")     @rename($_SERVER['DOCUMENT_ROOT'].$wpextr."wordpress/".$fileName, $_SERVER['DOCUMENT_ROOT'].$wpextr.$fileName);
    }
    closedir($handle);
   

@unlink("wpinst.php");
sleep(1);
rrmdir($_SERVER['DOCUMENT_ROOT'].$wpextr.'wordpress');
header("Location: http://".$_SERVER['HTTP_HOST'].$wpextr."/wp-admin/install.php");

}
   
   
} else {
    echo 'ExtractTo function: Opening the wordpress zip file failed. Your webhost seems ancient.';
}   
   
}
// www.bartbosma.eu xD
?>