install/upgrade.php
author Dan
Wed, 09 Jul 2008 21:02:09 -0400
changeset 617 9e4ccf67b6ea
parent 568 3700f7124c2b
child 626 be0e904eec17
permissions -rw-r--r--
Fixed missing require() on search.php in rebuild_page_index()
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
354
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
     1
<?php
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
     2
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
     3
/*
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
     4
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
536
218a627eb53e Rebrand as 1.1.4 (Caoineag alpha 4)
Dan
parents: 526
diff changeset
     5
 * Version 1.1.4 (Caoineag alpha 4)
218a627eb53e Rebrand as 1.1.4 (Caoineag alpha 4)
Dan
parents: 526
diff changeset
     6
 * Copyright (C) 2006-2008 Dan Fuhry
354
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
     7
 * Installation package
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
     8
 * upgrade.php - Upgrade interface
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
     9
 *
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    10
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    11
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    12
 *
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    13
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    14
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    15
 */
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    16
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    17
define('IN_ENANO', 1);
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    18
494
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
    19
// The list of versions in THIS AND PREVIOUS branches, in chronological order.
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
    20
$enano_versions = array();
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
    21
$enano_versions['1.0'] = array('1.0', '1.0.1', '1.0.2b1', '1.0.2', '1.0.3', '1.0.4');
536
218a627eb53e Rebrand as 1.1.4 (Caoineag alpha 4)
Dan
parents: 526
diff changeset
    22
$enano_versions['1.1'] = array('1.1.1', '1.1.2', '1.1.3', '1.1.4');
411
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
    23
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    24
// Turn on every imaginable API hack to make common load on older databases
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    25
define('IN_ENANO_UPGRADE', 1);
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    26
define('IN_ENANO_MIGRATION', 1);
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    27
define('ENANO_ALLOW_LOAD_NOLANG', 1);
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    28
@ini_set('display_errors', 'on');
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    29
494
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
    30
// Load installer files
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 497
diff changeset
    31
require_once('../includes/sql_parse.php');
494
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
    32
require_once('includes/common.php');
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
    33
require_once('includes/libenanoinstall.php');
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    34
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    35
// when the installer's common is loaded, it runs chdir() to the ENANO_ROOT, thus making this Enano's common.php
568
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    36
// PHP5 notice removed in 1.1.4 since the existing common is loaded and that loads lang and json2, which will
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    37
// give syntax errors on PHP4. So much for that. The installer will warn about this anyway.
354
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    38
require_once('includes/common.php');
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    39
@ini_set('display_errors', 'on');
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    40
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    41
$ui = new Enano_Installer_UI('Enano upgrader', false);
568
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    42
411
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
    43
$stg_welcome = $ui->add_stage('Welcome', true);
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
    44
$stg_confirm = $ui->add_stage('Confirmation', true);
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
    45
$stg_upgrade = $ui->add_stage('Perform upgrade', true);
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
    46
$stg_finish  = $ui->add_stage('Finish', true);
354
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    47
568
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    48
// init languages
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    49
$lang_id_list = array_keys($languages);
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    50
$lang_id = $lang_id_list[0];
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    51
$language_dir = $languages[$lang_id]['dir'];
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    52
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    53
// load the language file
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    54
$lang = new Language($lang_id);
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    55
$lang->load_file(ENANO_ROOT . '/language/' . $language_dir . '/install.json');
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    56
$lang->load_file(ENANO_ROOT . '/language/' . $language_dir . '/user.json');
354
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
    57
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    58
// Version check
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    59
if ( enano_version() == installer_enano_version() )
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    60
{
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    61
  $ui->show_header();
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    62
  echo '<h3>Already upgraded</h3>' . '<p>You don\'t need to migrate, you\'re already on <del>crack</del> the 1.1 platform.</p>';
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    63
  $ui->show_footer();
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    64
  exit();
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    65
}
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    66
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    67
// Start session manager
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    68
$session->start();
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    69
if ( !$session->user_logged_in || ( $session->user_logged_in && $session->auth_level < USER_LEVEL_ADMIN ) )
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    70
{
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    71
  if ( isset($_POST['do_login']) )
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    72
  {
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    73
    if ( !$session->user_logged_in )
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    74
    {
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    75
      $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_MEMBER);
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    76
    }
568
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    77
    if ( !isset($result) || ( isset($result) && $result['success']) )
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    78
    {
568
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    79
      $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_ADMIN);
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    80
      if ( $result['success'] )
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    81
      {
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    82
        header('HTTP/1.1 302 Some kind of redirect with implied no content');
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    83
        header('Location: ' . scriptPath . '/install/' . $session->append_sid('upgrade.php'));
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    84
        exit();
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    85
      }
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    86
    }
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    87
  }
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    88
  
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    89
  $ui->show_header();
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    90
  
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    91
  ?>
