WackoWiki: Upgrade Error With R 5.5.17

https://wackowiki.org/doc     Version: 22.12.2020 14:34

Cause: Error in version match if version is bigger than R5.5.14.

The updated wiki works as expected, but the installer does not remove all obsolete table fields and records.
You may check if your installation is affected by checking your page table in phpMyAdmin, if the supertag still exists in your table. To fix that run the following script.

Effect: The installer ignored the following necessary queries in the upgrade process:


"UPDATE {$pref}config SET config_value = '" _quote('addcomment|admin\.php|categories|claim|clone|diff|edit|export\.xml|file|latex|moderate|new|permissions|purge|print|properties|rate|referrers|referrers_sites|remove|rename|review|revisions|revisions\.xml|robots\.txt|sitemap\.xml|show|source|upload|watch|watchers|wordprocessor') . "' WHERE config_name = 'standard_handlers'";
$update_menu_r5_5_0 "DELETE FROM {$pref}menu WHERE user_id = (SELECT user_id FROM {$pref}user WHERE user_name = 'System' LIMIT 1) AND NOT menu_lang = '" _quote($config['language']) . "'";
$alter_page_r5_5_0 "ALTER TABLE {$pref}page DROP supertag";
$update_page_r5_5_2 "DELETE FROM {$pref}page WHERE owner_id = (SELECT user_id FROM {$pref}user WHERE user_name = 'System' LIMIT 1) AND NOT page_lang = '" _quote($config['language']) . "'";
$update_menu_r5_5_1 "DELETE m.* FROM {$pref}menu m LEFT JOIN {$pref}page p ON (m.page_id = p.page_id) WHERE p.page_id IS NULL";
$alter_page_link_r5_5_0 "ALTER TABLE {$pref}page_link DROP to_supertag";
$alter_revision_r5_5_0 "ALTER TABLE {$pref}revision DROP supertag";

1. PATCH for installer

diff --git a/wacko/setup/_insert_queries.php b/wacko/setup/_insert_queries.php
index 5a7e41a..9347ef7 100644
--- a/wacko/setup/_insert_queries.php
+++ b/wacko/setup/_insert_queries.php
@@ -93,7 +93,7 @@
 $upgrade['6.0.10'][]    = ['alter',        'category',            $alter_category_r5_5_0];

 // config
-$upgrade['5.5.14'][]    = ['update',    'config',            $update_config_r5_5_0];
+$upgrade['5.5.17'][]    = ['update',    'config',            $update_config_r5_5_0];
 $upgrade['6.0.11'][]    = ['update',    'config',            $update_config_r5_5_1];

 // file
@@ -104,29 +104,29 @@

 // menu
 $upgrade['6.0.10'][]    = ['alter',        'menu',                $alter_menu_r5_5_0];
-$upgrade['5.5.14'][]    = ['update',    'menu',                $update_menu_r5_5_0];
+$upgrade['5.5.17'][]    = ['update',    'menu',                $update_menu_r5_5_0];

 // page
-$upgrade['5.5.14'][]    = ['alter',        'page',                $alter_page_r5_5_0];
+$upgrade['5.5.17'][]    = ['alter',        'page',                $alter_page_r5_5_0];
 $upgrade['6.0.5'][]        = ['alter',        'page',                $alter_page_r5_5_1];
 $upgrade['6.0.10'][]    = ['alter',        'page',                $alter_page_r5_5_2];

-$upgrade['5.5.14'][]    = ['update',    'page',                $update_page_r5_5_2];
+$upgrade['5.5.17'][]    = ['update',    'page',                $update_page_r5_5_2];

 $upgrade['6.0.2'][]        = ['update',    'page',                $update_page_r5_5_0];
 $upgrade['6.0.2'][]        = ['update',    'page',                $update_page_r5_5_1];

 // keep this order, after $update_page_r5_5_2!
-$upgrade['5.5.14'][]    = ['update',    'menu',                $update_menu_r5_5_1];
+$upgrade['5.5.17'][]    = ['update',    'menu',                $update_menu_r5_5_1];

 // page link
-$upgrade['5.5.14'][]    = ['alter',        'page_link',        $alter_page_link_r5_5_0];
+$upgrade['5.5.17'][]    = ['alter',        'page_link',        $alter_page_link_r5_5_0];

 // rating
 $upgrade['6.0.8'][]        = ['alter',        'rating',            $alter_rating_r5_5_0];

 // revision
-$upgrade['5.5.14'][]    = ['alter',        'revision',            $alter_revision_r5_5_0];
+$upgrade['5.5.17'][]    = ['alter',        'revision',            $alter_revision_r5_5_0];
 $upgrade['6.0.11'][]    = ['alter',        'revision',            $alter_revision_r5_5_1];
 // user
 $upgrade['6.0.0'][]        = ['insert',    'user',                $insert_user_r5_5_0];

2. Action for fixing affected installations

Manual routine to fix your already upgraded installation, place it under actions, run {{admin_upgradefix}} it as Admin, check your tables again, if OK – remove the action again.



if (!defined('IN_WACKO'))

$pref $this->db->table_prefix;

if (

'<h2>Runs missing upgrade routines for R5.5.17 -> R6.0.x Upgrade:</h2>';
'<p>This issue exists only for versions upgraded from R5.5.15 to R5.5.17.</p>';

    if (!isset(
'<input type="submit" name="set_large_prefix_tables" value="' $this->_t('UpdateButton') . '">';
    else if (isset(
// 1. update handlers in config table
{$pref}config SET
                config_value = " 
$this->db->q('addcomment|admin\.php|categories|claim|clone|diff|edit|export\.xml|file|latex|moderate|new|permissions|purge|print|properties|rate|referrers|referrers_sites|remove|rename|review|revisions|revisions\.xml|robots\.txt|sitemap\.xml|show|source|upload|watch|watchers|wordprocessor') . "
            WHERE config_name = 'standard_handlers'"

// 2. remove old menu entries
            DELETE FROM 
            WHERE user_id = (SELECT user_id FROM 
{$pref}user WHERE user_name = 'System' LIMIT 1)
                AND NOT menu_lang = " 
$this->db->q($this->db->language) . "");

// 3. remove obsolete supertag from page table
            ALTER TABLE 
{$pref}page DROP supertag");

// 4. remove obsolete system pages from page table
            DELETE FROM 
            WHERE owner_id = (SELECT user_id FROM 
{$pref}user WHERE user_name = 'System' LIMIT 1)
                AND NOT page_lang = " 
$this->db->q($this->db->language) . "");

// 5. remove obsolete menu items
            DELETE m.*
{$pref}menu m
                LEFT JOIN 
{$pref}page p ON (m.page_id = p.page_id)
            WHERE p.page_id IS NULL"

// 6. remove obsolete supertag from page_link table
            ALTER TABLE 
{$pref}page_link DROP to_supertag");

// 7. remove obsolete supertag from revision table
            ALTER TABLE 
{$pref}revision DROP supertag");