コード例 #1
3
ファイル: TestListener.php プロジェクト: rodrigorm/audit
 public function __construct($namespace)
 {
     $this->namespace = $namespace;
     $temp = tempnam('', '');
     $this->traceFile = $temp . '.xt';
     xdebug_start_trace($temp, XDEBUG_TRACE_COMPUTERIZED);
 }
コード例 #2
3
ファイル: TraceManagerTest.php プロジェクト: renanbr/telltale
 /**
  * @expectedException RuntimeException
  * @expectedExceptionMessage Can not start tracing, it has already been started.
  */
 public function testCanNotStartWhenStartedByThird()
 {
     xdebug_start_trace();
     $this->stopTraceOnTearDown = true;
     $manager = new TraceManager();
     $manager->start();
 }
コード例 #3
2
 protected function execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output)
 {
     // scheme code
     $code = $input->getOption(self::OPT_CODE);
     // dealer offset
     $offset = $input->getOption(self::OPT_OFFSET);
     // Start the simulation
     $result = \Akzo\Scheme\Service::getInstance()->initiateSimulation($code, $offset);
     // Check if the scheme has been executed for all dealers, otherwise replay this command with the new offset
     if (isset($result['moreDealersLeft']) && $result['moreDealersLeft']) {
         $cmd = 'php ' . __DIR__ . '/../manageSchemes.php simulate -c ' . $code . ' -o ' . $result['moreDealersOffset'];
         // FIXME: Use Symfony Process instead of plain exec
         //$process = new \Symfony\Component\Process\Process(
         //$cmd
         //);
         //$process->start();
         if ($offset == 670) {
             if (function_exists('xdebug_start_trace')) {
                 xdebug_start_trace();
             }
             $cmd = 'php ' . __DIR__ . '/../manageSchemesX.php simulate -c ' . $code . ' -o ' . $result['moreDealersOffset'];
         }
         $GLOBALS['logger']->info("Starting scheme for more dealers from offset ** {$result['moreDealersOffset']} **" . PHP_EOL . "Command: {$cmd}");
         $output = array();
         $returnVal = 123;
         exec($cmd . ' >/dev/null 2>&1 &', $output, $returnVal);
         $GLOBALS['logger']->info("Got output :" . PHP_EOL . print_r($output, 1) . PHP_EOL . "Return val: " . $returnVal);
     }
 }
コード例 #4
1
 public function display($tpl = null)
 {
     xdebug_start_trace(JPATH_COMPONENT . '/views/xdebug/function_trace');
     $data = $this->get('Data');
     $this->assign('data', $data);
     parent::display($tpl);
     xdebug_stop_trace();
 }
コード例 #5
0
 /**
  * Start xdebug trace. Needs xdebug module (apt-get install php5-xdebug).
  * @param string $trace_file (default = '/tmp/php5-xdebug'[.xt])
  */
 public function startXDTrace($trace_file = '/tmp/php5-xdebug.trace')
 {
     xdebug_start_trace($trace_file);
     if (!$this->_xdebug_on) {
         $this->_xdebug_on = !empty(xdebug_get_tracefile_name());
     }
 }
コード例 #6
0
ファイル: Debug.php プロジェクト: zucchi/zucchi
 public static function startTrace($file = 'trace', $html = true)
 {
     if (!extension_loaded('xdebug')) {
         throw new \RuntimeException('XDebug must be installed to use this function');
     }
     $flag = $html ? XDEBUG_TRACE_HTML : XDEBUG_TRACE_COMPUTERIZED;
     \xdebug_start_trace($file, $flag);
 }
