This document describes how you can most easily automate the installation of the b2evolution blog software of a hosting account.
This document also addresses automated upgrade of b2evolution.
b2evolution is a PHP + MySQL web application. At this point we strongly recommend the use of PHP 5 as well as MySQL 5 although b2evolution can work perfectly fine on PHP 4.3 and MySQL 4.0.
Please see our System Requirements page for details.
Automated installation of web applications such as b2evolution typically involves these steps:
We recommend you prompt the user for a directory to install b2evolution into. If he provides an empty directory, b2evolution would be installed in his web root. Let's pretend the user chose to install into www/myblog/ .
Once the destination directory selected/created, you need to copy all the contents of the /blogs/ directory as provided in the b2evolution package into the destination directory www/myblog/ . You should not copy the package info files such as the /doc/ directory.
You should make sure that the contents of the www/myblog/media/ directory are writable by PHP. This is the place where the user can upload pictures to insert in his blog posts, etc.
You will need to provide b2evolution with a database where it will create its own tables.
At this point, you need to write/update the basic configuration file you previously copied to www/myblog/conf/_basic_conf.php .
You need to update the following lines with the database login info:
$db_config = array( 'user' => 'demouser', // your MySQL username 'password' => 'demopass', // ...and password 'name' => 'b2evolution', // the name of the database 'host' => 'localhost', // MySQL Server (typically 'localhost') );
Then, you should update the user's e-mail address on this line:
$admin_email = 'postmaster@localhost';
and you need to tell b2evolution that the configuration has been done by replacing
$config_is_done = 0;
with
$config_is_done = 1;
At this point you can call b2evolution's install script through an HTTP GET request (wget, cURL, etc..) of this form:
http://example.com/myblogs/install/index.php?locale=en-US&action=newdb&create_sample_contents=1
You can detect that installation has been successful by parsing the output and locating the string <evo:password> .
Furthermore, you can parse out the password that has been created for the user by parsing it out between <evo:password> and </evo:password>. Example:
<evo:password>testpwd</evo:password>
At this point, the www/myblog/install/ folder is no longer needed. We recommend you delete it, both to save space and improve security.
Note: when upgrading, you will need a new install folder. So there is really no point in keeping it.
Any newer version of b2evolution can upgrade its database from any older version. It will also refuse to update if for some reason you try to "downgrade" it.
Open the file www/myblog/conf/_application.php and parse out the line that says:
$app_version = '2.0.2-alpha';
You can safely ignore the part after the hyphen (-). The version number will always change when a new version is released.
You can compare this version number with the new one you have available.
Note: if using PHP, you can use version_compare() which does all the work for you.
You should warn the user that any customizations he may have added to his existing b2evolution may not work properly with the new version. This especially applies to custom skins, custom plugins and custom locales (translations).
Optionally, you may want to provide checkboxes for the following:
Delete all files & folders from the www/myblog/ except:
Warning: if the user has installed into the root folder, you may not want to delete "all files & folders"! In this case, the folders you should delete are:
After than copy all files from the new b2evolution's /blogs/ folder, except /blogs/media/ and /blogs/conf/_basic_config.php .
At this point you can call b2evolution's install script through an HTTP GET request (wget, cURL, etc..) of this form:
http://example.com/myblogs/install/index.php?locale=en-US&action=evoupgrade
At this point, the www/myblog/install/ folder is no longer needed. We recommend you delete it, both to save space and improve security.
Note: when upgrading again, you will need a new install folder. So there is really no point in keeping it.