Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted (edited)
This is built upon the excelent Queries Debug contribution by Chemo. I've just enhanced it a bit to provide better and less intrusive monitoring. With this package, you can let the monitor run for any length of time without it interrupting your web site. Then, in admin, you can view the logs it produces at your leisure. More information is available in the admin than in the original package and it is easier to see, at a glance, problems that might exist. Edited by Jack_mcs

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Posted

Hi Jack, support thread in admin (language file) shows: http://www.oscommerce.com/forums/topic/351109-compare-my-price/. I'll test and let you know more later.

Thanks for letting me know. It is a catch-22 situation - can't list the support thread without uploqding the contribution and change update the contribution without having a support thread. I'll change it in the next version though.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

  • 4 years later...
Posted

I have:

 

Warning: array_slice() expects parameter 1 to be array, null given in E:\Xampp54\htdocs\grosshandel\includes\performance.php on line 60

 

In Oscommerce 2.3.4 under PHP 5.4

 

Who can help?

Posted

 

if (($temp = array_slice($debug['QUERIES'], $longestItem, 1, true))) {

 

This is line 60

 

all lines

 

 

<?php

/*

  $Id: performance.php,v 1.6 2004/12/08 21:08:00 admin Exp $

  orig : performance.php,v 1.5 2004/11/21 00:04:53 Chemo Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2003 osCommerce

 

  Released under the GNU General Public License

*/

 

  if (DISPLAY_PAGE_PARSE_TIME == 'true' || STORE_QUERIES_IN_LOG == 'true') {

    $time_start = explode(' ', PAGE_PARSE_START_TIME);

    $time_end = explode(' ', microtime());

    $parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3);

  }

    

  if (DISPLAY_PAGE_PARSE_TIME == 'true') {

    echo '<div align="center"><span class="smallText">Current Parse Time: <b>' . $parse_time . ' s</b> with <b>' . sizeof($debug['QUERIES']) . ' queries</b></span></div>';

    if (DISPLAY_QUERIES == 'true') {

      echo '<b>QUERY DEBUG:</b> ';

      print_array($debug);

      echo '<hr>';

      echo '<b>SESSION:</b> ';

      print_array($_SESSION);

      echo '<hr>';

      echo '<b>COOKIE:</b> ';

      print_array($_COOKIE);

      echo '<b>POST:</b> ';

      print_array($_POST);

      echo '<hr>';

      echo '<b>GET:</b> ';

      print_array($_GET);

    } # END if request

  }

 

  if (STORE_QUERIES_IN_LOG == 'true') {

      $file = 'includes/query_store_' . date("Y-m-d") . '_' . tep_session_id();  

      $mode = (file_exists($file) ? 'a' : 'w');

       

      if (($fp = fopen($file , $mode))) {    

          $longestItem = 0;

          $mostTime = 0;

          $table = '';

 

          $fout = fwrite($fp, 'Results for Page: ' . $_SERVER['REQUEST_URI'] . "\r\n\r\n");

          

          /**************** Save the data to a file *****************/

          for ($i = 0; $i < count($debug['QUERIES']); ++$i) {

              $fout = fwrite($fp, '[' . $i . '] ' . $debug['TIME'][$i] . ' => ' . $debug['QUERIES'][$i] . "\r\n");

              if ($debug['TIME'][$i] > $mostTime) {

                  $mostTime = $debug['TIME'][$i];

                  $longestItem = $i;

              }

          }    

 

          /**************** Determine the table that is the slowest to respond *****************/

          if (($temp = array_slice($debug['QUERIES'], $longestItem, 1, true))) {

              if (($pos = strpos(strtolower($temp[$longestItem]), "from")) !== FALSE) {

                  $table = substr($temp[$longestItem], $pos + 5); //points to first word after from

                  if (($pos = strpos($table, ' ')) !== FALSE) {

                      $table = substr($table, 0, $pos);

                  }

              }

 

              if (! tep_not_null($table)) {

                  $table = $temp[$longestItem];   //the table could not be determined so show the whole string

              }

          }

          

          $fout = fwrite($fp, "\r\n\r\n" . 'Most time was used by item ' . $longestItem . ' at ' . $mostTime . ' seconds using table ' . $table . ".\r\n");

          $fout = fwrite($fp, 'Parse Time ' . $parse_time . "\r\n");

          $fout = fwrite($fp, 'Referer ' . $_SERVER['HTTP_REFERER'] . "\r\n");

          $fout = fwrite($fp, 'Spider ' . (($spider_flag) ? 'Yes' : 'No') . "\r\n");

          $fout = fwrite($fp, 'Customer ID ' . ((isset($_SESSION['customer_id'])) ? $customer_id : 'Not logged in') . "\r\n");

          

          fclose($fp);  

      }

      else

          error_log('Failed to open ' . $file, 3, STORE_PAGE_PARSE_TIME_LOG);

  }  

       

  unset($debug);

?>

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...