コード例 #7
0
ファイル: Debug.php プロジェクト: geekwright/XoopsCore25
 /**
  * start_trace - turn on xdebug trace
  *
  * Requires xdebug extension
  *
  * @param string $tracefile      file name for trace file
  * @param string $collect_params argument for ini_set('xdebug.collect_params',?)
  *                             Controls display of parameters in trace output
  * @param string $collect_return argument for ini_set('xdebug.collect_return',?)
  *                             Controls display of function return value in trace
  *
  * @return void
  */
 public static function startTrace($tracefile = '', $collect_params = '3', $collect_return = 'On')
 {
     if (function_exists('xdebug_start_trace')) {
         ini_set('xdebug.collect_params', $collect_params);
         ini_set('xdebug.collect_return', $collect_return);
         if ($tracefile == '') {
             $tracefile = XOOPS_VAR_PATH . '/logs/php_trace';
         }
         xdebug_start_trace($tracefile);
     }
 }
コード例 #8
0
ファイル: xdebug.php プロジェクト: alencarmo/OCF
function traceStart($fileName = '')
{
    ini_set("xdebug.collect_params", 3);
    ini_set("xdebug.collect_return", 1);
    if (!function_exists('xdebug_is_enabled') || !xdebug_is_enabled()) {
        return;
    }
    if (!$fileName) {
        $fileName = xdebug_call_function();
    }
    xdebug_start_trace(getcwd() . "/log/{$fileName}", XDEBUG_TRACE_APPEND);
}
コード例 #9
0
ファイル: TraceManager.php プロジェクト: renanbr/telltale
 /**
  * Returns the name of the file which is used to trace.
  *
  * @throws \RuntimeException
  * @return string
  */
 public function start()
 {
     if (!static::$file) {
         if (xdebug_get_tracefile_name()) {
             throw new \RuntimeException('Can not start tracing, it has already been started.');
         }
         $file = tempnam(sys_get_temp_dir(), 'telltale');
         xdebug_start_trace($file, \XDEBUG_TRACE_COMPUTERIZED);
         static::$file = $file . '.xt';
     }
     return static::$file;
 }
コード例 #10
0
ファイル: log.php プロジェクト: Borvik/Munla
 /**
  * If XDebug is installed starts the trace, with full variable contents and variable names.
  * 
  * @param string $trace_file The file to put the trace log in
  * @param int $options
  * 
  * @return void
  */
 public static function start_trace($trace_file, $options = null)
 {
     if (function_exists('xdebug_start_trace')) {
         ini_set('xdebug.collect_params', 4);
         if ($options !== null) {
             xdebug_start_trace($trace_file, $options);
         } else {
             xdebug_start_trace($trace_file);
         }
     } else {
         self::notice('xdebug is not installed');
     }
 }
コード例 #11
0
ファイル: Tracer.php プロジェクト: shabbyrobe/caper
 static function start()
 {
     if (!self::$traceFile) {
         self::init();
     }
     if (ini_get('xdebug.auto_trace')) {
         return;
     }
     if (self::$running) {
         throw new \BadMethodCallException();
     }
     foreach (static::$ini as $k => $v) {
         self::$iniRestore[$k] = ini_get($k);
         ini_set($k, $v);
     }
     self::$running = true;
     $options = XDEBUG_TRACE_APPEND | XDEBUG_TRACE_COMPUTERIZED | XDEBUG_TRACE_NAKED_FILENAME;
     xdebug_start_trace(self::$traceFile, $options);
 }
コード例 #12
0
ファイル: tracing_4.php プロジェクト: badlamer/hhvm
<?php

xdebug_start_trace('/tmp/trace.%p');
require __DIR__ . '/tracing.inc';
$file = xdebug_stop_trace();
xdebug_start_trace($file, XDEBUG_TRACE_APPEND | XDEBUG_TRACE_NAKED_FILENAME);
require __DIR__ . '/tracing.inc';
xdebug_stop_trace();
var_dump(file_get_contents($file));
コード例 #13
0
ファイル: DB.php プロジェクト: Aasit/DISCOUNT--SRV-I
    /**
     * _checkConnection  Checks if the PDO connection is active
     *
     * @access private
     * @return void
     */
    public function checkConnection() {
        try {
            $st = $this->_conn->query("SELECT 1");
        } catch(\PDOException $pe) {
            if ((strcasecmp($pe->getCode(), 'HY000') !== 0) && !stristr($pe->getMessage(), 'server has gone away'))
                throw $pe;

            if (function_exists('xdebug_start_trace'))
                xdebug_start_trace();

            $this->_resetConnection();
            $this->_connect();
        }

        return true;
    }
