summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-10-03 22:13:55 +0200
committerRobin Appelman <icewind@owncloud.com>2014-10-20 13:38:38 +0200
commit1e69f5e7ac3414f307aac16842655a34a2f3c709 (patch)
treecd6ac10cd7feafe424bd1abd6f3cd0a4e145af0e
parent6e08014781ea0099d7e4466dd48d80af63d8ab69 (diff)
downloadnextcloud-server-1e69f5e7ac3414f307aac16842655a34a2f3c709.tar.gz
nextcloud-server-1e69f5e7ac3414f307aac16842655a34a2f3c709.zip
Log some basic events
-rw-r--r--lib/base.php14
-rw-r--r--lib/private/app.php2
-rw-r--r--lib/private/diagnostics/event.php3
-rw-r--r--lib/private/route/router.php4
-rw-r--r--lib/private/server.php1
-rwxr-xr-xlib/private/util.php4
6 files changed, 24 insertions, 4 deletions
diff --git a/lib/base.php b/lib/base.php
index 0086531e523..1201e46d542 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -454,6 +454,11 @@ class OC {
self::$loader->registerPrefix('Pimple', '3rdparty/Pimple');
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
//ob_start();
error_reporting(E_ALL | E_STRICT);
@@ -469,7 +474,6 @@ class OC {
if (get_magic_quotes_gpc() == 1) {
ini_set('magic_quotes_runtime', 0);
}
-
//try to configure php to enable big file uploads.
//this doesn´t work always depending on the webserver and php configuration.
//Let´s try to overwrite some defaults anyways
@@ -485,9 +489,9 @@ class OC {
@ini_set('file_uploads', '50');
self::handleAuthHeaders();
- self::initPaths();
self::registerAutoloaderCache();
+
OC_Util::isSetLocaleWorking();
// setup 3rdparty autoloader
@@ -516,9 +520,8 @@ class OC {
stream_wrapper_register('quota', 'OC\Files\Stream\Quota');
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();
OC_App::loadApps(array('session'));
if (self::$CLI) {
@@ -526,6 +529,7 @@ class OC {
} else {
self::initSession();
}
+ \OC::$server->getEventLogger()->end('init_session');
self::checkConfig();
self::checkInstalled();
self::checkSSL();
@@ -612,6 +616,7 @@ class OC {
exit();
}
+ \OC::$server->getEventLogger()->end('boot');
}
private static function registerLocalAddressBook() {
@@ -701,6 +706,7 @@ class OC {
* Handle the request
*/
public static function handleRequest() {
+ \OC::$server->getEventLogger()->start('handle_request', 'Handle request');
// load all the classpaths from the enabled apps so they are available
// in the routing files of each app
OC::loadAppClassPaths();
diff --git a/lib/private/app.php b/lib/private/app.php
index a97db7b5e53..8fcffbad950 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -89,6 +89,7 @@ class OC_App {
*/
public static function loadApp($app, $checkUpgrade = true) {
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)) {
throw new \OC\NeedsUpdateException();
}
@@ -100,6 +101,7 @@ class OC_App {
// enabled for groups
self::$enabledAppsCache = array();
}
+ \OC::$server->getEventLogger()->end('load_app_' . $app);
}
}
diff --git a/lib/private/diagnostics/event.php b/lib/private/diagnostics/event.php
index 063c0c49dc2..af5d2ff8840 100644
--- a/lib/private/diagnostics/event.php
+++ b/lib/private/diagnostics/event.php
@@ -81,6 +81,9 @@ class Event implements IEvent {
* @return float
*/
public function getDuration() {
+ if (!$this->end) {
+ $this->end = microtime(true);
+ }
return $this->end - $this->start;
}
}
diff --git a/lib/private/route/router.php b/lib/private/route/router.php
index aa3d05dcb85..fd6d9939184 100644
--- a/lib/private/route/router.php
+++ b/lib/private/route/router.php
@@ -202,6 +202,7 @@ class Router implements IRouter {
* @return void
*/
public function match($url) {
+ \OC::$server->getEventLogger()->start('load_routes', 'Load routes');
if (substr($url, 0, 6) === '/apps/') {
// empty string / 'apps' / $app / rest of the route
list(, , $app,) = explode('/', $url, 4);
@@ -216,6 +217,7 @@ class Router implements IRouter {
} else {
$this->loadRoutes();
}
+ \OC::$server->getEventLogger()->end('load_routes');
$matcher = new UrlMatcher($this->root, $this->context);
try {
@@ -236,6 +238,7 @@ class Router implements IRouter {
}
}
+ \OC::$server->getEventLogger()->start('run_route', 'Run route');
if (isset($parameters['action'])) {
$action = $parameters['action'];
if (!is_callable($action)) {
@@ -249,6 +252,7 @@ class Router implements IRouter {
} else {
throw new \Exception('no action available');
}
+ \OC::$server->getEventLogger()->end('run_route');
}
/**
diff --git a/lib/private/server.php b/lib/private/server.php
index 7b8ed2cabf5..496c26e2503 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -225,6 +225,7 @@ class Server extends SimpleContainer implements IServerContainer {
return new HTTPHelper($config);
});
$this->registerService('EventLogger', function ($c) {
+ /** @var Server $c */
if (defined('DEBUG') and DEBUG) {
return new EventLogger();
} else {
diff --git a/lib/private/util.php b/lib/private/util.php
index d6515872c5a..858138f58fe 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -64,6 +64,8 @@ class OC_Util {
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 ($user == "" && OC_User::isLoggedIn()) {
$user = OC_User::getUser();
@@ -88,6 +90,7 @@ class OC_Util {
}
if ($user != '' && !OCP\User::userExists($user)) {
+ \OC::$server->getEventLogger()->end('setup_fs');
return false;
}
@@ -128,6 +131,7 @@ class OC_Util {
OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
}
+ \OC::$server->getEventLogger()->end('setup_fs');
return true;
}