Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Database Optimizer


70 replies to this topic

#61 mamegaga

  • Community Member
  • 16 posts
  • Real Name:davy

Posted 06 February 2012, 13:01

In admin/include/database_table.php

I put this:

define('TABLE_DATABASE_OPTIMIZER', 'database_optimizer');

The line 44 corresponds to this:

$mainDate = mysql_fetch_array($query, MYSQL_ASSOC);

Correct ?

thank you

#62 Jack_mcs

  • Community Member
  • 24,453 posts
  • Real Name:Jack
  • Gender:Male

Posted 06 February 2012, 13:48

View Postmamegaga, on 06 February 2012, 13:01, said:

In admin/include/database_table.php

I put this:

define('TABLE_DATABASE_OPTIMIZER', 'database_optimizer');

The line 44 corresponds to this:

$mainDate = mysql_fetch_array($query, MYSQL_ASSOC);

Correct ?
Yes, that is one of the instructions. There are others. I don't understand the reference to the mysql command though.

#63 mamegaga

  • Community Member
  • 16 posts
  • Real Name:davy

Posted 06 February 2012, 13:54

Yes, I followed the instructions in the installation, but I do not understand this error.

it's a shame. :unsure:

#64 Jack_mcs

  • Community Member
  • 24,453 posts
  • Real Name:Jack
  • Gender:Male

Posted 06 February 2012, 15:19

View Postmamegaga, on 06 February 2012, 13:54, said:

Yes, I followed the instructions in the installation, but I do not understand this error.

it's a shame. :unsure:
You could try posting the actual failure.

#65 Jack_mcs

  • Community Member
  • 24,453 posts
  • Real Name:Jack
  • Gender:Male

Posted 01 April 2012, 16:55

A new version has been uploaded with these changes:

- Fixed code for the User Tracking deletion
- Fixed the code for the customer basket deletions

#66 Jack_mcs

  • Community Member
  • 24,453 posts
  • Real Name:Jack
  • Gender:Male

Posted 01 April 2012, 16:59

View Postmr_absinthe, on 03 February 2012, 14:40, said:

No, this time it removed the correct items. It even works with the echo commented out - it is removing correct items, no idea why it didn't work yesterday. The calculation output is not showing the removed items however:

Store database has been optimized.
Customers tables were trimmed.
Initial size was 49209454.
Final, optimized, size is 49209454.

With about five years data the initial figure should be higher I guess.
In testing the last version I think I saw this symptom. The problem is that even though the data is deleted from the database, mysql won't update the table size without being told to do so. The code tells it to do so when the "Optimize Database Period" setting is ran. But if one setting is set to 3 days while that setting is set to 4, the table sizes won't be updated at that time. In a latter run, the settings time will have passed and the size are then corrected. So I suggest setting that option to the lowest value of all of the settings. I think that will fix this timing problem.

#67 mr_absinthe

  • Community Member
  • 411 posts
  • Real Name:Alex
  • Location:London, UK

Posted 02 April 2012, 10:32

Thank you for the update. It seems correct, I made sure that Optimise Database Period has the lowest value of 7 days and this was the result:

Store database has been optimized.
Customers tables were trimmed.
Credit Card data was removed from the orders table.
Sessions table was trimmed.
Database was analyzed.
Database was optimized.
Initial size was 48287307.
Final, optimized, size is 47349379.

Also I believe that you should add the following to the Update_1.1_to_1.2.txt file:
2) Upload the admin\database_optimizer.php
otherwise the version number will be incorrect.
Absinthe Original Liquor Store

#68 Jack_mcs

  • Community Member
  • 24,453 posts
  • Real Name:Jack
  • Gender:Male

Posted 02 April 2012, 13:49

View Postmr_absinthe, on 02 April 2012, 10:32, said:

Also I believe that you should add the following to the Update_1.1_to_1.2.txt file:
2) Upload the admin\database_optimizer.php
otherwise the version number will be incorrect.
Thanks for poining that out. I will correct the next release.

#69 modem2.0

  • Community Member
  • 43 posts
  • Real Name:Modem 2.0

Posted 02 April 2012, 14:50

Hi Jack

I have just installed your contribution and while I was looking at the code to try to understand how the settings where being applied, I believe I found a bug on the remove CC data. You have this:
	    /********************** REMOVE CC DATA FROM ORDERS TABLE *************************/
	    if (! empty($config['orders_cc']) && $config['orders_cc'] < $daysLastRan) {
		    $dateOrder = date("Y-m-d", time() - ($config['customers'] * 86400));
		    $wasUpdated = true;
		    $message .= "\r\n" . 'Credit Card data was removed from the orders table.';
		    mysql_query("update " . TABLE_ORDERS . " set cc_number = '' where date_purchased > '" . $dateOrder . "'");	 //clear the sessions table of entries greater than one month old
		    mysql_query("update database_optimizer set orders_last_update = now()");
	    }

but I believe it should be:
	    /********************** REMOVE CC DATA FROM ORDERS TABLE *************************/
	    if (! empty($config['orders_cc']) && $config['orders_cc'] < $daysLastRan) {
		    $dateOrder = date("Y-m-d", time() - ($config['orders_cc'] * 86400));
		    $wasUpdated = true;
		    $message .= "\r\n" . 'Credit Card data was removed from the orders table.';
		    mysql_query("update " . TABLE_ORDERS . " set cc_number = '' where date_purchased > '" . $dateOrder . "'");	 //clear the sessions table of entries greater than one month old
		    mysql_query("update database_optimizer set orders_last_update = now()");
	    }
(notice the change in
$dateOrder = date("Y-m-d", time() - ($config['orders_cc'] * 86400));
Am I right?

Regards

#70 Jack_mcs

  • Community Member
  • 24,453 posts
  • Real Name:Jack
  • Gender:Male

Posted 02 April 2012, 15:50

View Postmodem2.0, on 02 April 2012, 14:50, said:

Hi Jack

I have just installed your contribution and while I was looking at the code to try to understand how the settings where being applied, I believe I found a bug on the remove CC data. You have this:
Am I right?
Yes, you are. Thank you for pointing out the mistake.

#71 modem2.0

  • Community Member
  • 43 posts
  • Real Name:Modem 2.0

Posted 02 April 2012, 16:07

Thanks Jack. I updated my copy!

Quick edit: for the distracted people :), the change has to be done in admin/includes/modules/database_optimizer_common.php

Edited by modem2.0, 02 April 2012, 16:09.