Skip to content

~GSoC 2010: Dwi Widiastuti Installation Simplification and Auto Updates

anildash edited this page Mar 26, 2011 · 1 revision

Description

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.

Implementation Plan

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) :

  1. Requirements check
    I’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 :

    Picture 1.a. Installation Step #1 (when everything is ok)
    Other requirement to be verified is write permission on several directories (e.g., thinkup/webapp/templates_c/ , thinkup/webapp/templates_c/cache and 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:



    Picture 1.b. Installation Step #1 (when requirement is not met)
  2. Database Setup
    In 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:

    Pictue 2. Installation Step #2 (database credentials)
  3. Configure Site
    In 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).

    Pictue 3. Installation Step #3 (Configure Site)
  4. Finish
    In 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:

    Picture 4. Installation Step #4 (Finish)

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, 3parse_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.

About Me

My name is Dwi Widiastuti, I am 2nd-year graduate student at Gunadarma University1. I’ve been coding with PHP since 2006. Since I worked at my college2, I’ve helped my friends developed internal web applications for my college. I’ll admit that I am not a proficient PHP programmer, but I’ve learned a lot so that I knew about design patterns best practice (), well-structured (X)HTML layout, CSS, JavaScript and JQuery. My reason to choose ThinkUp is because its recent codebase is not too large neither complex. The developments has just started so that I could track some issues easily. Well, it’s a benefit for a new contributor like me to join the ThinkUp development team.

Dwi Widiastuti <admin AT diazuwi.web.id>

References

1 Gunadarma Universtiy

2 My Staff Site

3 parse_url

Clone this wiki locally