Upgrade Alpha to Beta

The upgrade from Jojo 1.0a5 to 1.0b1 has a number of changes that need to be made.
We have tried to provide clear documentation explaining these changes and what needs to be done to do the upgrade.

Most of these changes only apply to upgrade installations, rather than new installations (or any installation where custom plugins are involved). The Jojo team have upgraded all the core plugins to support the new format, so be sure to download the latest plugin pack.

The Jojo team are available to perform upgrades for a small fee, if this all seems too hard (contact us for a quote).

PHP5 only

You must be running PHP 5.2 or later to run the Jojo beta. All other system requirements have not changed, though you can now run Jojo on LIGHTTPD or IIS.

parsepage.inc.php replaced by Jojo::registerURI()

A number of plugins have their own custom URI formats, and parsepage.inc.php was our old mechanism for handling this. We have now replaced this with the Jojo::registerURI() function.

Jojo will now ignore parsepage.inc.php, and this will break any plugins that rely on this functionality.

If your plugins do not include a "config/parsepage.inc.php" file, then this change probably does not affect you. If it does, please read our documentation on registerUri.

.htaccess is simplified

You will need to add and remove some code from the .htaccess file in the webroot of each site.

Old format

The lines we have removed are in italics.
RewriteEngine On

RewriteBase /

#prevent PHPSESSID showing up in querystring
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0

# CSS, Javascript, Images and Favicon
RewriteRule ^(css|js|images|favicon)/?(.*).(css|js|jpg|jpeg|png|gif|ico)$ index.php?action=$1&file=$2.$3 [L,NC]

# External files, Frajax actions, plugin/download files
RewriteRule ^(json|external|actions|files|downloads)/(.*)$ index.php?action=$1&file=$2 [L,NC]


# Everything else
RewriteRule ^$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L]

New format

The code we have added is in bold italics.
RewriteEngine On

RewriteBase /

#prevent PHPSESSID showing up in querystring
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0

# Everything else
RewriteRule ^$ index.php?uri=[L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?uri=$1[L]


Please note your .htaccess file may contain other code added by yourself, or your web host. These additional lines will need to be left intact, and this is the reason we are asking people to do a manual conversion of this file.

We have included an example .htaccess file in the Jojo download, under /_www/.htaccess

Jojo in a subfolder

If you are running Jojo out of a subfolder, eg www.domain.com/my-jojo-site/, then your RewriteBase value will be different. eg.
RewriteBase /my-jojo-site/

When upgrading, please ensure that your original RewriteBase line stays intact. If you find that the website is missing stylesheets and images after the upgrade, and subpages aren't working, this could be a sign that the RewriteBase line is not correct.

pg_link field behaviour changed

In the alpha version, the 'pg_link' field of the 'page' table was a reference to your plugin's controller file i.e.jojo_contact.php. Now we refer to the plugin's class i.e. JOJO_Plugin_Jojo_contact. This has allowed us to wrap a dropdown list around this field to make it easy for end users to select the controlling plugin for a page.

All plugins that make use of the pg_link field, will need to be changed. The following example is for the contact plugin.

Create an api.php file with the following code.
$_provides['pluginClasses'] = array(
      'Jojo_Plugin_Jojo_contact' => 'Contact - Contact Page'
      );

This code adds 1 new type of page to the plugin link dropdown on "Edit pages".
$_provides['pluginClasses'] is an array of the new page types you are adding into Jojo. The first element of the array is the name of the class you are adding, which is usually "Jojo_Plugin_YOUR_PLUGIN_NAME". The second part of the array is a friendly description for the end user.




Further to this, your setup.php file may also need to be modified if it automatically adds pages into Jojo. the pg_link field will need to have it's value changed from "your_plugin.php" to "Jojo_Plugin_your_plugin". If you notice several copies of your plugin page appearing in Jojo after running Setup, then this is the likely cause of the problem.

Menu navigation changed

We have made some slight changes to the default menu code to make the template code less bloated. See the supplied refresh theme for updated menu code.

Query syntax changed

We are planning a move to allow prefixes on database tables, so that Jojo can be used on a database that is shared with another application. To do this, a change is required to every query in Jojo.

While you are upgrading your plugins, you may want to consider rewriting queries to accommodate this, though you can safely skip this step without anything breaking.

We plan to continue support for the old format queries. However, these queries won't be able to be used by sites using the table prefix feature when it is released.

Old format

$data = Jojo::selectQuery("SELECT * FROM table WHERE id=".Jojo::cleanInt($id));

$data = Jojo::updateQuery("UPDATE table SET name='".Jojo::clean($name).', email='".Jojo::clean($email).'");

New format

$data = Jojo::selectQuery("SELECT * FROM {table} WHERE id=?", $id);

$data = Jojo::updateQuery("UPDATE {table} SET name=?, email=?", array($name, $email));


The new format offers a number of advantages...
  • Query syntax is generally easier to read.
  • No need to worry about placing quotes around string variables.
  • No need to use Jojo::clean() to escape your data.
  • The {braces} around the tablename allow us to add table prefixes automatically, when we implement this feature.

Upgrade support

Please use the forums for support in the first instance. We prefer to answer questions in a format that is useful to other people having the same problem.

If you are on a formal support contract, or are happy to pay a small amount for priority support, we can help with the installation via phone, SKype or MSN.

We are also having a workshop in Auckland (New Zealand) where we will demonstrate the steps required to upgrade.