568
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    92
  <h3><?php echo $lang->get('upgrade_login_msg_auth_needed_title'); ?></h3>
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    93
  <?php
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    94
  
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    95
  echo '<form action="upgrade.php" method="post">';
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    96
  
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    97
  if ( isset($result) )
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
    98
  {
568
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
    99
    echo '<b>' . $lang->get('upgrade_login_err_failed', array('error_code' => $result['error'])) . '</b>';
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   100
  }
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   101
  
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   102
  ?>
568
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   103
  <p><?php
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   104
  if ( $session->user_logged_in )
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   105
  {
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   106
    echo $lang->get('upgrade_login_msg_auth_needed_body_level2');
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   107
  }
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   108
  else
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   109
  {
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   110
    echo $lang->get('upgrade_login_msg_auth_needed_body_level1');
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   111
  }
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   112
  ?></p>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   113
  <table border="0" cellspacing="0" cellpadding="5" style="margin: 0 auto;">
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   114
  <tr>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   115
    <td><?php echo $lang->get('user_login_field_username'); ?>:</td>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   116
    <td><input type="text" name="username" tabindex="1" /></td>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   117
  </tr>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   118
  <tr>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   119
    <td><?php echo $lang->get('user_login_field_password'); ?>:</td>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   120
    <td><input type="password" name="password" tabindex="2" /></td>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   121
  </tr>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   122
  <tr>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   123
    <td colspan="2" style="text-align: center;">
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   124
      <input type="submit" name="do_login" value="<?php echo $lang->get('upgrade_login_btn_login'); ?>" tabindex="3" />
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   125
    </td>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   126
  </tr>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   127
  </table>
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   128
  <?php
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   129
  
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   130
  echo '</form>';
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   131
  
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   132
  $ui->show_footer();
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   133
  exit();
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   134
}
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   135
411
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   136
if ( isset($_GET['stage']) && @$_GET['stage'] == 'pimpmyenano' )
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   137
{
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   138
  $ui->set_visible_stage($stg_upgrade);
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   139
}
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   140
else
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   141
{
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   142
  $ui->set_visible_stage($stg_confirm);
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   143
}
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   144
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   145
// The real migration code
354
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
   146
