function IsAvailable() { if ($this->_checked) { return $this->_available; } $this->_checked = true; if ($path = $this->getFullPath()) { //Include class file if it not already included if (!in_array($path, get_required_files())) { require_once $path; } //Check that needly class exists if (!class_exists(str_replace('.', '_', $this->Package) . '_' . $this->Class)) { WriteLog("Class " . $this->Class . " from Package " . $this->Package . " not found", LOGFILE_LOGIC); return $this->_available = false; } else { $class = str_replace('.', '_', $this->Package) . '_' . $this->Class; $this->_methods = array_flip(get_class_methods($class)); unset($this->_methods['xobject']); unset($this->_methods['show']); unset($this->_methods[strtolower($class)]); } } else { WriteLog("File for Class " . $this->Class . " from Package " . $this->Package . " not found", LOGFILE_LOGIC); return $this->_available = false; } return $this->_available = true; }
public static function end(string $test) { $getMemoryUsage = memory_get_usage(); $test = $test . "_end"; Properties::$tests[$test] = microtime(); Properties::$usedtests[$test] = get_required_files(); Properties::$memtests[$test] = $getMemoryUsage; }
public function test_should_load_required_files() { $base_path = realpath(__DIR__) . '/mocks'; $this->autoload->add_prefix('Melody\\Mocks\\', $base_path . '/src'); $this->autoload->load_class('Melody\\Mocks\\Classic'); $this->autoload->load_class('Melody\\Mocks\\Contemporary'); $files = get_required_files(); $this->assertContains($base_path . '/src/classic.php', $files); $this->assertContains($base_path . '/src/contemporary.php', $files); }
function isImport($path = '') { if (!is_string($path)) { return false; } if (in_array(realpath(suffix($path, '.php')), get_required_files())) { return true; } else { return false; } }
function java_get_base() { $ar = get_required_files(); $arLen = sizeof($ar); if ($arLen > 0) { $thiz = $ar[$arLen - 1]; return dirname($thiz); } else { return "java"; } }
public static function count(string $result = NULL) : int { if (empty($result)) { return count(get_required_files()); } $resend = $result . "_end"; $restart = $result . "_start"; if (!isset(Properties::$usedtests[$restart])) { throw new BenchmarkException('[Benchmark::usedFileCount(\'' . $result . '\')] -> Parameter is not a valid test start!'); } if (!isset(Properties::$usedtests[$resend])) { throw new BenchmarkException('[Benchmark::usedFileCount(\'' . $result . '\')] -> Parameter is not a valid test end!'); } return count(Properties::$usedtests[$resend]) - count(Properties::$usedtests[$restart]); }
function &getEntity($class, $key, $params = array(), $mode = READ_MODE, $package = DEFAULT_PACKAGE) { // ñìîòðèì ðåæèì ñêà÷èâàíèÿ (ìîæåò èñïîëüçîâàòüñÿ ïîòîì äëÿ ïðàâ) $mode = intval($mode); if (!$mode) { WriteLog('Invalid mode of entity ' . $class . ' in mode ' . $mode, LOGFILE_ENITY); return; } // èùåì ñóùíîñòü â êåøå (äëÿ óáûñòðåíèÿ è îáñåïå÷åíèÿ ïîâòîðíîãî ÷òåíèÿ) $hash = md5($package . $class . $mode . serialize($params) . serialize($key)); if (!empty($this->_entity[$hash])) { return $this->_entity[$hash]['entity']; } else { //Try build new entity if (empty($class)) { return null; } if (empty($package)) { $package = DEFAULT_PACKAGE; } $class .= "Entity"; $full_path = PACKAGES_DIR . '/' . str_replace('.', '/', $package) . '/' . $class . '.class.php'; if (file_exists($full_path)) { if (!in_array($full_path, get_required_files())) { require_once $full_path; } //Check that needly class exists if (!class_exists(str_replace('.', '_', $package) . '_' . $class)) { class_log('XEntityCache', 'Class ' . $class . ' not found ', ENTITYCACHE_LOG); return null; } else { $full_class = str_replace('.', '_', $package) . '_' . $class; $methods = array_flip(get_class_methods($full_class)); //If called class not derived from entity return null if (!in_array('xentity', $methods)) { return null; } } return $this->_createEntity($full_class, $key, $params, $mode, $hash); } else { $sth = null; return $sth; } } }
function dropdown($selected_value) { $ajax = ajax(); switch ($selected_value) { case 'classes': $data = get_declared_classes(); $ajax->label_4 = "PHP Classes Loaded"; break; case 'files': $data = get_required_files(); $ajax->label_4 = "PHP Files"; break; case 'ext': $data = get_loaded_extensions(); $ajax->label_4 = "PHP Extensions"; } $data += array('classes' => 'PHP Clases', 'files' => 'PHP Files Loaded', 'ext' => 'PHP Extensions Loaded'); //propagate data to dropdown $ajax->select('dropdown', $data); }
/** * 功能: 日志记录 * $message */ function errorLog($message, $type, $file = '') { if (empty($file)) { //如果没有将文件传输过来,则使用调用此方法的文件名 $fileInfo = get_required_files(); $fileInfo = explode('.', basename($fileInfo[0])); array_pop($fileInfo); $file = implode('.', $fileInfo); } $path = WEB_PATH . 'log/' . $file . '/' . date('Y-m/d/'); //$root.'/log/'; if (!is_dir($path)) { $mkdir = mkdir($path, 0777, true); if (!$mkdir) { exit('不能建立日志文件'); } } $status = error_log(date("Y-m-d H:i:s") . " {$message}\r\n", 3, $path . CURRENT_DATE . '_' . $type . '.log'); return $status; }
/** * PHP_Debug default output function, first we finish the processes and * then a render object is created and its render method is invoked * * The renderer used is set with the options, all the possible renderer * are in the directory Debug/Renderer/*.php * (not the files ending by '_Config.php') * * @since V2.0.0 - 13 apr 2006 * @see Debug_Renderer */ public function render() { // Finish process $this->endTime = PHP_Debug::getMicroTimeNow(); // Render output if we are allowed to if ($this->isAllowed()) { // Create render object and invoke its render function $renderer = PHP_Debug_Renderer::factory($this, $this->options); // Get required files here to have event all Debug classes $this->requiredFiles = get_required_files(); // Call rendering return $renderer->render(); } }
* If you remove this no one will be able to see responses unless from an XHR request, Flash Request, etc. * * If you are not interested in viewing the response on the browser or you unexpectly see the response, * you may remove this setting by removing the line below. * * @constant AJAX_VIEW */ define('AJAX_VIEW', 1); /** * * Allows to include 'ajax.php' as well as 'ajaxfw.php' back to back compatibility. * @var unknown_type */ $included_files = get_included_files(); if (!$included_files) { $included_files = get_required_files(); } if ($included_files && count($included_files) > 1) { return require_once 'ajaxfw.php'; } /** * *End Cjax configuration* */ /* *--------------------------------------------------------------- * APPLICATION ENVIRONMENT *--------------------------------------------------------------- * * You can load different configurations depending on your * current environment. Setting the environment also influences * things like logging and error reporting.
/** * 框架本身的自动加载 * @param string $class */ public static function autoload($class) { $classFile = BASIC_ROOT . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; if (is_file($classFile) && !in_array($classFile, get_required_files())) { require $classFile; } }
// Try to require a non-existant file //$inc = require_once('XXPositions.inc'); //var_dump($inc); echo "----------------------------------\n"; // require an existing file $inc = (require 'Positions.inc'); //$inc = require_once('Positions.inc'); var_dump($inc); // require an existing file. It doesn't matter if the first require was with/without // _once; subsequent use of require_once returns true $inc = (require_once 'Positions.inc'); var_dump($inc); var_dump(Positions\LEFT); var_dump(Positions\TOP); echo "----------------------------------\n"; ///* // require Point.inc to get at the Point class type $inc = (require 'Point.inc'); var_dump($inc); $p1 = new Point(10, 20); //*/ echo "----------------------------------\n"; // require Circle.inc to get at the Circle class type, which in turn uses the Point type $inc = (require 'Circle.inc'); var_dump($inc); $p2 = new Point(5, 6); $c1 = new Circle(9, 7, 2.4); echo "----------------------------------\n"; // get the set of required files print_r(get_required_files());
public function usedFileCount($result = '') { if (!is_string($result)) { return Error::set('Error', 'stringParameter', 'result'); } if (empty($result)) { return get_required_files(); } $resend = $result . "_end"; $restart = $result . "_start"; if (isset($this->usedtests[$resend]) && isset($this->usedtests[$restart])) { return count($this->usedtests[$resend]) - count($this->usedtests[$restart]); } }
function isImport(string $path) : bool { return !in_array(realpath(suffix($path, '.php')), get_required_files()) ? false : true; }
protected function _templateWizard() { $requiredFiles = implode('[+++]', get_required_files()); preg_match('/\\w+\\.wizard\\.php/', $requiredFiles, $match); $exceptionData['file'] = VIEWS_DIR . ($match[0] ?? strtolower(CURRENT_FUNCTION) . '.wizard.php'); $exceptionData['message'] = lang('Error', 'templateWizard'); return (object) $exceptionData; }
/** * xapp java style dot and wildcard class/package loader imports/requires class or packages from the default xapp base * path or paths passed as conf value defined by XAPP_CONF_IMPORT_PATH. the import $parameter can be: * * 1) absolute file like /var/www/app/foo.php - includes file directly * 2) relative file like /app/foo.php - tries to include file from known xapp paths * 3) java style class xapp.Xapp.Event - imports class * 4) java style package xapp.Xapp.* - imports packages * * this function can not import: * 3) absolute dirs like /var/www/app - not supported! * 4) relative dirs like /app - not supported! * * the function store all imported java style classes and packages into a global package cache to check if package has been * already imported and therefore does not execute any import code. the function does not throw any error but simply tries * to require the $import param with triggering php error when $import value require fails. * * The import function does have hidden additional parameters when using java style dotmnotation wildcard loading. the * hidden function arguments/parameters are: * 1 = either a custom base path from where to load the package or an array with regex exclude rules/patterns * 2 = an array with regex exclude rules if 1 is a custom base path. call like: * * <code> * xapp_import('xapp.Package.*, '/custom/path/'); * xapp_import('xapp.Package.*, array('/^regex1$/', '/regex2/i')); * xapp_import('xapp.Package.*, '/custom/path/', array('/^regex1$/', '/regex2/i')); * </code> * * NOTE: the regex syntax for the the path/name exclusion argument must be a valid and complete regex pattern! Also the * exclude argument MUST be an array! * * @param string $import expects a a valid import value as defined above * @return boolean */ function xapp_import($import) { $path = null; //if is php includable file with relative or absolute path with DS separator or . dot separator include directly trying to resolve absolute path if (preg_match('/(.*)\\.(php|php5|phps|phtml|inc)$/i', $import, $m)) { if (stripos($import, DS) === false) { $import = implode(DS, explode('.', trim($m[1], '.* '))) . '.' . trim($m[2], '.* '); } if (in_array($import, get_required_files())) { return; } if (is_file($import)) { require_once $import; return true; } $class = xapp_path(XAPP_PATH_XAPP) . trim($import, DS); if (in_array($class, get_required_files())) { return; } if (is_file($class)) { require_once $class; return true; } $class = xapp_path(XAPP_PATH_BASE) . trim($import, DS); if (in_array($class, get_required_files())) { return; } if (is_file($class)) { require_once $class; return true; } $class = xapp_path(XAPP_PATH_ROOT) . trim($import, DS); if (in_array($class, get_required_files())) { return; } if (is_file($class)) { require_once $class; return true; } require_once $import; //is java style import . dot notation with wildcard } else { $ns = substr($import, 0, strpos($import, '.')); $pk = substr(substr($import, strlen($ns) + 1), 0, strpos(substr($import, strlen($ns) + 1), '.')); //if ns is not xapp check if composer autoloader and package to import exists if (stripos($ns, 'xapp') === false) { $ns = substr($import, 0, strpos($import, '.')); $pk = substr(substr($import, strlen($ns) + 1), 0, strpos(substr($import, strlen($ns) + 1), '.')); //if ns is not xapp check if composer autoloader and package to import exists if (stripos($ns, 'xapp') === false) { $searchPath = xapp_path(XAPP_PATH_BASE) . 'xapp' . DIRECTORY_SEPARATOR; if (!in_array(xapp_path(XAPP_PATH_BASE) . 'autoload.php', get_required_files())) { /** * @Core-Hack */ if (is_file($searchPath . 'autoload.php')) { require_once $searchPath . 'autoload.php'; } else { trigger_error("unable to include composer vendor autoloader - please make sure composer is installed", E_USER_ERROR); } /* if(is_file(xapp_path(XAPP_PATH_BASE) . 'autoload.php')) { require_once xapp_path(XAPP_PATH_BASE) . 'autoload.php'; }else{ trigger_error("unable to include composer vendor autoloader - please make sure composer is installed", E_USER_ERROR); } */ } if (!is_dir($searchPath . str_replace('.', DS, substr($import, 0, strpos($import, '.', strpos($import, '.') + 1))))) { trigger_error("composer vendor package: {$import} does not exist - please make sure package is installed", E_USER_ERROR); } return true; } /* if(!in_array(xapp_path(XAPP_PATH_BASE) . 'autoload.php', get_required_files())) { if(is_file(xapp_path(XAPP_PATH_BASE) . 'autoload.php')) { require_once xapp_path(XAPP_PATH_BASE) . 'autoload.php'; }else{ trigger_error("unable to include composer vendor autoloader - please make sure composer is installed", E_USER_ERROR); } } if(!is_dir(xapp_path(XAPP_PATH_BASE) . str_replace('.', DS, substr($import, 0, strpos($import, '.', (strpos($import, '.') + 1)))))) { trigger_error("composer vendor package: $import does not exist - please make sure package is installed", E_USER_ERROR); } return true; */ } //if ns is xapp and xapp autoloader is loaded do nothing but only if package is not Ext if (stripos($ns, 'xapp') !== false && xapped('Xapp_Autoloader') && Xapp_Autoloader::hasInstance()) { if (stripos($pk, 'Ext') === false) { return true; } } //init global import array if (!isset($GLOBALS['XAPP_IMPORTS'])) { $GLOBALS['XAPP_IMPORTS'] = array(); } //if called class or package is already imported do nothing if (in_array($import, $GLOBALS['XAPP_IMPORTS'])) { return true; } //import single class if (substr($import, -1) !== '*') { $base = explode('.', trim($import, '. ')); $class = array_pop($base); if ($base[0] === 'xapp' && SOURCE_SEPARATOR !== '') { if (!array_key_exists(1, $base)) { array_push($base, $class, SOURCE_SEPARATOR); } else { $base = array_merge(array_slice($base, 0, 2), array(SOURCE_SEPARATOR), array_slice($base, 2)); } } $base = implode(DS, $base); $path = xapp_path(XAPP_PATH_BASE); $path = array_diff(array_merge((array) $path, (array) xapp_conf(XAPP_CONF_IMPORT_PATH)), array(''), array(1)); foreach ($path as $p) { $p = rtrim($p, DS) . DS; if (is_file($p . $base . DS . $class . XAPP_EXT)) { array_push($GLOBALS['XAPP_IMPORTS'], $import); require_once $p . $base . DS . $class . XAPP_EXT; return true; } if (is_file($p . $base . DS . $class . DS . $class . XAPP_EXT)) { array_push($GLOBALS['XAPP_IMPORTS'], $import); require_once $p . $base . DS . $class . DS . $class . XAPP_EXT; return true; } } trigger_error("unable to import: {$import} - class not found", E_USER_ERROR); //import package } else { $regex = null; if (func_num_args() >= 2) { $args = func_get_args(); if (array_key_exists(1, $args) && array_key_exists(2, $args) && !empty($args[2])) { $path = (array) $args[1]; $regex = (array) $args[2]; } else { if (is_array($args[1])) { $regex = $args[1]; } else { if (strpos($args[1], DS) !== false) { $path = (array) $args[1]; } } } } if ($path === null) { $path = xapp_path(XAPP_PATH_BASE); $path = array_diff(array_merge((array) $path, (array) xapp_conf(XAPP_CONF_IMPORT_PATH)), array(''), array(1)); } foreach ($path as $p) { $b = rtrim($p, DS) . DS; $p = $b . implode(DS, explode('.', trim($import, '.*'))) . DS; $found = false; if (($dir = @opendir($p)) !== false) { while (($file = readdir($dir)) !== false) { if ($file === '.' || $file === '..' || stripos($file, '.svn') !== false) { continue; } else { if ($regex !== null) { foreach ($regex as $r) { if ((bool) preg_match(trim($r), $file)) { continue; } } } else { if (is_dir($p . $file)) { xapp_import(trim($import, '.*') . '.' . $file . '.*', $b, $regex); } else { if (strpos($file, XAPP_EXT) !== false) { $i = trim($import, '.*') . '.' . substr($file, 0, strrpos($file, XAPP_EXT)); if (!in_array($i, $GLOBALS['XAPP_IMPORTS'])) { require_once $p . $file; array_push($GLOBALS['XAPP_IMPORTS'], $i); $found = true; } } } } } } if ($found) { break; } } } if (!in_array($import, $GLOBALS['XAPP_IMPORTS'])) { array_push($GLOBALS['XAPP_IMPORTS'], $import); } return true; } } return false; }
* Register auto load */ Zood_Loader::registerAutoload(); //require_once 'Zend/Registry.php'; //require_once 'Zood/Util.php'; //require_once 'Zood/Controller/Front.php'; /** * Set default configuration dir */ //Zood_Loader::loadClass('Zood_Config'); //Zood_Config::addConfigDirectory(ZOODPP_ROOT . '/app' . '/config'); //Access authentication require_once ZOODPP_ROOT . '/app/lib/access/ActionAccessInterceptor.php'; Zood_Controller_Action::addInterceptor(new ActionAccessInterceptor(), 'access'); /** * Get front controller instance, set controller dir and dispatch */ try { Zood_Controller_Front::getInstance()->setBaseUrl()->setControllerDirectory(ZOODPP_APP . '/controllers')->dispatch(); } catch (Exception $e) { Zood_Util::print_r($e->getMessage(), 'Exception!'); } /** * Execution end time * @var Float */ $endTime = microtime(true); Zood_Util::print_r($endTime - $bootTime, 'Full execution time(sec)'); Zood_Util::print_r(memory_get_usage(), 'memory_get_usage'); Zood_Util::print_r($rf = get_required_files(), 'All included files (' . count($rf) . ')'); // End ^ LF ^ UTF-8
public function required() : array { return get_required_files(); }
/** * collects all Info for being displayed by the Toolbar * * @access private * @param \Smarty $oView * @return array $aToolbar containing all Info for toolbar */ private function collectInfo(\Smarty $oView) { $aToolbar = array(); $aToolbar['sPHP'] = phpversion(); $aToolbar['sOS'] = PHP_OS; $aToolbar['sEnv'] = \MVC\Registry::get('MVC_ENV'); $aToolbar['aGet'] = array_map('htmlentities', $_GET); $aToolbar['aPost'] = array_map('htmlentities', $_POST); $aToolbar['aCookie'] = array_map('htmlentities', $_COOKIE); $aToolbar['aRequest'] = array_map('htmlentities', $_REQUEST); $aToolbar['aSession'] = $_SESSION; $aToolbar['aSmartyTemplateVars'] = $oView->getTemplateVars(); $aConstants = get_defined_constants(true); $aToolbar['aConstant'] = $aConstants['user']; $aToolbar['aServer'] = $_SERVER; $aToolbar['oMvcRequestGetWhitelistParams'] = \MVC\Request::getInstance()->getWhitelistParams(); $aToolbar['oMvcRequestGetQueryArray'] = \MVC\Request::getInstance()->getQueryArray(); $aToolbar['aEvent'] = \MVC\Registry::isRegistered('MVC_EVENT') ? \MVC\Registry::get('MVC_EVENT') : array(); $aRequest = \MVC\Request::GETCURRENTREQUEST(); $aToolbar['aRouting'] = array('aRequest' => \MVC\Request::GETCURRENTREQUEST(), 'sModule' => \MVC\Request::getInstance()->getModule(), 'sController' => \MVC\Request::getInstance()->getController(), 'sMethod' => \MVC\Request::getInstance()->getMethod(), 'sArg' => isset($aToolbar['oMvcRequestGetQueryArray']['GET']['a']) ? $aToolbar['oMvcRequestGetQueryArray']['GET']['a'] : '', 'aRoute' => \MVC\Registry::get('MVC_ROUTING_CURRENT'), 'sRoutingJsonBuilder' => \MVC\Registry::get('MVC_ROUTING_JSON_BUILDER'), 'sRoutingHandling' => \MVC\Registry::get('MVC_ROUTING_HANDLING')); $aPolicy = \MVC\Registry::get('MVC_POLICY'); $sController = '\\' . \MVC\Request::getInstance()->getModule() . '\\Controller\\' . \MVC\Request::getInstance()->getController(); $sMethod = \MVC\Request::getInstance()->getMethod(); $aToolbar['aPolicy']['aRule'] = \MVC\Registry::isRegistered('MVC_POLICY') ? \MVC\Registry::get('MVC_POLICY') : array(); $aToolbar['aPolicy']['aApplied'] = isset($aPolicy[$sController][$sMethod]) ? $aPolicy[$sController][$sMethod] : false; $aToolbar['aPolicy']['sAppliedAt'] = isset($aPolicy[$sController][$sMethod]) ? $sController . '::' . $sMethod : false; $sTemplate = file_exists($oView->sTemplate) ? $oView->sTemplate : (file_exists($oView->_joined_template_dir . '/' . $oView->sTemplate) ? $oView->_joined_template_dir . '/' . $oView->sTemplate : false); $aToolbar['sTemplate'] = $sTemplate; $aToolbar['sTemplateContent'] = file_get_contents($aToolbar['sTemplate']); ob_start(); $sTemplate = file_get_contents($oView->sTemplate, true); $oView->renderString($sTemplate); $sRendered = ob_get_contents(); ob_end_clean(); $aToolbar['sRendered'] = $sRendered; $aToolbar['aFilesIncluded'] = get_required_files(); $aToolbar['aMemory'] = array('iRealMemoryUsage' => memory_get_usage(true) / 1024, 'dMemoryUsage' => memory_get_usage() / 1024, 'dMemoryPeakUsage' => memory_get_peak_usage() / 1024); $aToolbar['aRegistry'] = \MVC\Registry::getStorageArray(); $aToolbar['aCache'] = $this->getCaches(); $aToolbar['aError'] = \MVC\Error::getERROR(); $aToolbar['oIds'] = \MVC\Registry::isRegistered('MVC_IDS_IMPACT') ? \MVC\Registry::get('MVC_IDS_IMPACT') : ''; $aToolbar['aIdsConfig'] = \MVC\Registry::isRegistered('MVC_IDS_INIT') ? \MVC\Registry::get('MVC_IDS_INIT') : ''; $aToolbar['aIdsDisposed'] = \MVC\Registry::isRegistered('MVC_IDS_DISPOSED') ? \MVC\Registry::get('MVC_IDS_DISPOSED') : ''; $iMicrotime = microtime(true); $sMicrotime = sprintf("%06d", ($iMicrotime - floor($iMicrotime)) * 1000000); $oDateTime = new \DateTime(date('Y-m-d H:i:s.' . $sMicrotime, $iMicrotime)); $oStart = \MVC\Session::getInstance()->get('startDateTime'); $dDiff = date_format($oDateTime, "s.u") - date_format($oStart, "s.u"); $aToolbar['sConstructionTime'] = round($dDiff, 3); return $aToolbar; }
public function files() { $debug = '<h3 class="emphasize">' . __('Required Files', 'debug-this') . '</h3>'; $debug .= print_r(get_required_files(), true); $debug .= '<h3 class="emphasize">' . __('Included Files', 'debug-this') . '</h3>'; $debug .= print_r(get_included_files(), true); return $debug; }
<?php /* Template Name: albums */ get_header(); ?> <div class="contents"> <?php require 'loop.php'; get_required_files(); get_footer();
<?php // This file is included in the output. require 'test3.inc'; include 'test1.inc'; include_once 'test2.inc'; // This should only be listed once in the output. require 'test3.inc'; require_once 'test4.inc'; function foo($files) { // Zend and HHVM output in different orders; level the field sort($files); foreach ($files as $filename) { $idx = strrpos($filename, "/"); $pre = substr($filename, 0, $idx + 1); $suf = substr($filename, $idx + 1); var_dump($pre === dirname(__FILE__) . "/"); var_dump($suf); } } foo(get_included_files()); foo(get_required_files());
/** * */ public function display($console) { $dispatcher = $console->getDI()->getShared('dispatcher'); $taskName = $dispatcher->getTaskName(); $actionName = $dispatcher->getActionName(); if (!class_exists('\\Cli\\Output')) { fwrite(STDERR, "Unable to find Output class" . PHP_EOL); return; } // Get Memory Usage $curMem = memory_get_usage(FALSE); $curRealMem = memory_get_usage(TRUE); $peakMem = memory_get_peak_usage(FALSE); $peakRealMem = memory_get_peak_usage(TRUE); // Get Time $totalTime = microtime(TRUE) - $_SERVER['REQUEST_TIME']; $startTime = date('m/d/y h:i:s', $_SERVER['REQUEST_TIME']); Output::stdout(""); Output::stdout(Output::COLOR_BLUE . "--------------DEBUG ENABLED---------------------" . Output::COLOR_NONE); Output::stdout(Output::COLOR_BLUE . "+++Overview+++" . Output::COLOR_NONE); Output::stdout("task: {$taskName}"); Output::stdout("action: {$actionName}"); Output::stdout("total time: {$totalTime} start time: {$startTime} end time: " . date('m/d/y h:i:s')); if ($console->isRecording()) { Output::stdout("task id: " . $console->getTaskId()); } Output::stdout("hostname: " . php_uname('n')); Output::stdout("pid: " . getmypid()); if ($console->isSingleInstance()) { Output::stdout("pid file: " . \Cli\Pid::singleton('')->getFileName()); } Output::stdout(""); Output::stdout("current memory: {$curMem} bytes " . round($curMem / 1024, 2) . " kbytes"); Output::stdout("current real memory: {$curRealMem} bytes " . round($curRealMem / 1024, 2) . " kbytes"); Output::stdout("peak memory: {$peakMem} bytes " . round($peakMem / 1024, 2) . " kbytes"); Output::stdout("peak real memory: {$peakRealMem} bytes " . round($peakRealMem / 1024, 2) . " kbytes"); Output::stdout(""); // Print out Commands $commands = Execute::singleton()->getCommands(); if (!empty($commands)) { Output::stdout(Output::COLOR_BLUE . "+++Cli Commands+++" . Output::COLOR_NONE); foreach ($commands as $command) { Output::stdout($command->command); Output::stdout($command->file . "\t" . $command->line . "\t" . ($command->success ? Output::COLOR_GREEN . "Success" . Output::COLOR_NONE : Output::COLOR_RED . "Failed" . Output::COLOR_NONE)); Output::stdout(""); } Output::stdout(""); } // Print out Queries if ($console->getDI()->has('profiler')) { Output::stdout(Output::COLOR_BLUE . "+++Queries+++" . Output::COLOR_NONE); $profiles = $console->getDI()->getShared('profiler')->getProfiles(); if (!empty($profiles)) { foreach ($profiles as $profile) { Output::stdout($profile->getSQLStatement()); Output::stdout("time: " . $profile->getTotalElapsedSeconds()); Output::stdout(""); } Output::stdout(""); } } // Print out Exceptions /*$exceptions = Logger::getInstance()->getAll(); if (!empty($exceptions)) { Output::stdout(Output::COLOR_BLUE . "+++Exceptions+++" . Output::COLOR_NONE); foreach($exceptions as $except) { Output::stdout($except->getMessage()); Output::stdout($except->getCode() . "\t" . $except->getFile() . "\t" . $except->getLine()); Output::stdout(""); } Output::stdout(""); }*/ // Print out all included php files $files = get_required_files(); Output::stdout(Output::COLOR_BLUE . "+++Included Files+++" . Output::COLOR_NONE); foreach ($files as $file) { Output::stdout($file); } Output::stdout(""); }
<?php $load_files = true; $filesIncluded = get_required_files(); // verificar que los archivos necesarios esten incluidos foreach ($filesIncluded as $file_included) { if (preg_match("/conf.php/", $file_included)) { $load_files = false; break; } } $isAjax = 0; // Si no estan incluidos, debemos cargarlos // Esto quiere decir que la peticion es AJAX if ($load_files) { session_start(); $SEGURO = TRUE; require_once '../include/var_global.php'; require_once '../include/conf.php'; require_once '../include/log.php'; require_once '../include/bdatos.php'; require_once '../include/fecha_hora.php'; require_once '../include/HTML.class.php'; require_once '../include/Catalogo.class.php'; require_once '../include/Select.class.php'; require_once '../include/clasesLepra.php'; require_once '../include/clases/controlCalidad.php'; $objHTML = new HTML(); $objSelects = new Select(); $estudio = new EstudioBac(); $estudio->obtenerBD($_POST['id']);
</td><td>: <b><?php echo $memoryUsage . " " . $lang['byte']; ?> </b></td></tr> <tr><td><?php echo $lang['maxMemoryUsage']; ?> </td><td>: <b><?php echo $maxMemoryUsage . " " . $lang['byte']; ?> </b></td></tr> <tr><td><?php echo $lang['countFile']; ?> </td><td>: <b><?php echo count(get_required_files()); ?> </b></td></tr> <tr><td colspan='2'></td></tr><tr><td colspan='2'></td></tr><tr><td colspan='2'></td></tr> <tr><td colspan='2' class="importantColorBenchmarkTable"><?php echo $lang['performanceTips']; ?> </td></tr> <tr><td colspan='2'><?php echo $lang['laterProcess']; ?> </td></tr> <tr> <td><?php echo $lang['configHtaccess']; ?>
<?php /** * Codeception PHP script runner inside phar archive. * * @link https://github.com/index0h/yii2-phar * @copyright Copyright (c) 2014 Roman Levishchenko <*****@*****.**> * @license https://raw.github.com/index0h/yii2-phar/master/LICENSE */ define('ROOT_PATH', 'phar://' . implode(DIRECTORY_SEPARATOR, [__DIR__, 'tests', '_runtime', 'app.phar'])); require ROOT_PATH . DIRECTORY_SEPARATOR . '.test.php'; echo "\nFiles required in tests not from phar:\n\n"; $requireFiles = get_required_files(); foreach ($requireFiles as $file) { if (strpos($file, ROOT_PATH) === false) { echo " - " . substr($file, strlen(__DIR__) + 1) . "\n"; } } echo "\n";