diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-04-19 19:29:47 +0200 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-04-19 19:29:47 +0200 |
commit | e2bff0b35d7856ec23a4279b50261faebedd655f (patch) | |
tree | 093938b8a6b368abc62c27aaaab404a15357409d /lib/private/diagnostics | |
parent | b441d3dcb32ef2cf2aa0e088ed320996b67e8fd5 (diff) | |
download | nextcloud-server-e2bff0b35d7856ec23a4279b50261faebedd655f.tar.gz nextcloud-server-e2bff0b35d7856ec23a4279b50261faebedd655f.zip |
Move \OC\Diagnostics to PSR-4
Diffstat (limited to 'lib/private/diagnostics')
-rw-r--r-- | lib/private/diagnostics/event.php | 103 | ||||
-rw-r--r-- | lib/private/diagnostics/eventlogger.php | 55 | ||||
-rw-r--r-- | lib/private/diagnostics/nulleventlogger.php | 57 | ||||
-rw-r--r-- | lib/private/diagnostics/nullquerylogger.php | 45 | ||||
-rw-r--r-- | lib/private/diagnostics/query.php | 71 | ||||
-rw-r--r-- | lib/private/diagnostics/querylogger.php | 61 |
6 files changed, 0 insertions, 392 deletions
diff --git a/lib/private/diagnostics/event.php b/lib/private/diagnostics/event.php deleted file mode 100644 index 8b5bb7e3bd8..00000000000 --- a/lib/private/diagnostics/event.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php -/** - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin Appelman <icewind@owncloud.com> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\Diagnostics; - -use OCP\Diagnostics\IEvent; - -class Event implements IEvent { - /** - * @var string - */ - protected $id; - - /** - * @var float - */ - protected $start; - - /** - * @var float - */ - protected $end; - - /** - * @var string - */ - protected $description; - - /** - * @param string $id - * @param string $description - * @param float $start - */ - public function __construct($id, $description, $start) { - $this->id = $id; - $this->description = $description; - $this->start = $start; - } - - /** - * @param float $time - */ - public function end($time) { - $this->end = $time; - } - - /** - * @return float - */ - public function getStart() { - return $this->start; - } - - /** - * @return string - */ - public function getId() { - return $this->id; - } - - /** - * @return string - */ - public function getDescription() { - return $this->description; - } - - /** - * @return float - */ - public function getEnd() { - return $this->end; - } - - /** - * @return float - */ - public function getDuration() { - if (!$this->end) { - $this->end = microtime(true); - } - return $this->end - $this->start; - } -} diff --git a/lib/private/diagnostics/eventlogger.php b/lib/private/diagnostics/eventlogger.php deleted file mode 100644 index 3d909ce79cd..00000000000 --- a/lib/private/diagnostics/eventlogger.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin Appelman <icewind@owncloud.com> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\Diagnostics; - -use OCP\Diagnostics\IEventLogger; - -class EventLogger implements IEventLogger { - /** - * @var \OC\Diagnostics\Event[] - */ - private $events = array(); - - public function start($id, $description) { - $this->events[$id] = new Event($id, $description, microtime(true)); - } - - public function end($id) { - if (isset($this->events[$id])) { - $timing = $this->events[$id]; - $timing->end(microtime(true)); - } - } - - public function log($id, $description, $start, $end) { - $this->events[$id] = new Event($id, $description, $start); - $this->events[$id]->end($end); - } - - /** - * @return \OCP\Diagnostics\IEvent[] - */ - public function getEvents() { - return $this->events; - } -} diff --git a/lib/private/diagnostics/nulleventlogger.php b/lib/private/diagnostics/nulleventlogger.php deleted file mode 100644 index 1b5e7af3ac9..00000000000 --- a/lib/private/diagnostics/nulleventlogger.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin Appelman <icewind@owncloud.com> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\Diagnostics; - -use OCP\Diagnostics\IEventLogger; - -/** - * Dummy event logger that doesn't actually log anything - */ -class NullEventLogger implements IEventLogger { - /** - * Mark the start of an event - * - * @param $id - * @param $description - */ - public function start($id, $description) { - } - - /** - * Mark the end of an event - * - * @param $id - */ - public function end($id) { - } - - public function log($id, $description, $start, $end) { - } - - /** - * @return \OCP\Diagnostics\IEvent[] - */ - public function getEvents() { - return array(); - } -} diff --git a/lib/private/diagnostics/nullquerylogger.php b/lib/private/diagnostics/nullquerylogger.php deleted file mode 100644 index 98ddef2e783..00000000000 --- a/lib/private/diagnostics/nullquerylogger.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php -/** - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin Appelman <icewind@owncloud.com> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\Diagnostics; - -use OCP\Diagnostics\IQueryLogger; - -class NullQueryLogger implements IQueryLogger { - /** - * @param string $sql - * @param array $params - * @param array $types - */ - public function startQuery($sql, array $params = null, array $types = null) { - } - - public function stopQuery() { - } - - /** - * @return \OCP\Diagnostics\IQuery[] - */ - public function getQueries() { - return array(); - } -} diff --git a/lib/private/diagnostics/query.php b/lib/private/diagnostics/query.php deleted file mode 100644 index 567bc83ed4b..00000000000 --- a/lib/private/diagnostics/query.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -/** - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin Appelman <icewind@owncloud.com> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\Diagnostics; - -use OCP\Diagnostics\IQuery; - -class Query implements IQuery { - private $sql; - - private $params; - - private $start; - - private $end; - - /** - * @param string $sql - * @param array $params - * @param int $start - */ - public function __construct($sql, $params, $start) { - $this->sql = $sql; - $this->params = $params; - $this->start = $start; - } - - public function end($time) { - $this->end = $time; - } - - /** - * @return array - */ - public function getParams() { - return $this->params; - } - - /** - * @return string - */ - public function getSql() { - return $this->sql; - } - - /** - * @return int - */ - public function getDuration() { - return $this->end - $this->start; - } -} diff --git a/lib/private/diagnostics/querylogger.php b/lib/private/diagnostics/querylogger.php deleted file mode 100644 index 66a65b71d04..00000000000 --- a/lib/private/diagnostics/querylogger.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin Appelman <icewind@owncloud.com> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\Diagnostics; - -use OCP\Diagnostics\IQueryLogger; - -class QueryLogger implements IQueryLogger { - /** - * @var \OC\Diagnostics\Query - */ - protected $activeQuery; - - /** - * @var \OC\Diagnostics\Query[] - */ - protected $queries = array(); - - /** - * @param string $sql - * @param array $params - * @param array $types - */ - public function startQuery($sql, array $params = null, array $types = null) { - $this->activeQuery = new Query($sql, $params, microtime(true)); - } - - public function stopQuery() { - if ($this->activeQuery) { - $this->activeQuery->end(microtime(true)); - $this->queries[] = $this->activeQuery; - $this->activeQuery = null; - } - } - - /** - * @return Query[] - */ - public function getQueries() { - return $this->queries; - } -} |