$ui->show_header();
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   147
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   148
if ( isset($_GET['stage']) && @$_GET['stage'] == 'pimpmyenano' )
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   149
{
494
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   150
  /*
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   151
   HOW DOES ENANO'S UPGRADER WORK?
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   152
   
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   153
   Versions of Enano are organized into branches and then specific versions by
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   154
   version number. The upgrader works by using a list of known version numbers
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   155
   and then systematically executing upgrade schemas for each version.
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   156
   
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   157
   When the user requests an upgrade, the first thing performed is a migration
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   158
   check, which verifies that they are within the right branch. If they are not
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   159
   within the right branch the upgrade framework will load a migration script
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   160
   which will define a function named MIGRATE(). Performing more than one
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   161
   migration in one pass will probably never be supported. How that works for
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   162
   UX in 1.3.x/1.4.x I know not yet.
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   163
   
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   164
   After performing any necessary branch migrations, the framework will perform
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   165
   any upgrades within the target branch, which is the first two parts
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   166
   (delimited by periods) of the installer's version number defined in the
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   167
   installer's common.php.
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   168
   
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   169
   enano_perform_upgrade() will only do upgrades. Not migrations. The two as
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   170
   illustrated within this installer are very different.
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   171
   */
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   172
  
411
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   173
  // Do we need to run the migration first?
494
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   174
  list($major_version, $minor_version) = explode('.', enano_version());
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   175
  $current_branch = "$major_version.$minor_version";
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   176
  
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   177
  list($major_version, $minor_version) = explode('.', installer_enano_version());
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   178
  $target_branch = "$major_version.$minor_version";
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   179
  
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   180
  if ( $target_branch != $current_branch )
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   181
  {
494
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   182
    // First upgrade to the latest revision of the current branch
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   183
    enano_perform_upgrade($current_branch);
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   184
    // Branch migration could be tricky and is often highly specific between
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   185
    // major branches, so just include a custom migration script.
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   186
    require(ENANO_ROOT . "/install/schemas/upgrade/migration/{$current_branch}-{$target_branch}.php");
411
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   187
    $result = MIGRATE();
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   188
    if ( !$result )
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   189
    {
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   190
      echo 'Migration failed, there should be an error message above.';
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   191
      $ui->show_footer();
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   192
      exit;
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   193
    }
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   194
  }
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   195
  
494
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   196
  // Do the actual upgrade
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 486
diff changeset
   197
  enano_perform_upgrade($target_branch);
411
d1a95497b68f Rebrand as 1.1.2; made upgrade framework functional
Dan
parents: 377
diff changeset
   198
  
496
449b042ea6b0 [Minor] Added a nice little link on upgrade success.
Dan
parents: 494
diff changeset
   199
  $site_url = makeUrl(getConfig('main_page'), false, true);
449b042ea6b0 [Minor] Added a nice little link on upgrade success.
Dan
parents: 494
diff changeset
   200
  echo '<p>All done! I\'ll actually be nice enough to give you a <a href="' . $site_url . '">link back to your site</a> this release <tt>:)</tt></p>';
497
ecb636490702 Updated upgrade/migration schemas to handle user_timezone column properly
Dan
parents: 496
diff changeset
   201
  echo '<p><b>It is important that you run a language string re-import and then clear your browser cache.</b> Otherwise you may see bits of the interface that appear to not be localized. This process will be automatic and non-destructive in later versions.</p>';
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   202
}
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   203
else
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   204
{
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   205
  ?>
568
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   206
  <h3><?php echo $lang->get('upgrade_confirm_title'); ?></h3>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   207
  <p><?php echo $lang->get('upgrade_confirm_body', array('enano_version' => installer_enano_version())); ?></p>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   208
  <ul>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   209
    <li><?php echo $lang->get('upgrade_confirm_objective_backup_fs', array('dir' => ENANO_ROOT)); ?></li>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   210
    <li><?php echo $lang->get('upgrade_confirm_objective_backup_db', array('dbname' => $dbname)); ?></li>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   211
  </ul>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   212
  <form method="get" action="upgrade.php" style="text-align: center;">
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   213
    <input type="hidden" name="auth" value="<?php echo $session->sid_super; ?>" />
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   214
    <button name="stage" value="pimpmyenano" class="submit">
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   215
      <img src="images/icons/pimp.png" />
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   216
      <?php echo $lang->get('upgrade_confirm_btn_upgrade'); ?>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   217
    </button>
3700f7124c2b A bit of UX improvement to upgrade UI; updated readme for 1.1.4
Dan
parents: 536
diff changeset
   218
  </form>
377
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   219
  <?php
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   220
}
bb3e6c3bd4f4 Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents: 354
diff changeset
   221
354
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
   222
$ui->show_footer();
979d99a0b00e A few more installer tweaks / fixes. Initted upgrade script. Added migration schema from 1.0 to 1.1.
Dan
parents:
diff changeset
   223