~GSoC 2010: Dwi Widiastuti Installation Simplification and Auto Updates
Clone this wiki locally
Goal to this project is to simplify the ThinkUp installation process and implement an auto-update feature so that current ThinkUp installations get notification when a new version is available.
Simplify the ThinkUp installation process
I’ll start by creating ThinkUpInstaller class which is singleton so that there’s only one instance of ThinkUpInstaller. We could attach an unique identifier to ThinkUpInstaller’s attribute to identify current user (UserAgent and IP written to session maybe?) who is executing ThinkUpInstaller.
Before instantiate ThinkUpInstaller, there’s a conditional checking at common/init.php to check whether config.inc.php exists plus other conditions that indicate ThinkUp is already installed. When ThinkUp is downloaded or cloned (from repository) for the first time, config.inc.php file shouldn’t exists. config.inc.php will be created automatically (by ThinkUpInstaller) or manually (when container directory is not writeable) based on config.sample.inc.php file. There will be four installation steps and each step has it own method on ThinkUpInstaller class (from each step I also provide its mockup) :
Requirements checkI’d like to create a method on ThinkUpInstaller class to check PHP version, cURL, GD lib and MySQL version. This is a mockup that I created to give a brief description when user hits step #1 :Other requirement to be verified is write permission on several directories (e.g.,
thinkup/logs/). When all required requirements are convenient clicking step #2’ link would gives step #2 forms (database setup, see below), otherwise stuck in step #1 until all requirements are met. Below is a mockup when some directories is not writeable:
Database SetupIn step #2 the user fills database credentials to be later used by a method on ThinkUpInstaller class to test database connection and populating build-db_mysql.sql. Below is a mockup form in step #2:
Configure SiteIn step #3 the user fills email for user admin and site name (app_title). After user fills these information, ThinkUpInstaller begin populating build-db_mysql.sql and – optionally – show progress bar. The password for user admin will be generated and sent to email provided before (the password also displayed on step #4, finish).
FinishIn step #4 the user is shown with admin password and a message notifying that the admin password also sent to the email. Below is a mockup form in step #4:
Implement an Auto-Update Feature (Notification)
To implement this feature ThinkUp must provide an API server that would respon latest version information against installed ThinkUp request. In case of Wordpress, there’s an API site to check latest version against current installed wordpress’ version, i.e., http://api.wordpress.org/core/version-check/1.3/?version=2.9.1, where 2.9.1 is the current version and since latest version of Wordpress (when I writing on this wiki) is 2.9.2, the API site returns something like:
upgrade http://wordpress.org/download/ http://wordpress.org/wordpress-2.9.2.zip 2.9.2 en_US
And when we have 2.9.2 (current latest version) installed, it returns the first line as
latest instead of
upgrade. We could use the same approach, where update information retrieval is done via built-in PHP function, 3
parse_url. The API update server could use plain-text as a response. I prefer using plain-text to reduce parsing time, since we’re dealing with less-line using XML, YAML or JSON is inefficient. Fetching latest version information should be done when user logged in as admin (is_admin = 1). When there’s an upgrade, the page would show a message such as “New ThinkUp x.y is available. Click here to upgrade!”. The process of upgrade is described below
Implement an Auto-Update Feature (Upgrading)
Upgrading happens when user has initiative to upgrade ThinkUp automatically or manually by clicking the “Click here to upgrade” link. To get latest core files populated inside thinkup directory we could use FTP or FTPS (ssh). If user doesn’t have FTP access, then give information steps to download latest ThinkUp manually.
Timeline and Deliverables
April 27 – May 23
If I got accepted I would start by digging ThinkUp codebase. Reviewing other CMS’ Installer script that will be used as a source inspiration. If I found codes – with same license as ThinkUp – that could be reusable for ThinkUpInstaller, I’ll use it. Since the timeline is very tight I’ll avoid reinvent the wheel.
May 24 – June 20
Coding for “Simplify the ThinkUp installation process”.
Starting to write ThinkUpInstaller class in first week.
In second week I’ll refine the GUI.
In third week I’ll refactor my code I’ve written.
Last week is used as testing and start documenting the installation process.
June 21 – July 15
Coding for “Implement an Auto-Update Feature (Notification)”.
July 16 – July 25
Coding for “Implement an Auto-Update Feature (Upgrading)”.
July 26 – August 12
Starting to write tests and documentation.
August 13 – August 16
Fixing some bugs if exist. Refactoring some codes and reviewing documentation.
Dwi Widiastuti <admin AT diazuwi.web.id>