IMPORTANT: This procedure has only been tested against a clean installation of v1.5.2. It is strongly recommend this process be undertaken on a test server with mirrored data rather than on a live production system and it is likely there will be points of difference in just about every system attempting to upgrade. Absolutely no guarantee is given. Please share your experience to help improve this document.
NOTE: You will need to have shell-access for this procedure.
For major changes such as upgrades, it is a good idea to schedule a block of time when member usage will be at a minimum and when there will be no need to run critical functions for a while. That way, if something goes terribly wrong, you will have time to return your system to a stable configuration.
Read through the entire upgrade process before beginning and be certain you know how to get back to your original setup – either by restoring a backup or by undoing the upgrade process itself. If you are not certain, find someone more experienced to help.
The procedure you are about to perform will automatically modify many of your files and if it "goes bad" it can leave you with a mess. Be sure you have a working backup of your website and database contents. Many web hosting companies provide this service.
Download the v1.5.2 to v1.5.3 patch and save it to your web server.
Open a shell account to your web server and change to the directory immediately above DOCUMENT_ROOT.
IMPORTANT: The patch assumes default configuration with a DOCUMENT_ROOT called
public_html and all local food coop files in public_html/shop/. If that is not true for your setup, you
must move the files – or copies of the files – into that configuration prior to running the patch.
Execute the following command to apply the patch to your system:
patch -Np1 < patchfile
where patchfile is the path/name to the patch file you saved in step 1.
Running the patch command will output a list of files as they are patched. Ideally, most of them will be silently patched
with a message like
patching file public_html/shop/producers/template.php
but occasionally – particularly with the .htaccess files – it will complain, which is normal. If
you are asked for some kind of confirmation about whether/how to patch individual files, it is probably a sign that the patch
is going poorly and should be aborted. There are too many possibilities to discuss in detail here.
There are no changes to the database in moving from v1.5.2 to v1.5.3. Database changes will be reserved for the next major upgrade to 1.6.x.
As soon as the func/gen_invoice.php function is changed to the updated version in this release, all customer
invoices will reflect the changes (including bug-fixes). Consequently, any prior invoice that is regenerated will very likely have
new and different totals than before, leaving customers with unexpected debits and credits.
If you can enforce that no prior invoices prior to the update will be adjusted or unfinalized after the update, you will not have any troubles. Otherwise if you need to provide the legacy format, the following modifications are one possible solution that can be put into place to allow for keeping the legacy format for the cycles to which it was initially used. This is not recommended, because it will make future updates more difficult, but is provided here as a possibly necessary step:
gen_invoice.php function (the code that generates the customer invoice) for all fifteen cycles. Beginning with
delivery_id=16 you will want to use the new customer inovice generation function from this release. One way to
handle this is to copy the existing gen_invoice.php to a new file that is keyed to the delivery_ids for which it
was used; in this case gen_invoice-1-15.php. Similarly, the new gen_invoice function (from this distribution)
will need to be renamed to gen_invoice-16-.php. Using this naming method, you can maintain a new invoice for
every delivery_id if necessary, although it is a manual process.
gen_invoice.php function to call the appropriate version
gen_invoice.php file to accomplish this goal. Note that this is
an example only and is based upon the example criteria above. You will need to adjust the values to match your current order
cycle setup.
<?php
if (! $delivery_id) { $delivery_id = $current_delivery_id; }
if ($delivery_id >= 0 && $delivery_id <= 15) { include "gen_invoice-1-15.php"; }
elseif ($delivery_id >= 15 ) { include "gen_invoice-16.php"; }
?><form action="customer_invoice.php" method="post">To these lines:
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<input type="hidden" name="member_id" value="'.$member_id.'">
<input type="hidden" name="basket_id" value="'.$basket_id.'">
<input type="hidden" name="delivery_id" value="'.$delivery_id.'">
<input type="hidden" name="use" value="adminfinalize">
Finally, modify the customer_invoice_template.php and tax_functions.php files in the
local_food_include directory to suit your preferences. Also check the config_foodcoop.php file to set
the new values that were introduced with this release. Set the values for $htmldoc_paging, $random_calc, $membership_taxed, and
$coop_fee_taxed.