Log some basic events
This commit is contained in:
parent
6e08014781
commit
1e69f5e7ac
14
lib/base.php
14
lib/base.php
|
@ -454,6 +454,11 @@ class OC {
|
||||||
self::$loader->registerPrefix('Pimple', '3rdparty/Pimple');
|
self::$loader->registerPrefix('Pimple', '3rdparty/Pimple');
|
||||||
spl_autoload_register(array(self::$loader, 'load'));
|
spl_autoload_register(array(self::$loader, 'load'));
|
||||||
|
|
||||||
|
// setup the basic server
|
||||||
|
self::$server = new \OC\Server();
|
||||||
|
self::initPaths();
|
||||||
|
\OC::$server->getEventLogger()->start('boot', 'Initialize');
|
||||||
|
|
||||||
// set some stuff
|
// set some stuff
|
||||||
//ob_start();
|
//ob_start();
|
||||||
error_reporting(E_ALL | E_STRICT);
|
error_reporting(E_ALL | E_STRICT);
|
||||||
|
@ -469,7 +474,6 @@ class OC {
|
||||||
if (get_magic_quotes_gpc() == 1) {
|
if (get_magic_quotes_gpc() == 1) {
|
||||||
ini_set('magic_quotes_runtime', 0);
|
ini_set('magic_quotes_runtime', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//try to configure php to enable big file uploads.
|
//try to configure php to enable big file uploads.
|
||||||
//this doesn´t work always depending on the webserver and php configuration.
|
//this doesn´t work always depending on the webserver and php configuration.
|
||||||
//Let´s try to overwrite some defaults anyways
|
//Let´s try to overwrite some defaults anyways
|
||||||
|
@ -485,9 +489,9 @@ class OC {
|
||||||
@ini_set('file_uploads', '50');
|
@ini_set('file_uploads', '50');
|
||||||
|
|
||||||
self::handleAuthHeaders();
|
self::handleAuthHeaders();
|
||||||
self::initPaths();
|
|
||||||
self::registerAutoloaderCache();
|
self::registerAutoloaderCache();
|
||||||
|
|
||||||
|
|
||||||
OC_Util::isSetLocaleWorking();
|
OC_Util::isSetLocaleWorking();
|
||||||
|
|
||||||
// setup 3rdparty autoloader
|
// setup 3rdparty autoloader
|
||||||
|
@ -516,9 +520,8 @@ class OC {
|
||||||
stream_wrapper_register('quota', 'OC\Files\Stream\Quota');
|
stream_wrapper_register('quota', 'OC\Files\Stream\Quota');
|
||||||
stream_wrapper_register('oc', 'OC\Files\Stream\OC');
|
stream_wrapper_register('oc', 'OC\Files\Stream\OC');
|
||||||
|
|
||||||
// setup the basic server
|
|
||||||
self::$server = new \OC\Server();
|
|
||||||
|
|
||||||
|
\OC::$server->getEventLogger()->start('init_session', 'Initialize session');
|
||||||
self::initTemplateEngine();
|
self::initTemplateEngine();
|
||||||
OC_App::loadApps(array('session'));
|
OC_App::loadApps(array('session'));
|
||||||
if (self::$CLI) {
|
if (self::$CLI) {
|
||||||
|
@ -526,6 +529,7 @@ class OC {
|
||||||
} else {
|
} else {
|
||||||
self::initSession();
|
self::initSession();
|
||||||
}
|
}
|
||||||
|
\OC::$server->getEventLogger()->end('init_session');
|
||||||
self::checkConfig();
|
self::checkConfig();
|
||||||
self::checkInstalled();
|
self::checkInstalled();
|
||||||
self::checkSSL();
|
self::checkSSL();
|
||||||
|
@ -612,6 +616,7 @@ class OC {
|
||||||
|
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
\OC::$server->getEventLogger()->end('boot');
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function registerLocalAddressBook() {
|
private static function registerLocalAddressBook() {
|
||||||
|
@ -701,6 +706,7 @@ class OC {
|
||||||
* Handle the request
|
* Handle the request
|
||||||
*/
|
*/
|
||||||
public static function handleRequest() {
|
public static function handleRequest() {
|
||||||
|
\OC::$server->getEventLogger()->start('handle_request', 'Handle request');
|
||||||
// load all the classpaths from the enabled apps so they are available
|
// load all the classpaths from the enabled apps so they are available
|
||||||
// in the routing files of each app
|
// in the routing files of each app
|
||||||
OC::loadAppClassPaths();
|
OC::loadAppClassPaths();
|
||||||
|
|
|
@ -89,6 +89,7 @@ class OC_App {
|
||||||
*/
|
*/
|
||||||
public static function loadApp($app, $checkUpgrade = true) {
|
public static function loadApp($app, $checkUpgrade = true) {
|
||||||
if (is_file(self::getAppPath($app) . '/appinfo/app.php')) {
|
if (is_file(self::getAppPath($app) . '/appinfo/app.php')) {
|
||||||
|
\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
|
||||||
if ($checkUpgrade and self::shouldUpgrade($app)) {
|
if ($checkUpgrade and self::shouldUpgrade($app)) {
|
||||||
throw new \OC\NeedsUpdateException();
|
throw new \OC\NeedsUpdateException();
|
||||||
}
|
}
|
||||||
|
@ -100,6 +101,7 @@ class OC_App {
|
||||||
// enabled for groups
|
// enabled for groups
|
||||||
self::$enabledAppsCache = array();
|
self::$enabledAppsCache = array();
|
||||||
}
|
}
|
||||||
|
\OC::$server->getEventLogger()->end('load_app_' . $app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,9 @@ class Event implements IEvent {
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getDuration() {
|
public function getDuration() {
|
||||||
|
if (!$this->end) {
|
||||||
|
$this->end = microtime(true);
|
||||||
|
}
|
||||||
return $this->end - $this->start;
|
return $this->end - $this->start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,6 +202,7 @@ class Router implements IRouter {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function match($url) {
|
public function match($url) {
|
||||||
|
\OC::$server->getEventLogger()->start('load_routes', 'Load routes');
|
||||||
if (substr($url, 0, 6) === '/apps/') {
|
if (substr($url, 0, 6) === '/apps/') {
|
||||||
// empty string / 'apps' / $app / rest of the route
|
// empty string / 'apps' / $app / rest of the route
|
||||||
list(, , $app,) = explode('/', $url, 4);
|
list(, , $app,) = explode('/', $url, 4);
|
||||||
|
@ -216,6 +217,7 @@ class Router implements IRouter {
|
||||||
} else {
|
} else {
|
||||||
$this->loadRoutes();
|
$this->loadRoutes();
|
||||||
}
|
}
|
||||||
|
\OC::$server->getEventLogger()->end('load_routes');
|
||||||
|
|
||||||
$matcher = new UrlMatcher($this->root, $this->context);
|
$matcher = new UrlMatcher($this->root, $this->context);
|
||||||
try {
|
try {
|
||||||
|
@ -236,6 +238,7 @@ class Router implements IRouter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\OC::$server->getEventLogger()->start('run_route', 'Run route');
|
||||||
if (isset($parameters['action'])) {
|
if (isset($parameters['action'])) {
|
||||||
$action = $parameters['action'];
|
$action = $parameters['action'];
|
||||||
if (!is_callable($action)) {
|
if (!is_callable($action)) {
|
||||||
|
@ -249,6 +252,7 @@ class Router implements IRouter {
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception('no action available');
|
throw new \Exception('no action available');
|
||||||
}
|
}
|
||||||
|
\OC::$server->getEventLogger()->end('run_route');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -225,6 +225,7 @@ class Server extends SimpleContainer implements IServerContainer {
|
||||||
return new HTTPHelper($config);
|
return new HTTPHelper($config);
|
||||||
});
|
});
|
||||||
$this->registerService('EventLogger', function ($c) {
|
$this->registerService('EventLogger', function ($c) {
|
||||||
|
/** @var Server $c */
|
||||||
if (defined('DEBUG') and DEBUG) {
|
if (defined('DEBUG') and DEBUG) {
|
||||||
return new EventLogger();
|
return new EventLogger();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -64,6 +64,8 @@ class OC_Util {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\OC::$server->getEventLogger()->start('setup_fs', 'Setup filesystem');
|
||||||
|
|
||||||
// If we are not forced to load a specific user we load the one that is logged in
|
// If we are not forced to load a specific user we load the one that is logged in
|
||||||
if ($user == "" && OC_User::isLoggedIn()) {
|
if ($user == "" && OC_User::isLoggedIn()) {
|
||||||
$user = OC_User::getUser();
|
$user = OC_User::getUser();
|
||||||
|
@ -88,6 +90,7 @@ class OC_Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user != '' && !OCP\User::userExists($user)) {
|
if ($user != '' && !OCP\User::userExists($user)) {
|
||||||
|
\OC::$server->getEventLogger()->end('setup_fs');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +131,7 @@ class OC_Util {
|
||||||
|
|
||||||
OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
|
OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
|
||||||
}
|
}
|
||||||
|
\OC::$server->getEventLogger()->end('setup_fs');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue