Skip to content

Instantly share code, notes, and snippets.

@Fi1osof
Last active December 17, 2015 12:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Fi1osof/328469331b5258ff009a to your computer and use it in GitHub Desktop.
Save Fi1osof/328469331b5258ff009a to your computer and use it in GitHub Desktop.
Вызов процессоров
<?php
print '<pre>';
ini_set('display_errors', 1);
$modx->switchContext('web');
$modx->setLogLevel(3);
$modx->setLogTarget('HTML');
$namespace = 'modxsite';
if(!$response = $modx->runProcessor('web/getdata',
array(
), array(
'processors_path' => $modx->getObject('modNamespace', $namespace)->getCorePath().'processors/',
))){
print "Не удалось выполнить процессор";
return;
}
$memory = round(memory_get_usage(true)/1024/1024, 4).' Mb';
print "<div>Memory: {$memory}</div>";
$totalTime= (microtime(true) - $modx->startTime);
$queryTime= $modx->queryTime;
$queryTime= sprintf("%2.4f s", $queryTime);
$queries= isset ($modx->executedQueries) ? $modx->executedQueries : 0;
$totalTime= sprintf("%2.4f s", $totalTime);
$phpTime= $totalTime - $queryTime;
$phpTime= sprintf("%2.4f s", $phpTime);
print "<div>TotalTime: {$totalTime}</div>";
// $objects = $response->getObject();
// foreach($objects as $object){
// }
print_r($response->getResponse());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment