private function execute($action) { if (!method_exists($action, 'getFile')) { return '[could not execute this action]'; } if (file_exists($action->getFile())) { Sumo\Logger::info('Executing ' . $action->getClass() . '->' . $action->getMethod()); require_once $action->getFile(); $class = $action->getClass(); try { if (!class_exists($class)) { throw new \Exception('File not found for class ' . $class); } $controller = new $class($this->registry); } catch (\Exception $e) { trigger_error('Could not execute ' . $class . ', something is wrong.', E_USER_ERROR); } if (is_callable(array($controller, $action->getMethod()))) { $return = call_user_func_array(array($controller, $action->getMethod()), $action->getArgs()); } else { trigger_error('Could not execute ' . $action->getClass() . '->' . $action->getMethod(), E_USER_ERROR); $return = $this->error; $this->error = ''; } } else { $file = $action->getFile(); if (empty($file)) { Sumo\Logger::warning('$action does not have method $action->getFile(): ' . print_r($action, true)); } Sumo\Logger::warning('Could not load file ' . $action->getFile() . ' to call ' . $action->getClass() . '->' . $action->getMethod()); $return = $this->error; $this->error = ''; } return $return; }
public function query($sql) { $this->count++; $this->tmpQueries[] = $sql; Sumo\Logger::warning('[OLD DB] Warning, query through the old DB interface. Switch to the new Database class'); return $this->driver->query($sql); }
public function get($key) { $this->count++; $value = isset($this->data[$key]) ? $this->data[$key] : $key; $this->keys[] = array($key => $value); Sumo\Logger::warning('[OLD LANGUAGE] ' . $key . ' requested'); return $value; }
function error_handler($errno, $errstr, $errfile, $errline) { switch ($errno) { case E_NOTICE: case E_USER_NOTICE: return Sumo\Logger::warning($errstr . ' in ' . $errfile . ' on line ' . $errline); break; case E_WARNING: case E_USER_WARNING: return Sumo\Logger::warning($errstr . ' in ' . $errfile . ' on line ' . $errline); break; case E_ERROR: case E_USER_ERROR: return Sumo\Logger::error($errstr . ' in ' . $errfile . ' on line ' . $errline); break; default: return Sumo\Logger::warning($errstr . ' in ' . $errfile . ' on line ' . $errline); break; } }