===========================================================================
 STORE UPGRADE KIT
===========================================================================

Four small PHP files. Nothing to install, no server settings to change, no
large uploads. Works on any cPanel host.

   upgrade-path.php      what version is this store on, what does it need
   make-package.php      run on Q2 — builds the package the others need
   sync-upgrade.php      run on a store — compares with Q2 and applies
   database-upgrade.php  database only, if you want it done separately


===========================================================================
 THE SHORT VERSION
===========================================================================

ONCE, ON Q2 INDUSTRIES
   1. File Manager -> put make-package.php beside Q2's index.php
   2. Open  https://q2store.com/make-package.php  -> Build -> Download
      You get q2-package.zip (a few MB)
   3. Delete make-package.php and the ZIP from Q2

FOR EACH OTHER STORE
   1. File Manager -> put BOTH of these in the store folder,
      beside its index.php:
            sync-upgrade.php
            q2-package.zip
   2. Open  https://thatstore.com/sync-upgrade.php
   3. Read the comparison -> Apply
   4. Delete both files

That is the whole process. About two minutes per store.

Use File Manager, not the browser upload box. Most shared hosts cap uploads
at 2 MB, which is smaller than the package.


===========================================================================
 WHAT EACH FILE IS FOR
===========================================================================

upgrade-path.php   READ-ONLY. Changes nothing. Drop it in a store, open it,
                   and it tells you which release that store is on and what
                   it still needs:

                       this store is on 1.1 · latest 1.3
                       path: 1.1 -> 1.2 -> 1.3

                   It works this out by inspecting the store, not by trusting
                   a stored number — so a store where an earlier attempt
                   stopped halfway is reported honestly as PARTIAL, not
                   guessed at.

                   Useful first pass across all 50: five seconds each, and
                   you end up with an inventory of who needs what.

make-package.php   Run on Q2. Captures EVERY code file plus Q2's database
                   structure. Not a fixed list of changes — whatever you have
                   added to Q2, whenever you added it, goes in.

                   Left out: uploads/, ui/assets/, ui/images/, ui/videos/,
                   vendor/, config.ini. None of that belongs to another
                   store, and leaving it out is what keeps the package a few
                   MB instead of 500.

sync-upgrade.php   Run on a target store. Compares every file and every
                   database column against the package and shows:

                       12 new files          Q2 has them, this store does not
                        8 files that differ  contents are not the same
                      191 already identical  nothing to do
                       21 columns to add     missing from this database

                   Expand either list to see exactly which files before
                   deciding. Nothing happens until you press Apply.

database-upgrade.php  Only if you want the database done on its own. There is
                   no SQL export or import: the store's config.ini already
                   holds the database name, user and password, so the tool
                   connects the same way the website does and adds the
                   missing columns directly.


===========================================================================
 WHAT IS AND IS NOT TOUCHED
===========================================================================

REPLACED    Files where Q2 differs. The old copy is saved first to
            _upgrade-backup-<timestamp>/ inside that store.

ADDED       Files Q2 has and the store does not.

LEFT ALONE  Files the store has that Q2 does not. Not deleted, not flagged.

NEVER       config.ini, .htaccess, .user.ini, uploads/. Every store keeps its
            own database credentials and its own media.

DATABASE    Columns and tables are only ever ADDED. Nothing is dropped or
            renamed, and no product, category, order or setting row is
            modified.


===========================================================================
 ONE THING TO READ BEFORE CLICKING APPLY
===========================================================================

Open the "files that differ" list. Q2's version wins for those, so a change
made ONLY on that store would be replaced. The old copies always go to the
backup folder, but it is better to know first.

If a store has a difference you want to keep, make the same change on Q2 and
rebuild the package. Q2 then stays the single source of truth and every store
matches it.


===========================================================================
 AFTER EACH STORE
===========================================================================

   - Delete sync-upgrade.php and q2-package.zip from that store
   - Check the storefront and /admin load
   - Sign in as  inway / Inway@2026  and change that password
   - Enable the GD extension: cPanel > Select PHP Version > Extensions > gd
     (without it, Image Settings cannot resize anything)
   - Delete the _upgrade-backup-* folder once you are satisfied


===========================================================================
 IF SOMETHING GOES WRONG
===========================================================================

Rolling back a store: copy the contents of its _upgrade-backup-<timestamp>/
folder back over the store. The database changes are additive only, so
restoring the files alone returns it to its previous behaviour.

"No store found"          the file is not in the store folder. It must sit
                          beside index.php, ui/ and config.ini.

Package not detected      the ZIP must be in the same folder and have
                          "package" in its filename.

Database cannot connect   the error is shown in full. If the storefront
                          works, config.ini is right and the usual cause is
                          the database user never being granted access:
                          cPanel > MySQL Databases > Add User To Database.
