Skip to content

Commit

Permalink
update optional update script ecom3 to trim orphaned orders to last 7…
Browse files Browse the repository at this point in the history
… days since system now auto-trims to last 30 days
  • Loading branch information
dleffler committed Mar 30, 2017
1 parent 6dfd692 commit 65ca0ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions external/ExtPrograms.csv
Expand Up @@ -31,8 +31,8 @@ Font-Awesome,4.7.0,fortawesome.github.com/Font-Awesome,4.7.0,
Adminer,4.3.0,www.adminer.org,4.3.0,"customized plugins: tinymce, edit-textarea & edit-calendar"
SimpleAjaxUploader,2.6.2,github.com/LPology/Simple-Ajax-Uploader,2.6.2,also converted to yui module 2.5.3
normalize.css,6.0.0,necolas.github.com/normalize.css/,6.0.0,auto included in bootstrap 3
MediaElement.js,3.2.4,mediaelementjs.com/,4.0.2,
MediaElement plugins,1.2.3,github.com/johndyer/mediaelement-plugins,2.0.1,
MediaElement.js,4.0.2,mediaelementjs.com/,4.0.2,
MediaElement plugins,2.0.1,github.com/johndyer/mediaelement-plugins,2.0.1,
Facebook PHP SDK3,3.2.3,github.com/facebook/facebook-php-sdk,5.4.4,
Facebook PHP SDK4,4.0.23,github.com/facebook/facebook-php-sdk-v4,5.4.4,
Respond,1.4.2,github.com/scottjehl/Respond,1.4.2,IE6-8 shim
Expand Down
6 changes: 3 additions & 3 deletions install/upgrades/update_ecom3.php
Expand Up @@ -39,7 +39,7 @@ static function name() { return "Prune abandoned cart records"; }
* generic description of upgrade script
* @return string
*/
function description() { return "An orders table record is added as the shopping cart for each site visitor which can make it huge. This script prunes abandoned orders older than 60 days from the orders table and associated orphan records from other ecommerce tables."; }
function description() { return "An orders table record is added as the shopping cart for each site visitor which can make it huge. This script prunes abandoned orders older than 7 days from the orders table and associated orphan records from other ecommerce tables."; }

/**
* additional test(s) to see if upgrade script should be run
Expand All @@ -59,8 +59,8 @@ function upgrade() {
global $db;

// purchased == 0 or invoice_id == 0 on unsubmitted orders
$orders_count = $db->countObjectsBySql("SELECT COUNT(*) as c FROM `".$db->prefix."orders` WHERE `invoice_id` = '0' AND `edited_at` < UNIX_TIMESTAMP(now()) - 2592000 AND `sessionticket_ticket` NOT IN (SELECT `ticket` FROM `".$db->prefix."sessionticket`)");
$db->delete("orders","`invoice_id` = '0' AND `edited_at` < UNIX_TIMESTAMP(now()) - 2592000 AND `sessionticket_ticket` NOT IN (SELECT `ticket` FROM `".$db->prefix."sessionticket`)");
$orders_count = $db->countObjectsBySql("SELECT COUNT(*) as c FROM `".$db->prefix."orders` WHERE `invoice_id` = '0' AND `edited_at` < UNIX_TIMESTAMP(now()) - 604800 AND `sessionticket_ticket` NOT IN (SELECT `ticket` FROM `".$db->prefix."sessionticket`)");
$db->delete("orders","`invoice_id` = '0' AND `edited_at` < UNIX_TIMESTAMP(now()) - 604800 AND `sessionticket_ticket` NOT IN (SELECT `ticket` FROM `".$db->prefix."sessionticket`)");
$orderitems_count = $db->countObjectsBySql("SELECT COUNT(*) as c FROM `".$db->prefix."orderitems` WHERE `orders_id` NOT IN (SELECT `id` FROM `".$db->prefix."orders`)");
$db->delete("orderitems","`orders_id` NOT IN (SELECT `id` FROM `".$db->prefix."orders`)");
$shippingmethods_count = $db->countObjectsBySql("SELECT COUNT(*) as c FROM `".$db->prefix."shippingmethods` WHERE `id` NOT IN (SELECT `shippingmethods_id` FROM `".$db->prefix."orders`)");
Expand Down

0 comments on commit 65ca0ff

Please sign in to comment.