# HG changeset patch # User Dan # Date 1200671244 18000 # Node ID 979d99a0b00e3bdce8c14059962dbaac2e3fa696 # Parent 2398420f48e7a186eda84fa546ac7b91cabccb1c A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1. diff -r 2398420f48e7 -r 979d99a0b00e includes/common.php --- 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', '

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 upgrade?

'); + grinding_halt('Version mismatch', '

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 upgrade?

'); } // @@ -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 ) diff -r 2398420f48e7 -r 979d99a0b00e includes/http.php --- 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 "

Cookies: $cookies

"; echo "

GET URI: " . htmlspecialchars($this->uri . $get) . "

"; echo "

POST DATA: " . htmlspecialchars($post) . "

"; + echo "
";
     }
-    echo "
";
     
     $this->_fputs($connection, "{$this->method} {$this->uri}{$get} HTTP/1.1{$newline}");
     $this->_fputs($connection, "Host: {$this->host}{$newline}");
diff -r 2398420f48e7 -r 979d99a0b00e install/images/css/installer.css
--- 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;
diff -r 2398420f48e7 -r 979d99a0b00e install/includes/common.php
--- 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
 
diff -r 2398420f48e7 -r 979d99a0b00e install/includes/ui.php
--- 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 "      
  • $stage
  • \n "; } echo " \n
    \n \n"; - echo "
    \n "; + echo "
    \n "; echo "
    \n "; } diff -r 2398420f48e7 -r 979d99a0b00e install/index.php --- 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 @@ ?>
    -
    Enano hasn't been installed yet!
    You'll need to install the Enano database before you can use your site. To get started, click the Install button below.
    - @@ -64,8 +64,7 @@ -
    + ?>
    @@ -99,7 +98,7 @@ diff -r 2398420f48e7 -r 979d99a0b00e install/schemas/upgrade/migration/1.0-1.1-mysql.sql --- /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 = '

    $INPUT_AUTH$

    ' 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; + diff -r 2398420f48e7 -r 979d99a0b00e install/upgrade.php --- /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 @@ +__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. + + ?> +

    + Your server doesn't have support for PHP 5. +

    +

    + 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 GoPHP5 was started to + encourage web hosts to migrate to PHP 5. +

    +

    + 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. + +

    +

    + 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 + 1.0.x series of Enano 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. +

    + show_footer(); + exit(0); +} + +$ui->show_header(); +$ui->show_footer(); +