Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F773257
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 2, 6:39 AM
Size
4 KB
Mime Type
text/x-diff
Expires
Tue, Feb 4, 6:39 AM (47 m, 39 s)
Engine
blob
Format
Raw Data
Handle
556506
Attached To
rINP In-Portal
in-portal
View Options
Index: trunk/tools/debug_sample.php
===================================================================
--- trunk/tools/debug_sample.php (revision 820)
+++ trunk/tools/debug_sample.php (revision 821)
@@ -1,123 +1,123 @@
<?php
// uncomment next line to enable sql logging
define('ADODB_OUTP', 'SQLLog');
// sql logging to screen
define('DOC_ROOT', $_SERVER['DOCUMENT_ROOT']);
define('WINDOWS_ROOT', 'w:');
- define('WINDOWS_EDITOR', 'c:\Program Files\Zend\ZendStudio-4.0Beta\bin\ZDE.exe');
+ define('WINDOWS_EDITOR', 'c:\Program Files\Zend\ZendStudio-4.0Beta\bin\ZDE.exe %F'); // %F - filename, %L - line number
//define('SQL_TO_SCREEN', 1); // output sql queries to screen
// sql logging to file
define('SQL_TO_FILE', 1); // output sql queries to file
define('SQL_ERROR_DIE', 1);
define('SQL_OUTPUT', DOC_ROOT.'/inportal_sqls.txt'); // file where to store sql queries
define('SQL_OVERWRITE', 1); // overwrite or not sql_log file
// various levels of debugging
// Admin:
define('KERNEL_ACTIONS', 1); // only kernel
define('MODULE_ACTIONS', 2); // only modules
define('SEARCH_ACTIONS', 4); // kernel & modules
define('SHOW_REQUEST', 8); // show formatted $_REQUEST array passed to script (GE - $_GET, PO - $_POST, CO - $_COOKIE)
// Front:
define('FRONT_KERNEL_ACTIONS', 16);
define('FRONT_SHOW_REQUEST', 32);
define('DEBUG_MODE', 1); // global debugging
define('DEBUG_ACTIONS', KERNEL_ACTIONS + SHOW_REQUEST + FRONT_KERNEL_ACTIONS + FRONT_SHOW_REQUEST);
//define('DEBUG_HELP', 1); // allow to add missing help
if( defined('DEBUG_MODE') && constant('DEBUG_MODE') == 1 )
{
error_reporting(E_ALL);
ini_set('display_errors', 1);
}
ini_set('max_execution_time', '30');
//ini_set('memory_limit', 512000000);
function SQLLog($msg, $newline = true)
{
static $file_reset = false;
//$LocationMessage = 'Called from file ['.basename($_SERVER['PHP_SELF']).']';
//if($msg != $LocationMessage) SQLLog($LocationMessage);
$db =& GetADODBConnection();
// telestial specific: begin
static $prefix = '';
$prefix = GetTablePrefix();
// 'Theme'
$skip_tables = Array( 'Modules','Language','PermissionConfig','PermCache',
'SessionData','UserSession','Phrase','ConfigurationValues',
'PersistantSessionData','Events','EmailQueue',
'Permissions');
foreach($skip_tables as $table)
if( strpos($msg, $prefix.$table) !== false ) return false;
// telestial specific: end
$select_pos = strpos($msg, 'SELECT ');
if($select_pos !== false)
{
// add affected rows
$before = substr($msg,0,$select_pos);
$after = substr($msg,$select_pos,strlen($msg));
$msg = $before.'AR: ['.$db->Affected_Rows().'] '.$after;
}
if($newline) $msg .= "<br>\n";
if( defined('SQL_TO_SCREEN') && SQL_TO_SCREEN == 1 ) echo $msg;
if( defined('SQL_TO_FILE') && SQL_TO_FILE == 1 )
{
if($file_reset == false && defined('SQL_OVERWRITE') && SQL_OVERWRITE)
{
if( file_exists(SQL_OUTPUT) ) unlink(SQL_OUTPUT);
$file_reset = true;
}
$msg = str_replace(Array("<hr />\n",' <code></code>','<','>','"'),Array('','','<','>','"'),$msg);
$fp = fopen(SQL_OUTPUT, 'a');
fwrite($fp,$msg);
fclose($fp);
}
}
/**
* @return string
* @desc Returnts trace results to place where called from
*/
function trace()
{
$trace_results = debug_backtrace();
array_shift($trace_results);
echo 'Called from [<b>'.$trace_results[0]['function'].'</b>]<br>';
print_pre($trace_results);
}
function DebugByFile()
{
$ScriptName = basename( $_SERVER['PHP_SELF'] );
switch ($ScriptName)
{
case 'step3.php':
global $objSession;
$objSession->SetVariable('import_sql_type', 'mysql');
$objSession->SetVariable('import_server', 'localhost');
$objSession->SetVariable('import_db', 'alex_in_portal'); //maris_inlink');
$objSession->SetVariable('import_user', 'dev');
$objSession->SetVariable('import_pass', 'dev-25-sql');
$objSession->SetVariable('categoryid', 101); // resource id
$objSession->SetVariable('import_category_id', 1); // category id
$objSession->SetVariable('catnavbar', 'Home>Directory (debug_auto_complete)');
$objSession->SetVariable('user_admin_names','admin');
$objSession->SetVariable('user_admin_values', 11);
$objSession->SetVariable('user_regular_names','Member');
$objSession->SetVariable('user_regular_values', 13);
break;
}
}
?>
\ No newline at end of file
Property changes on: trunk/tools/debug_sample.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Event Timeline
Log In to Comment