コード例 #14
0
ファイル: DebugUtil.php プロジェクト: youprofit/Zurmo
 /**
  * Starts trace to trace.xt in the current directory.
  * This is for temporary use when debugging.
  * DO NOT CHECK IN A CALL TO THIS FUNCTION.
  */
 public static function startTrace()
 {
     xdebug_start_trace('./trace');
 }
コード例 #15
0
ファイル: Profiler.php プロジェクト: kingsj/core
 /**
  * Log same time range
  *
  * @param string  $timePoint  Time range name
  * @param boolean $additional Additional metric flag OPTIONAL
  *
  * @return void
  */
 public function log($timePoint, $additional = false)
 {
     if (!isset($this->points[$timePoint])) {
         $this->points[$timePoint] = array('start' => microtime(true), 'open' => true, 'time' => 0);
         if (self::$useXdebugStackTrace) {
             xdebug_start_trace(LC_DIR_LOG . $timePoint . '.' . microtime(true), XDEBUG_TRACE_COMPUTERIZED);
         }
     } elseif ($this->points[$timePoint]['open']) {
         $range = microtime(true) - $this->points[$timePoint]['start'];
         if ($additional) {
             $this->points[$timePoint]['time'] += $range;
         } else {
             $this->points[$timePoint]['time'] = $range;
         }
         $this->points[$timePoint]['open'] = false;
         if (self::$useXdebugStackTrace) {
             @xdebug_stop_trace();
         }
     } else {
         $this->points[$timePoint]['start'] = microtime(true);
         $this->points[$timePoint]['open'] = true;
         if (self::$useXdebugStackTrace) {
             xdebug_start_trace(LC_DIR_VAR . 'log' . LC_DS . $timePoint . '.' . microtime(true), XDEBUG_TRACE_COMPUTERIZED);
         }
     }
 }
コード例 #16
0
ファイル: Trace.php プロジェクト: hasshy/sahana-tw
<?php

