Linux dpw.dpwebtech.com 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64
Apache
: 192.232.243.69 | : 3.149.214.28
54 Domain
7.3.33
dpclient
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
dpclient /
public_html /
analytics /
core /
[ HOME SHELL ]
Name
Size
Permission
Action
API
[ DIR ]
drwxr-xr-x
Access
[ DIR ]
drwxr-xr-x
Application
[ DIR ]
drwxr-xr-x
Archive
[ DIR ]
drwxr-xr-x
ArchiveProcessor
[ DIR ]
drwxr-xr-x
Archiver
[ DIR ]
drwxr-xr-x
AssetManager
[ DIR ]
drwxr-xr-x
Auth
[ DIR ]
drwxr-xr-x
Category
[ DIR ]
drwxr-xr-x
Changes
[ DIR ]
drwxr-xr-x
CliMulti
[ DIR ]
drwxr-xr-x
Columns
[ DIR ]
drwxr-xr-x
Concurrency
[ DIR ]
drwxr-xr-x
Config
[ DIR ]
drwxr-xr-x
Container
[ DIR ]
drwxr-xr-x
CronArchive
[ DIR ]
drwxr-xr-x
DataAccess
[ DIR ]
drwxr-xr-x
DataFiles
[ DIR ]
drwxr-xr-x
DataTable
[ DIR ]
drwxr-xr-x
Db
[ DIR ]
drwxr-xr-x
DeviceDetector
[ DIR ]
drwxr-xr-x
Email
[ DIR ]
drwxr-xr-x
Exception
[ DIR ]
drwxr-xr-x
Http
[ DIR ]
drwxr-xr-x
Intl
[ DIR ]
drwxr-xr-x
Mail
[ DIR ]
drwxr-xr-x
Measurable
[ DIR ]
drwxr-xr-x
Menu
[ DIR ]
drwxr-xr-x
Metrics
[ DIR ]
drwxr-xr-x
Notification
[ DIR ]
drwxr-xr-x
Period
[ DIR ]
drwxr-xr-x
Plugin
[ DIR ]
drwxr-xr-x
ProfessionalServices
[ DIR ]
drwxr-xr-x
Report
[ DIR ]
drwxr-xr-x
ReportRenderer
[ DIR ]
drwxr-xr-x
Scheduler
[ DIR ]
drwxr-xr-x
Segment
[ DIR ]
drwxr-xr-x
Session
[ DIR ]
drwxr-xr-x
Settings
[ DIR ]
drwxr-xr-x
Tracker
[ DIR ]
drwxr-xr-x
Translation
[ DIR ]
drwxr-xr-x
UpdateCheck
[ DIR ]
drwxr-xr-x
Updater
[ DIR ]
drwxr-xr-x
Updates
[ DIR ]
drwxr-xr-x
Validators
[ DIR ]
drwxr-xr-x
View
[ DIR ]
drwxr-xr-x
ViewDataTable
[ DIR ]
drwxr-xr-x
Visualization
[ DIR ]
drwxr-xr-x
Widget
[ DIR ]
drwxr-xr-x
.htaccess
545
B
-rw-r--r--
Access.php
24.89
KB
-rw-r--r--
Archive.php
35.4
KB
-rw-r--r--
ArchiveProcessor.php
26.97
KB
-rw-r--r--
AssetManager.php
15.48
KB
-rw-r--r--
Auth.php
4.03
KB
-rw-r--r--
AuthResult.php
2.13
KB
-rw-r--r--
BaseFactory.php
1.77
KB
-rw-r--r--
Cache.php
3.51
KB
-rw-r--r--
CacheId.php
2.53
KB
-rw-r--r--
CliMulti.php
14.98
KB
-rw-r--r--
Common.php
39.79
KB
-rw-r--r--
Config.php
14.69
KB
-rw-r--r--
Console.php
10.09
KB
-rw-r--r--
Context.php
3.42
KB
-rw-r--r--
Cookie.php
15.12
KB
-rw-r--r--
CronArchive.php
50.69
KB
-rw-r--r--
DataArray.php
17.97
KB
-rw-r--r--
DataTable.php
69.61
KB
-rw-r--r--
Date.php
35.04
KB
-rw-r--r--
Db.php
29.43
KB
-rw-r--r--
DbHelper.php
10.84
KB
-rw-r--r--
Development.php
6.67
KB
-rw-r--r--
ErrorHandler.php
7.55
KB
-rw-r--r--
EventDispatcher.php
6.79
KB
-rw-r--r--
ExceptionHandler.php
7.06
KB
-rw-r--r--
FileIntegrity.php
15.8
KB
-rw-r--r--
Filechecks.php
8.79
KB
-rw-r--r--
Filesystem.php
18.74
KB
-rw-r--r--
FrontController.php
29.31
KB
-rw-r--r--
Http.php
44.42
KB
-rw-r--r--
IP.php
5.08
KB
-rw-r--r--
Log.php
8.14
KB
-rw-r--r--
LogDeleter.php
3.81
KB
-rw-r--r--
Mail.php
9.32
KB
-rw-r--r--
Metrics.php
20.76
KB
-rw-r--r--
NoAccessException.php
398
B
-rw-r--r--
Nonce.php
8.25
KB
-rw-r--r--
Notification.php
5.72
KB
-rw-r--r--
NumberFormatter.php
10
KB
-rw-r--r--
Option.php
8.25
KB
-rw-r--r--
Period.php
13.52
KB
-rw-r--r--
Piwik.php
27.95
KB
-rw-r--r--
Plugin.php
21.52
KB
-rw-r--r--
Profiler.php
13.32
KB
-rw-r--r--
ProxyHeaders.php
2.16
KB
-rw-r--r--
ProxyHttp.php
11.94
KB
-rw-r--r--
QuickForm2.php
3.94
KB
-rw-r--r--
RankingQuery.php
13.06
KB
-rw-r--r--
ReportRenderer.php
8.59
KB
-rw-r--r--
Segment.php
24.24
KB
-rw-r--r--
Sequence.php
3.11
KB
-rw-r--r--
Session.php
8.04
KB
-rw-r--r--
SettingsPiwik.php
18.07
KB
-rw-r--r--
SettingsServer.php
7.58
KB
-rw-r--r--
Singleton.php
1.46
KB
-rw-r--r--
Site.php
17.86
KB
-rw-r--r--
SiteContentDetector.php
14.22
KB
-rw-r--r--
SupportedBrowser.php
2.25
KB
-rw-r--r--
TCPDF.php
1.87
KB
-rw-r--r--
Theme.php
4.93
KB
-rw-r--r--
Timer.php
2.57
KB
-rw-r--r--
Tracker.php
11.79
KB
-rw-r--r--
Twig.php
19.74
KB
-rw-r--r--
Unzip.php
1.28
KB
-rw-r--r--
UpdateCheck.php
3.34
KB
-rw-r--r--
Updater.php
25.08
KB
-rw-r--r--
UpdaterErrorException.php
304
B
-rw-r--r--
Updates.php
3.86
KB
-rw-r--r--
Url.php
25.67
KB
-rw-r--r--
UrlHelper.php
11.24
KB
-rw-r--r--
Version.php
806
B
-rw-r--r--
View.php
18.2
KB
-rw-r--r--
bootstrap.php
2.03
KB
-rw-r--r--
dispatch.php
928
B
-rw-r--r--
testMinimumPhpVersion.php
10.82
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : Profiler.php
<?php /** * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * */ namespace Piwik; use Exception; use XHProfRuns_Default; /** * Class Profiler helps with measuring memory, and profiling the database. * To enable set in your config.ini.php * [Debug] * enable_sql_profiler = 1 * * [log] * log_writers[] = file * log_level=debug * */ class Profiler { /** * Whether xhprof has been setup or not. * * @var bool */ private static $isXhprofSetup = false; /** * Returns memory usage * * @return string */ public static function getMemoryUsage() { $memory = false; if (function_exists('xdebug_memory_usage')) { $memory = xdebug_memory_usage(); } elseif (function_exists('memory_get_usage')) { $memory = memory_get_usage(); } if ($memory === false) { return "Memory usage function not found."; } $usage = number_format(round($memory / 1024 / 1024, 2), 2); return "$usage Mb"; } /** * Outputs SQL Profiling reports from Zend * * @throws \Exception */ public static function displayDbProfileReport() { $profiler = Db::get()->getProfiler(); if (!$profiler->getEnabled()) { // To display the profiler you should enable enable_sql_profiler on your config/config.ini.php file return; } $infoIndexedByQuery = array(); foreach ($profiler->getQueryProfiles() as $query) { if (isset($infoIndexedByQuery[$query->getQuery()])) { $existing = $infoIndexedByQuery[$query->getQuery()]; } else { $existing = array('count' => 0, 'sumTimeMs' => 0); } $new = array('count' => $existing['count'] + 1, 'sumTimeMs' => $existing['count'] + $query->getElapsedSecs() * 1000); $infoIndexedByQuery[$query->getQuery()] = $new; } uasort($infoIndexedByQuery, 'self::sortTimeDesc'); $str = '<hr /><strong>SQL Profiler</strong><hr /><strong>Summary</strong><br/>'; $totalTime = $profiler->getTotalElapsedSecs(); $queryCount = $profiler->getTotalNumQueries(); $longestTime = 0; $longestQuery = null; foreach ($profiler->getQueryProfiles() as $query) { if ($query->getElapsedSecs() > $longestTime) { $longestTime = $query->getElapsedSecs(); $longestQuery = $query->getQuery(); } } $str .= 'Executed ' . $queryCount . ' queries in ' . round($totalTime, 3) . ' seconds'; $str .= '(Average query length: ' . round($totalTime / $queryCount, 3) . ' seconds)'; $str .= '<br />Queries per second: ' . round($queryCount / $totalTime, 1); $str .= '<br />Longest query length: ' . round($longestTime, 3) . " seconds (<code>$longestQuery</code>)"; Log::debug($str); self::getSqlProfilingQueryBreakdownOutput($infoIndexedByQuery); } private static function maxSumMsFirst($a, $b) { if ($a['sum_time_ms'] == $b['sum_time_ms']) { return 0; } return ($a['sum_time_ms'] < $b['sum_time_ms']) ? -1 : 1; } private static function sortTimeDesc($a, $b) { if ($a['sumTimeMs'] == $b['sumTimeMs']) { return 0; } return ($a['sumTimeMs'] < $b['sumTimeMs']) ? -1 : 1; } /** * Print profiling report for the tracker * * @param \Piwik\Db $db Tracker database object (or null) */ public static function displayDbTrackerProfile($db = null) { if (is_null($db)) { $db = Tracker::getDatabase(); } $tableName = Common::prefixTable('log_profiling'); $all = $db->fetchAll('SELECT * FROM ' . $tableName); if ($all === false) { return; } uasort($all, 'self::maxSumMsFirst'); $infoIndexedByQuery = array(); foreach ($all as $infoQuery) { $query = $infoQuery['query']; $count = $infoQuery['count']; $sum_time_ms = $infoQuery['sum_time_ms']; $infoIndexedByQuery[$query] = array('count' => $count, 'sumTimeMs' => $sum_time_ms); } self::getSqlProfilingQueryBreakdownOutput($infoIndexedByQuery); } /** * Print number of queries and elapsed time */ public static function printQueryCount() { $totalTime = self::getDbElapsedSecs(); $queryCount = Profiler::getQueryCount(); if ($queryCount > 0) { Log::debug(sprintf("Total queries = %d (total sql time = %.2fs)", $queryCount, $totalTime)); } } /** * Get total elapsed time (in seconds) * * @return int elapsed time */ public static function getDbElapsedSecs() { $profiler = Db::get()->getProfiler(); return $profiler->getTotalElapsedSecs(); } /** * Get total number of queries * * @return int number of queries */ public static function getQueryCount() { $profiler = Db::get()->getProfiler(); return $profiler->getTotalNumQueries(); } /** * Log a breakdown by query * * @param array $infoIndexedByQuery */ private static function getSqlProfilingQueryBreakdownOutput($infoIndexedByQuery) { $output = '<hr /><strong>Breakdown by query</strong><br/>'; foreach ($infoIndexedByQuery as $query => $queryInfo) { $timeMs = round($queryInfo['sumTimeMs'], 1); $count = $queryInfo['count']; $avgTimeString = ''; if ($count > 1) { $avgTimeMs = $timeMs / $count; $avgTimeString = " (average = <b>" . round($avgTimeMs, 1) . "ms</b>)"; } $query = preg_replace('/([\t\n\r ]+)/', ' ', $query); $output .= "Executed <b>$count</b> time" . ($count == 1 ? '' : 's') . " in <b>" . $timeMs . "ms</b> $avgTimeString <pre>\t$query</pre>"; } Log::debug($output); } /** * Initializes Profiling via XHProf. * See: https://github.com/piwik/piwik/blob/master/tests/README.xhprof.md */ public static function setupProfilerXHProf($mainRun = false, $setupDuringTracking = false) { if (!$setupDuringTracking && SettingsServer::isTrackerApiRequest() ) { // do not profile Tracker return; } if (self::$isXhprofSetup) { return; } $hasXhprof = function_exists('xhprof_enable'); $hasTidewaysXhprof = function_exists('tideways_xhprof_enable') || function_exists('tideways_enable'); if (!$hasXhprof && !$hasTidewaysXhprof) { $xhProfPath = PIWIK_INCLUDE_PATH . '/vendor/lox/xhprof/extension/modules/xhprof.so'; throw new Exception("Cannot find xhprof_enable, make sure to 1) install xhprof: run 'composer install --dev' and build the extension, and 2) add 'extension=$xhProfPath' to your php.ini."); } $outputDir = ini_get("xhprof.output_dir"); if (!$outputDir && $hasTidewaysXhprof) { $outputDir = sys_get_temp_dir(); } if (empty($outputDir)) { throw new Exception("The profiler output dir is not set. Add 'xhprof.output_dir=...' to your php.ini."); } if (!is_writable($outputDir)) { throw new Exception("The profiler output dir '" . ini_get("xhprof.output_dir") . "' should exist and be writable."); } if (!function_exists('xhprof_error')) { function xhprof_error($out) { echo substr($out, 0, 300) . '...'; } } $currentGitBranch = SettingsPiwik::getCurrentGitBranch(); $profilerNamespace = "piwik"; if ($currentGitBranch != 'master') { $profilerNamespace .= "-" . $currentGitBranch; } if ($mainRun) { self::setProfilingRunIds(array()); } if (function_exists('xhprof_enable')) { xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); } elseif (function_exists('tideways_enable')) { tideways_enable(TIDEWAYS_FLAGS_MEMORY | TIDEWAYS_FLAGS_CPU); } elseif (function_exists('tideways_xhprof_enable')) { tideways_xhprof_enable(TIDEWAYS_XHPROF_FLAGS_MEMORY | TIDEWAYS_XHPROF_FLAGS_CPU); } register_shutdown_function(function () use ($profilerNamespace, $mainRun, $outputDir) { if (function_exists('xhprof_disable')) { $xhprofData = xhprof_disable(); $xhprofRuns = new XHProfRuns_Default(); $runId = $xhprofRuns->save_run($xhprofData, $profilerNamespace); } elseif (function_exists('tideways_xhprof_disable') || function_exists('tideways_disable')) { if (function_exists('tideways_xhprof_disable')) { $xhprofData = tideways_xhprof_disable(); } else { $xhprofData = tideways_disable(); } $runId = uniqid(); file_put_contents( $outputDir . DIRECTORY_SEPARATOR . $runId . '.' . $profilerNamespace . '.xhprof', serialize($xhprofData) ); $meta = array('time' => time(), 'instance' => SettingsPiwik::getPiwikInstanceId()); if (!empty($_GET)) { $meta['get'] = $_GET; } if (!empty($_POST)) { $meta['post'] = $_POST; } file_put_contents( $outputDir . DIRECTORY_SEPARATOR . $runId . '.' . $profilerNamespace . '.meta', serialize($meta) ); } if (empty($runId)) { die('could not write profiler run'); } $runs = Profiler::getProfilingRunIds(); array_unshift($runs, $runId); if ($mainRun) { Profiler::aggregateXhprofRuns($runs, $profilerNamespace, $saveTo = $runId); $baseUrlStored = SettingsPiwik::getPiwikUrl(); $host = Url::getHost(); $out = "\n\n"; $baseUrl = "http://" . $host . "/" . @$_SERVER['REQUEST_URI']; if (strlen($baseUrlStored) > strlen($baseUrl)) { $baseUrl = $baseUrlStored; } $baseUrl = $baseUrlStored . "vendor/lox/xhprof/xhprof_html/?source=$profilerNamespace&run=$runId"; $baseUrl = Common::sanitizeInputValue($baseUrl); $out .= "Profiler report is available at:\n"; $out .= "<a href='$baseUrl'>$baseUrl</a>"; $out .= "\n\n"; if (Development::isEnabled()) { $out .= "WARNING: Development mode is enabled. Many runtime optimizations are not applied in development mode. "; $out .= "Unless you intend to profile Matomo in development mode, your profile may not be accurate."; $out .= "\n\n"; } echo $out; } else { Profiler::setProfilingRunIds($runs); } }); self::$isXhprofSetup = true; } /** * Aggregates xhprof runs w/o normalizing (xhprof_aggregate_runs will always average data which * does not fit Piwik's use case). */ public static function aggregateXhprofRuns($runIds, $profilerNamespace, $saveToRunId) { $xhprofRuns = new XHProfRuns_Default(); $aggregatedData = array(); foreach ($runIds as $runId) { $xhprofRunData = $xhprofRuns->get_run($runId, $profilerNamespace, $description); foreach ($xhprofRunData as $key => $data) { if (empty($aggregatedData[$key])) { $aggregatedData[$key] = $data; } else { // don't aggregate main() metrics since only the super run has the correct metrics for the entire run if ($key == "main()") { continue; } $aggregatedData[$key]["ct"] += $data["ct"]; // call count $aggregatedData[$key]["wt"] += $data["wt"]; // incl. wall time $aggregatedData[$key]["cpu"] += $data["cpu"]; // cpu time $aggregatedData[$key]["mu"] += $data["mu"]; // memory usage $aggregatedData[$key]["pmu"] = max($aggregatedData[$key]["pmu"], $data["pmu"]); // peak mem usage } } } $xhprofRuns->save_run($aggregatedData, $profilerNamespace, $saveToRunId); } public static function setProfilingRunIds($ids) { file_put_contents(self::getPathToXHProfRunIds(), json_encode($ids)); @chmod(self::getPathToXHProfRunIds(), 0777); } public static function getProfilingRunIds() { $runIds = file_get_contents(self::getPathToXHProfRunIds()); $array = json_decode($runIds, $assoc = true); if (!is_array($array)) { $array = array(); } return $array; } /** * @return string */ private static function getPathToXHProfRunIds() { return PIWIK_INCLUDE_PATH . '/tmp/cache/tests-xhprof-runs'; } }
Close