Browse Source

Log some basic events

tags/v8.0.0alpha1
Robin Appelman 9 years ago
parent
commit
1e69f5e7ac

+ 10
- 4
lib/base.php View File

@@ -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();

+ 2
- 0
lib/private/app.php View File

@@ -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);
}
}


+ 3
- 0
lib/private/diagnostics/event.php View File

@@ -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;
}
}

+ 4
- 0
lib/private/route/router.php View File

@@ -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');
}

/**

+ 1
- 0
lib/private/server.php View File

@@ -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 {

+ 4
- 0
lib/private/util.php View File

@@ -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;
}


Loading…
Cancel
Save