ini_set('xdebug.trace_format', 1);
ini_set('xdebug.show_mem_delta', true);
xdebug_start_trace(dirname(__FILE__) . '/Trace');
require_once '../library/HTMLPurifier.auto.php';
$purifier = new HTMLPurifier();
$data = $purifier->purify(file_get_contents('samples/Lexer/4.html'));
xdebug_stop_trace();
コード例 #17
0
ファイル: gj_utility.inc.php プロジェクト: gmgj/gjsoap
function gjShowErrors()
{
    //call this first after session start
    error_reporting(E_ALL);
    //for test if sessionstart put it after error_reporting
    ini_set('display_errors', 1);
    // 1 to display errors
    ini_set('log_errors', 1);
    global $gjDebug;
    global $gjLocal;
    //usually have to set this in php.ini
    //xdebug_disable();
    //xdebug.collect_assignments
    ini_set('xdebug.collect_includes', '1');
    ini_set('xdebug.collect_params', '1');
    //terse is 1
    ini_set('xdebug.collect_return', '1');
    ini_set('xdebug.collect_vars', '1');
    //for xdebug_get_declared_vars().
    //xdebug.coverage_enable
    ini_set('xdebug.default_enable', '1');
    ini_set('xdebug.dump.SERVER', 'REQUEST_URI,REQUEST_METHOD');
    ini_set('xdebug.dump.GET', '*');
    ini_set('xdebug.dump.SESSION', '*');
    ini_set('xdebug.dump.REQUEST', '*');
    ini_set('xdebug.dump.FILES', '*');
    ini_set('xdebug.dump.COOKIE', '*');
    ini_set('xdebug.dump_globals', '1');
    //xdebug.dump_undefined
    //xdebug.extended_info  only in php.ini
    //xdebug.file_link_format for IDE
    //xdebug.idekey
    //xdebug.manual_url ,link to php manual  defualt http://www.php.net
    ini_set('xdebug.max_nesting_level', '50');
    //xdebug.overload_var_dump
    //xdebug.profiler_append
    //xdebug.profiler_enable
    // ... more profiler options
    // ... more remote options
    ini_set('xdebug.scream', '1');
    // xdebug.show_exception_trace
    ini_set('xdebug.show_local_vars', '1');
    //xdebug.show_mem_delta
    //xdebug.trace_enable_trigger
    ini_set('xdebug.trace_format', '0');
    //0 is for the editor 1 is for IDEs 2 is html
    // xdebug.trace_options
    //xdebug.trace_output_dir  /tmp
    // bad  see php.ini ini_set('xdebug.trace_output_name', 'F:\tmp');
    ini_set('xdebug.var_display_max_children', '128');
    ini_set('xdebug.var_display_max_data', '-1');
    ini_set('xdebug.var_display_max_depth', '-1');
    //not set up on hosted accounts
    if ($gjLocal) {
        try {
            xdebug_enable();
            if (xdebug_is_enabled()) {
                echo 'stack traces are enabled - debugging<BR>';
                //xdebug_start_error_collection();
                echo 'xdebug_memory_usage() ' . number_format(xdebug_memory_usage()) . '<BR>';
                xdebug_start_trace();
            } else {
                echo 'not debugging<br>';
            }
        } catch (Exception $e) {
            echo 'Caught Exception -> message: ', $e->getMessage(), "\n";
            //   or if extended over ridden exception var_dump e->getMessage()
        }
    }
    /*
    xdebug_start_error_collection();
    Starts recording all notices, warnings and errors and prevents their display
    Xdebug will cause PHP not to display any notices, warnings or errors.
    Instead, they are formatted according to Xdebug's normal error formatting rules
    (ie, the error table with the red exclamation mark) and then stored in a buffer.
    This will continue until you call .
    xdebug_stop_error_collection();
    This buffer's contents can be retrieved by calling
    xdebug_get_collected_errors()
    */
    /*
    $bt = debug_backtrace();
    - Generates a user-level error/warning/notice message
    trigger_error("I want a backtrace", E_USER_ERROR);
    debug_print_backtrace() - Prints a backtrace
    */
}
コード例 #18
0
 function process($tpl, &$textElements, $functionName, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace)
 {
     switch ($functionName) {
         case $this->TimingPointName:
             $children = $functionChildren;
             $parameters = $functionParameters;
             $id = false;
             if (isset($parameters["id"])) {
                 $id = $tpl->elementValue($parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement);
             }
             $startDescription = "debug-timing-point START: {$id}";
             eZDebug::addTimingPoint($startDescription);
             if (is_array($children)) {
                 foreach (array_keys($children) as $childKey) {
                     $child =& $children[$childKey];
                     $tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
                 }
             }
             $endDescription = "debug-timing-point END: {$id}";
             eZDebug::addTimingPoint($endDescription);
             break;
         case $this->AccumulatorName:
             $children = $functionChildren;
             $parameters = $functionParameters;
             $id = false;
             if (isset($parameters["id"])) {
                 $id = $tpl->elementValue($parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement);
             }
             $name = false;
             if (isset($parameters["name"])) {
                 $name = $tpl->elementValue($parameters["name"], $rootNamespace, $currentNamespace, $functionPlacement);
             }
             // Assign a name (as $functionName) which will be used in the debug output.
             $name = ($name === false and $id === false) ? $functionName : $name;
             // To uniquely identify this accumulator.
             $id = $id === false ? uniqID($functionName . '_') : $id;
             eZDebug::accumulatorStart($id, 'Debug-Accumulator', $name);
             if (is_array($children)) {
                 foreach (array_keys($children) as $childKey) {
                     $child =& $children[$childKey];
                     $tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
                 }
             }
             eZDebug::accumulatorStop($id);
             break;
         case $this->LogName:
             $parameters = $functionParameters;
             if (isset($parameters['var'])) {
                 $var = $tpl->elementValue($parameters['var'], $rootNamespace, $currentNamespace, $functionPlacement);
             }
             if (isset($parameters['msg'])) {
                 $msg = $tpl->elementValue($parameters['msg'], $rootNamespace, $currentNamespace, $functionPlacement);
             }
             if (isset($var) && isset($msg)) {
                 eZDebug::writeDebug($var, $msg);
             } elseif (isset($msg)) {
                 eZDebug::writeDebug($msg);
             } elseif (isset($var)) {
                 eZDebug::writeDebug($var);
             }
             break;
         case $this->TraceName:
             $children = $functionChildren;
             $id = false;
             // If we have XDebug we start the trace, execute children and stop it
             // if not we just execute the children as normal
             if (extension_loaded('xdebug')) {
                 $parameters = $functionParameters;
                 if (isset($parameters["id"])) {
                     $id = $tpl->elementValue($parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement);
                 }
                 if (!$id) {
                     $id = 'template-debug';
                 }
                 // If we already have a file, make sure it is truncated
                 if (file_exists($id . '.xt')) {
                     $fd = fopen($id, '.xt', 'w');
                     fclose($fd);
                 }
                 xdebug_start_trace($id);
                 if (is_array($children)) {
                     foreach (array_keys($children) as $childKey) {
                         $child =& $children[$childKey];
                         $tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
                     }
                 }
                 xdebug_stop_trace();
             } elseif (is_array($children)) {
                 foreach (array_keys($children) as $childKey) {
                     $child =& $children[$childKey];
                     $tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
                 }
             }
             break;
     }
 }
