XF 2.0 Upgrading XF1 -> XF2

Robust

Well-known member
Updating an add-on to XF2, and in this all phrases, options, other things were renamed (new prefix, at least) or scrapped. The only thing it really shares in common with the XF1 is the data in tables.

Since I changed IDs I'm guessing there's going to be a bunch of scrap left over, e.g. old phrase names, permissions, perhaps even option groups, if I do the normal XF1->XF2 upgrade step. I'm *guessing* (since I haven't done it yet) that all of this is going to need to be dropped. Is there an easy way to clean up all of that?

I guess it's probably smarter to have a patch for the previous version's uninstaller to not drop any tables/columns, request end users to uninstall the previous and then install the XF2 version as a fresh one which renames the tables into the new format. It means options need to be redone but all other data should be preserved. I'd suppose this is the most ideal method?
 
Theoretical coding (not sure if it'll work):

Users are asked to uninstall the XF1 version from the add-on list, after uploading a file patch to prevent table/column drops so data isn't lost.

Install functions have;
Code:
    public function installStep1()
    {
        if ($this->isXf1Installed()) return;

/* stuff here */
    }

The if ($this->isXf1Installed()) return; line prevents install steps being ran for an "upgrade":

Code:
    protected function isXf1Installed()
    {
        if ($this->schemaManager()->tableExists('xf1_table_name')) {
            return true;
        } else {
            return false;
        }
    }

Then a simple install step like so:
Code:
    /**
     * Upgrading
     */
    public function installStep7()
    {
        if ($this->isXf1Installed()) {
            $this->upgrade3000070Step1();
            $this->upgrade3000070Step2();
            $this->upgrade3000070Step3();

            $this->app->jobManager()->enqueueUnique(
                'permissionRebuild',
                'XF:PermissionRebuild',
                [],
                false
            );
        }
    }

Any problems with this logic?
 
Since I changed IDs I'm guessing there's going to be a bunch of scrap left over, e.g. old phrase names, permissions, perhaps even option groups, if I do the normal XF1->XF2 upgrade step. I'm *guessing* (since I haven't done it yet) that all of this is going to need to be dropped. Is there an easy way to clean up all of that?

Since all of your old phrases, permissions, options, etc are associated with the add-on they should be removed since there isn't anything with the same ID in the xf2 version. For the most part it behaves just like a "normal" xf add-on update
 
Since all of your old phrases, permissions, options, etc are associated with the add-on they should be removed since there isn't anything with the same ID in the xf2 version. For the most part it behaves just like a "normal" xf add-on update
Thank you! I was vastly overcomplicated it, it seems. The upgrader as normal works pretty well.

Well thought out design.
 
Back
Top Bottom