A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
--- a/includes/common.php Thu Jan 17 23:31:35 2008 -0500
+++ b/includes/common.php Fri Jan 18 10:47:24 2008 -0500
@@ -205,7 +205,7 @@
// Now that we have the config, check the Enano version.
if ( enano_version(false, true) != $version && !defined('IN_ENANO_UPGRADE') )
{
- grinding_halt('Version mismatch', '<p>It seems that the Enano release we\'re trying to run ('.$version.') is different from the version specified in your database ('.enano_version().'). Perhaps you need to <a href="'.scriptPath.'/upgrade.php">upgrade</a>?</p>');
+ grinding_halt('Version mismatch', '<p>It seems that the Enano release we\'re trying to run ('.$version.') is different from the version specified in your database ('.enano_version().'). Perhaps you need to <a href="'.scriptPath.'/install/upgrade.php">upgrade</a>?</p>');
}
//
@@ -239,7 +239,7 @@
}
// Is there no default language?
-if ( getConfig('lang_default') === false )
+if ( getConfig('lang_default') === false && !defined('IN_ENANO_MIGRATION') )
{
$q = $db->sql_query('SELECT lang_id FROM '.table_prefix.'language LIMIT 1;');
if ( !$q )
--- a/includes/http.php Thu Jan 17 23:31:35 2008 -0500
+++ b/includes/http.php Fri Jan 18 10:47:24 2008 -0500
@@ -353,8 +353,8 @@
echo "<p><b>Cookies:</b> $cookies</p>";
echo "<p><b>GET URI:</b> " . htmlspecialchars($this->uri . $get) . "</p>";
echo "<p><b>POST DATA:</b> " . htmlspecialchars($post) . "</p>";
+ echo "<pre>";
}
- echo "<pre>";
$this->_fputs($connection, "{$this->method} {$this->uri}{$get} HTTP/1.1{$newline}");
$this->_fputs($connection, "Host: {$this->host}{$newline}");
--- a/install/images/css/installer.css Thu Jan 17 23:31:35 2008 -0500
+++ b/install/images/css/installer.css Fri Jan 18 10:47:24 2008 -0500
@@ -92,7 +92,7 @@
padding: 10px;
background-image: url(../substages.png);
background-repeat: repeat-x;
- width: 70%;
+ width: 77%;
margin: 20px auto 0 auto;
text-align: center;
color: #808080;
--- a/install/includes/common.php Thu Jan 17 23:31:35 2008 -0500
+++ b/install/includes/common.php Fri Jan 18 10:47:24 2008 -0500
@@ -21,6 +21,23 @@
// If type is set to "rc", "beta", or "alpha", optionally another version number can be issued with the key 'sub':
// 'sub' => '3' will produce Enano 1.1.1a3 / Enano 1.1.1 alpha 3
);
+
+function installer_enano_version($long = false)
+{
+ global $installer_version;
+ static $keywords = array(
+ 'alpha' => 'a',
+ 'beta' => 'b',
+ 'RC' => 'rc'
+ );
+ $v = $installer_version['version'];
+ if ( isset($installer_version['sub']) )
+ {
+ $v .= ( $short ) ? $keywords[$installer_version['type']] : " {$installer_version['type']} ";
+ $v .= $installer_version['sub'];
+ }
+ return $v;
+}
// Determine Enano root directory
--- a/install/includes/ui.php Thu Jan 17 23:31:35 2008 -0500
+++ b/install/includes/ui.php Fri Jan 18 10:47:24 2008 -0500
@@ -215,7 +215,7 @@
echo " <li class=\"$class\">$stage</li>\n ";
}
echo " </ul>\n <div style=\"clear: both;\"></div>\n </div>\n";
- echo " <div id=\"enano-fill\">\n ";
+ echo " <div id=\"enano-fill\">\n ";
echo " <div id=\"enano-body\">\n ";
}
--- a/install/index.php Thu Jan 17 23:31:35 2008 -0500
+++ b/install/index.php Fri Jan 18 10:47:24 2008 -0500
@@ -39,14 +39,14 @@
?>
<div id="installnotice">
- <?php
+ <?php
if ( !defined('ENANO_INSTALLED') ):
?>
<div class="info-box-mini">
<b>Enano hasn't been installed yet!</b><br />
You'll need to install the Enano database before you can use your site. To get started, click the Install button below.
</div>
- <?php
+ <?php
if ( file_exists('./config.php') )
{
?>
@@ -64,8 +64,7 @@
<?php
}
endif;
- ?>
- </div>
+ ?></div>
<table border="0" cellspacing="10" cellpadding="0" width="100%" id="installmenu">
<tr>
<td style="text-align: right; width: 50%;">
@@ -99,7 +98,7 @@
</a>
</li>
<?php
- if ( $version == enano_version(true) )
+ if ( installer_enano_version() == enano_version(true) )
{
echo '<li>
<a class="upgrade-disabled icon icon-disabled">
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/install/schemas/upgrade/migration/1.0-1.1-mysql.sql Fri Jan 18 10:47:24 2008 -0500
@@ -0,0 +1,48 @@
+-- Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+-- Version 1.1.1
+-- Copyright (C) 2006-2007 Dan Fuhry
+
+-- This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+-- as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+
+-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+
+-- 1.0-1.1-mysql.sql - Enano 1.0.x to 1.1.x migration queries, MySQL
+
+ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_lang smallint(5) NOT NULL;
+ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_has_avatar tinyint(1) NOT NULL;
+ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN avatar_type ENUM('jpg', 'png', 'gif') NOT NULL;
+
+CREATE TABLE {{TABLE_PREFIX}}lockout(
+ id int(12) NOT NULL auto_increment,
+ ipaddr varchar(40) NOT NULL,
+ action ENUM('credential', 'level') NOT NULL DEFAULT 'credential',
+ timestamp int(12) NOT NULL DEFAULT 0,
+ PRIMARY KEY ( id )
+) CHARACTER SET `utf8`;
+
+CREATE TABLE {{TABLE_PREFIX}}language(
+ lang_id smallint(5) NOT NULL auto_increment,
+ lang_code varchar(16) NOT NULL,
+ lang_name_default varchar(64) NOT NULL,
+ lang_name_native varchar(64) NOT NULL,
+ last_changed int(12) NOT NULL DEFAULT 0,
+ PRIMARY KEY ( lang_id )
+) CHARACTER SET `utf8`;
+
+CREATE TABLE {{TABLE_PREFIX}}language_strings(
+ string_id bigint(15) NOT NULL auto_increment,
+ lang_id smallint(5) NOT NULL,
+ string_category varchar(32) NOT NULL,
+ string_name varchar(64) NOT NULL,
+ string_content longtext NOT NULL,
+ PRIMARY KEY ( string_id )
+);
+
+UPDATE {{TABLE_PREFIX}}sidebar SET block_name = '{lang:sidebar_title_navigation}', block_type = 1, block_content = '[[Main_Page|{lang:sidebar_btn_home}]]' WHERE item_id = 1;
+UPDATE {{TABLE_PREFIX}}sidebar SET block_name = '{lang:sidebar_title_tools}', block_type = 1, block_content = '[[$NS_SPECIAL$CreatePage|{lang:sidebar_btn_createpage}]]\n[[$NS_SPECIAL$UploadFile|{lang:sidebar_btn_uploadfile}]]\n[[$NS_SPECIAL$SpecialPages|{lang:sidebar_btn_specialpages}]]\n{if auth_admin}\n$ADMIN_LINK$\n[[$NS_SPECIAL$EditSidebar|{lang:sidebar_btn_editsidebar}]]\n{/if}' WHERE item_id = 2;
+UPDATE {{TABLE_PREFIX}}sidebar SET block_name = '$USERNAME$', block_type = 1, block_content = '[[$NS_USER$$USERNAME$|{lang:sidebar_btn_userpage}]]\n[[$NS_SPECIAL$Contributions/$USERNAME$|{lang:sidebar_btn_mycontribs}]]\n{if user_logged_in}\n[[$NS_SPECIAL$Preferences|{lang:sidebar_btn_preferences}]]\n[[$NS_SPECIAL$PrivateMessages|{lang:sidebar_btn_privatemessages}]]\n[[$NS_SPECIAL$Usergroups|{lang:sidebar_btn_groupcp}]]\n$THEME_LINK$\n{/if}\n{if user_logged_in}\n$LOGOUT_LINK$\n{else}\n[[$NS_SPECIAL$Register|{lang:sidebar_btn_register}]]\n$LOGIN_LINK$\n[[$NS_SPECIAL$Login/$NS_SPECIAL$PrivateMessages|{lang:sidebar_btn_privatemessages}]]\n{/if}' WHERE item_id = 3;
+UPDATE {{TABLE_PREFIX}}sidebar SET block_name = '{lang:sidebar_title_search}', block_type = 1, block_content = '<div class="slideblock2" style="padding: 0px;"><form action="$CONTENTPATH$$NS_SPECIAL$Search" method="get" style="padding: 0; margin: 0;"><p><input type="hidden" name="title" value="$NS_SPECIAL$Search" />$INPUT_AUTH$<input name="q" alt="Search box" type="text" size="10" style="width: 70%" /> <input type="submit" value="{lang:sidebar_btn_search_go}" style="width: 20%" /></p></form></div>' WHERE item_id = 4;
+UPDATE {{TABLE_PREFIX}}sidebar SET block_name = '{lang:sidebar_title_links}', block_type = 4, block_content = 'Links' WHERE item_id = 5;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/install/upgrade.php Fri Jan 18 10:47:24 2008 -0500
@@ -0,0 +1,75 @@
+<?php
+
+/*
+ * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+ * Version 1.1.1
+ * Copyright (C) 2006-2007 Dan Fuhry
+ * Installation package
+ * upgrade.php - Upgrade interface
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ */
+
+define('IN_ENANO', 1);
+
+require_once('includes/common.php');
+@ini_set('display_errors', 'on');
+
+$ui = new Enano_Installer_UI('Enano upgrader', false);
+if ( version_compare(PHP_VERSION, '5.0.0', '<') )
+{
+ $ui->__construct('Enano upgrader', false);
+}
+$ui->add_stage('Welcome', true);
+$ui->add_stage('Select version', true);
+$ui->add_stage('Perform upgrade', true);
+$ui->add_stage('Finish', true);
+$stg_php4 = $ui->add_stage('PHP4 compatibility notice', false);
+
+if ( version_compare(PHP_VERSION, '5.0.0', '<') || isset($_GET['debug_warn_php4']) )
+{
+ $ui->set_visible_stage($stg_php4);
+ $ui->step = '';
+
+ $ui->show_header();
+
+ // This isn't localized because all localization code is dependent on
+ // PHP 5 (loading lang.php will throw a parser error under PHP4). This
+ // one message probably doesn't need to be localized anyway.
+
+ ?>
+ <h2 class="heading-error">
+ Your server doesn't have support for PHP 5.
+ </h2>
+ <p>
+ PHP 5 is the latest version of the language on which Enano was built. Its many new features have been available since early 2004, yet
+ many web hosts have not migrated to it because of the work involved. In 2007, Zend Corporation announced that support for the aging
+ PHP 4.x would be discontinued at the end of the year. An initiative called <a href="http://gophp5.org/">GoPHP5</a> was started to
+ encourage web hosts to migrate to PHP 5.
+ </p>
+ <p>
+ Because of the industry's decision to not support PHP 4 any longer, the Enano team decided that it was time to begin using the powerful
+ features of PHP 5 at the expense of PHP 4 compatibility. Therefore, this version of Enano cannot be installed on your server until it
+ is upgraded to at least PHP 5.0.0, and preferably the latest available version.
+ <!-- No, not even removing the check in this installer script will help. As soon as the PHP4 check is passed, the installer shows the
+ language selection page, after which the language code is loaded. The language code and libjson2 will trigger parse errors under
+ PHP <5.0.0. -->
+ </p>
+ <p>
+ If you need to use Enano but can't upgrade your PHP because you're on a shared or reseller hosting service, you can use the
+ <a href="http://enanocms.org/download?series=1.0">1.0.x series of Enano</a> on your site. While the Enano team attempts to make this
+ older series work on PHP 4, official support is not provided for installations of Enano on PHP 4.
+ </p>
+ <?php
+
+ $ui->show_footer();
+ exit(0);
+}
+
+$ui->show_header();
+$ui->show_footer();
+