コード例 #19
0
ファイル: doctrine.php プロジェクト: doctrine/couchdb-odm
<?php

require_once getcwd() . "/cli-config.php";
xdebug_start_trace("/tmp/couch");
$cli = new \Symfony\Component\Console\Application('Doctrine CouchDB CLI', Doctrine\ODM\CouchDB\Version::VERSION);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new \Doctrine\CouchDB\Tools\Console\Command\ReplicationStartCommand(), new \Doctrine\CouchDB\Tools\Console\Command\ReplicationCancelCommand(), new \Doctrine\CouchDB\Tools\Console\Command\ViewCleanupCommand(), new \Doctrine\CouchDB\Tools\Console\Command\CompactDatabaseCommand(), new \Doctrine\CouchDB\Tools\Console\Command\CompactViewCommand(), new \Doctrine\CouchDB\Tools\Console\Command\MigrationCommand(), new \Doctrine\ODM\CouchDB\Tools\Console\Command\UpdateDesignDocCommand()));
$cli->run();
コード例 #20
0
ファイル: tracing_2.php プロジェクト: badlamer/hhvm
function start_trace()
{
    xdebug_start_trace('/tmp/trace.%p');
}
コード例 #21
0
ファイル: concurrent.php プロジェクト: shabbyrobe/cachet
function run_worker_process($id, $socket)
{
    global $config;
    if ($config->profile) {
        xdebug_start_trace($config->profile . "-{$id}");
    }
    // XDEBUG_TRACE_COMPUTERIZED);
    socket_write($socket, serialize('ready') . PHP_EOL);
    while (true) {
        $read = [$socket];
        $changed = socket_select($read, $write, $x, 1);
        if (!$changed) {
            continue;
        }
        $cmd = socket_read($socket, 8192);
        list($method, $args) = unserialize($cmd);
        if ($method == 'quit') {
            break;
        }
        if (!is_callable($method)) {
            die;
        }
        $return = call_user_func_array($method, $args);
        if (!@socket_write($socket, serialize($return) . PHP_EOL)) {
            die;
        }
    }
    socket_close($socket);
}
コード例 #22
0
ファイル: Logger.php プロジェクト: hellogerard/pox-framework
 /**
  * an xdebug execution trace file will be created in the logs directory.
  * for example, appending "xdebug_trace=my_trace.xt" on the query string
  * will create a trace file in the logs directory for just this request.
  *
  * see: http://www.xdebug.org/docs/execution_trace
  */
 public function enableXdebug()
 {
     if ($_GET['xdebug_trace']) {
         $logfile = APP_ROOT . "/artifacts/logs/" . $_GET['xdebug_trace'];
         xdebug_start_trace($logfile);
     }
 }
