Assembla home | Assembla project page
 

Changeset 146

Show
Ignore:
Timestamp:
03/09/08 09:58:28 (9 months ago)
Author:
Slynderdale
Message:

Added a small check to see if the memory functions existed when the debug, mem commands is called. This is to prevent the bot from crashing on older versions of PHP 5 that don't have the memory functions compiled in.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Phergie/Plugin/Debug.php

    r103 r146  
    3939    public function onDoMem() 
    4040    { 
    41         $text = 'current : '.number_format(memory_get_usage() / 1024).'KB / peak : '.number_format(memory_get_peak_usage() / 1024).'KB'; 
    42         $this->doPrivmsg($this->event->getSource(), $text); 
     41        if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) { 
     42            $text = 'current : '.number_format(memory_get_usage() / 1024).'KB / peak : '.number_format(memory_get_peak_usage() / 1024).'KB'; 
     43            $this->doPrivmsg($this->event->getSource(), $text); 
     44        } 
    4345    } 
    4446