Пример #1
0
 /**
  * @return self
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #2
0
 /**
  * @return string
  */
 protected function getMemoryLimit()
 {
     if (ilRuntime::getInstance()->isHHVM()) {
         return $this->getMinMemory() . 'M';
     }
     return ini_get('apc.shm_size');
 }
Пример #3
0
 /**
  * We should enhance the error reporting in future releases (funding required).
  * Idea: We should convert php errors to exceptions and tweak the exception handling (already enhanced by smeyer in former releases)
  * We should implement handlers depending on the context (web/html, soap/xml, rest/json, cli/plain text, ...)
  * 
  * @param int $a_error_code
  * @param string $a_error_message
  * @param string $a_error_file
  * @param int $a_error_line
  * @return mixed The error handler must return FALSE to populate
  */
 public function handleRuntimeErrors($a_error_code, $a_error_message, $a_error_file, $a_error_line)
 {
     // #15641 - the silence operator should suppress the error completely
     if (error_reporting() === 0) {
         return;
     }
     $backtrace_array = $this->formatBacktraceArray(debug_backtrace());
     $error_code = $this->translateErrorCode($a_error_code);
     if (ilRuntime::getInstance()->shouldLogErrors()) {
         error_log($error_code . ': ' . $a_error_message . ' in ' . $a_error_file . ' on line ' . $a_error_line . PHP_EOL . implode(PHP_EOL, $backtrace_array));
     }
     if (ilRuntime::getInstance()->shouldDisplayErrors()) {
         print '<br /><b>' . $error_code . '</b>: ' . $a_error_message . ' in <b>' . $a_error_file . '</b> on line <b>' . $a_error_line . '</b><br/>' . implode('<br />', $backtrace_array);
     }
     return true;
 }
Пример #4
0
 /**
  * We should enhance the error reporting in future releases (funding required).
  * Idea: We should convert php errors to exceptions and tweak the exception handling (already enhanced by smeyer in former releases)
  * We should implement handlers depending on the context (web/html, soap/xml, rest/json, cli/plain text, ...)
  * 
  * @param int $a_error_code
  * @param string $a_error_message
  * @param string $a_error_file
  * @param int $a_error_line
  * @return mixed The error handler must return FALSE to populate
  */
 public function handleRuntimeErrors($a_error_code, $a_error_message, $a_error_file, $a_error_line)
 {
     $backtrace_array = $this->formatBacktraceArray(debug_backtrace());
     $error_code = $this->translateErrorCode($a_error_code);
     if (ilRuntime::getInstance()->shouldLogErrors()) {
         error_log($error_code . ': ' . $a_error_message . ' in ' . $a_error_file . ' on line ' . $a_error_line . PHP_EOL . implode(PHP_EOL, $backtrace_array));
     }
     if (ilRuntime::getInstance()->shouldDisplayErrors()) {
         print '<br /><b>' . $error_code . '</b>: ' . $a_error_message . ' in <b>' . $a_error_file . '</b> on line <b>' . $a_error_line . '</b><br/>' . implode('<br />', $backtrace_array);
     }
     return true;
 }