コード例 #23
0
ファイル: tracing_5.php プロジェクト: badlamer/hhvm
function start_trace()
{
    xdebug_start_trace('/tmp/trace.%p', XDEBUG_TRACE_HTML);
}
コード例 #24
0
    define('SH_GLOBAL_DEBUG', true);
    ini_set('xdebug.var_display_max_depth', '5');
    if (defined('SH_DEBUG_COVERAGE_PAGE')) {
        xdebug_start_code_coverage();
        define('LINE_USED', 1);
        define('LINE_UNUSED', 0);
        define('LINE_LIKE_PREVIOUS_LINE', 4);
    }
    if (defined('SH_DEBUG_ERROR_REPORTING')) {
        error_reporting(SH_DEBUG_ERROR_REPORTING);
    }
    $_SESSION["temp"] = array();
    define("SH_GLOBAL_DEBUG", true);
    if (defined('SH_DEBUG_TRACE_PATH')) {
        ini_set("xdebug.collect_params", "3");
        xdebug_start_trace(SH_DEBUG_TRACE_PATH);
    }
} else {
    define('SH_GLOBAL_DEBUG', false);
    define('SH_IS_DEV', false);
}
function endDebug()
{
    if (defined('SH_DEBUG_VERIFY_FOLDER') && is_dir(SH_DEBUG_VERIFY_FOLDER)) {
        if (defined('SH_DEBUG_COVERAGE_PAGE')) {
            $linker = sh_linker::getInstance();
            if (file_exists(SH_DEBUG_COVERAGE_PAGE)) {
                include SH_DEBUG_COVERAGE_PAGE;
            } else {
                $coverage = array();
            }
コード例 #25
0
<?php

xdebug_start_trace('/tmp/factorial-trace');
function factorial($x)
{
    return $x == 1 ? 1 : $x * factorial($x - 1);
}
print factorial(10);
xdebug_stop_trace();
コード例 #26
0
<?php

$POD_TRACELOG_DIR = "{$TRACELOG_DIR}";
$POD_EXEC_FILENAME = basename($_SERVER['PHP_SELF']);
xdebug_start_trace("{$POD_TRACELOG_DIR}/{$POD_EXEC_FILENAME}");
$POD_TRACELOG_FILENAME = "{$POD_TRACELOG_DIR}/{$POD_EXEC_FILENAME}" . ".xt";
コード例 #27
0
ファイル: test3.php プロジェクト: akomm/zf2-memory-leak-test
<?php

include_once __DIR__ . '/vendor/autoload.php';
$appConfig = $appConfig = array('modules' => array(), 'module_listener_options' => array('module_paths' => array('./vendor'), 'config_glob_paths' => array('config/autoload/{,*.}{global,local}.php')));
if (!is_dir(__DIR__ . '/trace')) {
    mkdir(__DIR__ . '/trace');
}
ini_set('xdebug.show_mem_delta', '1');
for ($t = 0; $t < 5; $t++) {
    xdebug_start_trace(sprintf('%s/trace/%d', __DIR__, $t + 1));
    $app = \Zend\Mvc\Application::init($appConfig);
    xdebug_stop_trace();
    \Zend\EventManager\StaticEventManager::resetInstance();
    $app = null;
}
コード例 #28
0
$pathComponents = explode('/', $url);
$Path = array();
foreach ($pathComponents as $pathItem) {
    if ($pathItem) {
        $Path[] = urldecode($pathItem);
    }
}
$requestBase = !empty($Path) ? array_shift($Path) : false;
$requestProtocol = !empty($Path) ? array_shift($Path) : false;
$requestVersion = !empty($Path) ? array_shift($Path) : false;
#region DEBUG LOGGER
if (DEBUG) {
    $tracePatterns = array();
    foreach ($tracePatterns as $tracePattern) {
        if (strstr($url, $tracePattern)) {
            xdebug_start_trace("logs/xdebug-{$tracePattern}");
            break;
        }
    }
}
#endregion
switch ($requestBase) {
    case "api":
        switch ($requestProtocol) {
            case "rest":
                switch ($requestVersion) {
                    case "v1":
                        $headers = getallheaders();
                        $unitTest = isset($headers['Unittest']) && $headers['Unittest'] === 'true';
                        if ($headers && isset($headers['Content-Type']) && ($contentType = explode(';', $headers['Content-Type']))) {
                            $mime = $contentType[0];
コード例 #29
0
<?php

/**
 * Benchmarking tests for Swift Mailer
 * @author Chris Corbyn <*****@*****.**>
 */
set_time_limit(500);
error_reporting(E_ALL);
ini_set("display_errors", "On");
require_once "../TestConfiguration.php";
xdebug_start_trace(TestConfiguration::WRITABLE_PATH . "/bench-output");
//Number of emails to send
$n = isset($_GET["n"]) ? $_GET["n"] : 1;
require_once TestConfiguration::SWIFT_LIBRARY_PATH . "/Swift.php";
Swift_CacheFactory::setClassName("Swift_Cache_Disk");
Swift_Cache_Disk::setSavePath(TestConfiguration::WRITABLE_PATH);
$conn = null;
switch (TestConfiguration::CONNECTION_TYPE) {
    case "smtp":
        require_once TestConfiguration::SWIFT_LIBRARY_PATH . "/Swift/Connection/SMTP.php";
        $enc = null;
        $test_enc = TestConfiguration::SMTP_ENCRYPTION;
        if ($test_enc == "ssl") {
            $enc = Swift_Connection_SMTP::ENC_SSL;
        } elseif ($test_enc == "tls") {
            $enc = Swift_Connection_SMTP::ENC_TLS;
        }
        $conn = new Swift_Connection_SMTP(TestConfiguration::SMTP_HOST, TestConfiguration::SMTP_PORT, $enc);
        if ($user = TestConfiguration::SMTP_USER) {
            $conn->setUsername($user);
        }
コード例 #30
0
ファイル: index.php プロジェクト: rldiezn/platzy
define('_ENGINE', TRUE);
define('DS', DIRECTORY_SEPARATOR);
define('PS', PATH_SEPARATOR);
define('_ENGINE_REQUEST_START', microtime(true));
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(dirname(__FILE__))));
defined('APPLICATION_ENV') || (!empty($_SERVER['_ENGINE_ENVIRONMENT']) && in_array($_SERVER['_ENGINE_ENVIRONMENT'], array('development', 'staging', 'production')) ? define('APPLICATION_ENV', $_SERVER['_ENGINE_ENVIRONMENT']) : define('APPLICATION_ENV', 'production'));
defined('_ENGINE_NO_AUTH') || (!empty($_SERVER['_ENGINE_NOAUTH']) && $_SERVER['_ENGINE_NOAUTH'] == '1' ? define('_ENGINE_NO_AUTH', true) : define('_ENGINE_NO_AUTH', false));
set_include_path(APPLICATION_PATH . DS . 'application' . DS . 'libraries' . PS . APPLICATION_PATH . DS . 'application' . DS . 'libraries' . DS . 'PEAR' . PS . '.');
require_once "Zend/Loader.php";
require_once "Zend/Loader/Autoloader.php";
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('Engine');
$application = new Zend_Application(APPLICATION_ENV, array('bootstrap' => array('class' => 'Install_Bootstrap', 'path' => APPLICATION_PATH . '/install/Bootstrap.php')));
// Debug
if (!empty($_SERVER['_ENGINE_TRACE_ALLOW']) && extension_loaded('xdebug')) {
    xdebug_start_trace();
}
// Run
try {
    $application->bootstrap();
    $application->run();
} catch (Exception $e) {
    // Render custom error page
    $error = $e;
    $base = dirname($_SERVER['PHP_SELF']);
    include_once './views/scripts/_rawError.tpl';
}
// Debug
if (!empty($_SERVER['_ENGINE_TRACE_ALLOW']) && extension_loaded('xdebug')) {
    xdebug_stop_trace();
}