本文整理汇总了PHP中PMA_Tracker::isActive方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Tracker::isActive方法的具体用法?PHP PMA_Tracker::isActive怎么用?PHP PMA_Tracker::isActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Tracker
的用法示例。
在下文中一共展示了PMA_Tracker::isActive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIsActive
/**
* Test for PMA_Tracker::isActive()
*
* @return void
* @test
*/
public function testIsActive()
{
$attr = new \ReflectionProperty('PMA_Tracker', 'enabled');
$attr->setAccessible(true);
$attr->setValue(false);
$this->assertFalse(PMA_Tracker::isActive());
PMA_Tracker::enable();
$_SESSION['relation'][$GLOBALS['server']] = array('PMA_VERSION' => PMA_VERSION, 'trackingwork' => false);
$this->assertFalse(PMA_Tracker::isActive());
$_SESSION['relation'][$GLOBALS['server']] = array('PMA_VERSION' => PMA_VERSION, 'trackingwork' => true, 'db' => 'pmadb', 'tracking' => 'tracking');
$this->assertTrue(PMA_Tracker::isActive());
}
示例2: PMA_getHtmlForActionLinks
/**
* Get the HTML links for action links
* Actions are, Browse, Search, Browse table label, empty table
*
* @param array $current_table current table
* @param boolean $table_is_view Is table view or not
* @param string $tbl_url_query table url query
* @param array $titles titles and icons for action links
* @param string $truename table name
* @param boolean $db_is_system_schema is database information schema or not
* @param string $url_query url query
*
* @return array ($browse_table, $search_table, $browse_table_label, $empty_table,
* $tracking_icon)
*/
function PMA_getHtmlForActionLinks($current_table, $table_is_view, $tbl_url_query, $titles, $truename, $db_is_system_schema, $url_query)
{
$empty_table = '';
if ($current_table['TABLE_ROWS'] > 0 || $table_is_view) {
$may_have_rows = true;
} else {
$may_have_rows = false;
}
$browse_table = '<a href="sql.php' . $tbl_url_query . '&pos=0">';
if ($may_have_rows) {
$browse_table .= $titles['Browse'];
} else {
$browse_table .= $titles['NoBrowse'];
}
$browse_table .= '</a>';
$search_table = '<a href="tbl_select.php' . $tbl_url_query . '">';
if ($may_have_rows) {
$search_table .= $titles['Search'];
} else {
$search_table .= $titles['NoSearch'];
}
$search_table .= '</a>';
$browse_table_label = '<a href="sql.php' . $tbl_url_query . '&pos=0" title="' . htmlspecialchars($current_table['TABLE_COMMENT']) . '">' . $truename . '</a>';
if (!$db_is_system_schema) {
$empty_table = '<a class="truncate_table_anchor ajax"';
$empty_table .= ' href="sql.php' . $tbl_url_query . '&sql_query=';
$empty_table .= urlencode('TRUNCATE ' . PMA_Util::backquote($current_table['TABLE_NAME']));
$empty_table .= '&message_to_show=' . urlencode(sprintf(__('Table %s has been emptied.'), htmlspecialchars($current_table['TABLE_NAME']))) . '">';
if ($may_have_rows) {
$empty_table .= $titles['Empty'];
} else {
$empty_table .= $titles['NoEmpty'];
}
$empty_table .= '</a>';
// truncating views doesn't work
if ($table_is_view) {
$empty_table = ' ';
}
}
$tracking_icon = '';
if (PMA_Tracker::isActive()) {
if (PMA_Tracker::isTracked($GLOBALS["db"], $truename)) {
$tracking_icon = '<a href="tbl_tracking.php' . $url_query . '&table=' . $truename . '">' . PMA_Util::getImage('eye.png', __('Tracking is active.')) . '</a>';
} elseif (PMA_Tracker::getVersion($GLOBALS["db"], $truename) > 0) {
$tracking_icon = '<a href="tbl_tracking.php' . $url_query . '&table=' . $truename . '">' . PMA_Util::getImage('eye_grey.png', __('Tracking is not active.')) . '</a>';
}
}
return array($browse_table, $search_table, $browse_table_label, $empty_table, $tracking_icon);
}
示例3: testIsActive
/**
* Test for PMA_Tracker::isActive()
*
* @return void
* @test
*/
public function testIsActive()
{
$attr = new \ReflectionProperty('PMA_Tracker', 'enabled');
$attr->setAccessible(true);
$attr->setValue(null, false);
$this->assertFalse(
PMA_Tracker::isActive()
);
PMA_Tracker::enable();
$_SESSION['relation'][$GLOBALS['server']] = array(
'trackingwork' => false
);
$this->assertFalse(
PMA_Tracker::isActive()
);
$_SESSION['relation'][$GLOBALS['server']] = array(
'trackingwork' => true
);
$GLOBALS['cfg']['Server']['pmadb'] = 'pma`s test';
$this->assertTrue(
PMA_Tracker::isActive()
);
}
示例4: __
$tabs['tracking']['icon'] = 'eye.png';
$tabs['tracking']['text'] = __('Tracking');
$tabs['tracking']['link'] = 'tbl_tracking.php';
}
if (!$tbl_is_view && !(isset($db_is_information_schema) && $db_is_information_schema)) {
}
/**
* Views support a limited number of operations
*/
if ($tbl_is_view && !(isset($db_is_information_schema) && $db_is_information_schema)) {
$tabs['operation']['icon'] = 'b_tblops.png';
$tabs['operation']['link'] = 'view_operations.php';
$tabs['operation']['text'] = __('Operations');
}
if ($table_info_num_rows == 0 && !$tbl_is_view) {
$tabs['browse']['warning'] = __('Table seems to be empty!');
$tabs['search']['warning'] = __('Table seems to be empty!');
}
echo PMA_generate_html_tabs($tabs, $url_params);
unset($tabs);
if (PMA_Tracker::isActive() and PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"])) {
$msg = PMA_Message::notice('<a href="tbl_tracking.php?' . $url_query . '">' . sprintf(__('Tracking of %s.%s is activated.'), htmlspecialchars($GLOBALS["db"]), htmlspecialchars($GLOBALS["table"])) . '</a>');
$msg->display();
}
/**
* Displays a message
*/
if (!empty($message)) {
PMA_showMessage($message);
unset($message);
}
示例5: PMA_DBI_try_query
/**
* runs a query and returns the result
*
* @param string $query query to run
* @param resource $link mysql link resource
* @param integer $options query options
* @param bool $cache_affected_rows whether to cache affected row
*
* @return mixed
*/
function PMA_DBI_try_query($query, $link = null, $options = 0, $cache_affected_rows = true)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
}
if ($GLOBALS['cfg']['DBG']['sql']) {
$time = microtime(true);
}
$r = PMA_DBI_real_query($query, $link, $options);
if ($cache_affected_rows) {
$GLOBALS['cached_affected_rows'] = PMA_DBI_affected_rows($link, $get_from_cache = false);
}
if ($GLOBALS['cfg']['DBG']['sql']) {
$time = microtime(true) - $time;
$hash = md5($query);
if (isset($_SESSION['debug']['queries'][$hash])) {
$_SESSION['debug']['queries'][$hash]['count']++;
} else {
$_SESSION['debug']['queries'][$hash] = array();
if ($r == false) {
$_SESSION['debug']['queries'][$hash]['error'] = '<b style="color:red">' . mysqli_error($link) . '</b>';
}
$_SESSION['debug']['queries'][$hash]['count'] = 1;
$_SESSION['debug']['queries'][$hash]['query'] = $query;
$_SESSION['debug']['queries'][$hash]['time'] = $time;
}
$trace = array();
foreach (debug_backtrace() as $trace_step) {
$trace[] = PMA_Error::relPath($trace_step['file']) . '#' . $trace_step['line'] . ': ' . (isset($trace_step['class']) ? $trace_step['class'] : '') . (isset($trace_step['type']) ? $trace_step['type'] : '') . (isset($trace_step['function']) ? $trace_step['function'] : '') . '(' . (isset($trace_step['params']) ? implode(', ', $trace_step['params']) : '') . ')';
}
$_SESSION['debug']['queries'][$hash]['trace'][] = $trace;
}
if ($r != false && PMA_Tracker::isActive() == true) {
PMA_Tracker::handleQuery($query);
}
return $r;
}
示例6: _getDbTabs
/**
* Returns the db tabs as an array
*
* @return array Data for generating db tabs
*/
private function _getDbTabs()
{
$db_is_system_schema = $GLOBALS['dbi']->isSystemSchema($this->_db);
$num_tables = count($GLOBALS['dbi']->getTables($this->_db));
$is_superuser = $GLOBALS['dbi']->isSuperuser();
$isCreateOrGrantUser = $GLOBALS['dbi']->isUserType('grant') || $GLOBALS['dbi']->isUserType('create');
/**
* Gets the relation settings
*/
$cfgRelation = PMA_getRelationsParam();
$tabs = array();
$tabs['structure']['link'] = 'db_structure.php';
$tabs['structure']['text'] = __('Structure');
$tabs['structure']['icon'] = 'b_props.png';
$tabs['sql']['link'] = 'db_sql.php';
$tabs['sql']['text'] = __('SQL');
$tabs['sql']['icon'] = 'b_sql.png';
$tabs['search']['text'] = __('Search');
$tabs['search']['icon'] = 'b_search.png';
$tabs['search']['link'] = 'db_search.php';
if ($num_tables == 0) {
$tabs['search']['warning'] = __('Database seems to be empty!');
}
$tabs['qbe']['text'] = __('Query');
$tabs['qbe']['icon'] = 's_db.png';
$tabs['qbe']['link'] = 'db_qbe.php';
if ($num_tables == 0) {
$tabs['qbe']['warning'] = __('Database seems to be empty!');
}
$tabs['export']['text'] = __('Export');
$tabs['export']['icon'] = 'b_export.png';
$tabs['export']['link'] = 'db_export.php';
if ($num_tables == 0) {
$tabs['export']['warning'] = __('Database seems to be empty!');
}
if (!$db_is_system_schema) {
$tabs['import']['link'] = 'db_import.php';
$tabs['import']['text'] = __('Import');
$tabs['import']['icon'] = 'b_import.png';
$tabs['operation']['link'] = 'db_operations.php';
$tabs['operation']['text'] = __('Operations');
$tabs['operation']['icon'] = 'b_tblops.png';
if (($is_superuser || $isCreateOrGrantUser) && !PMA_DRIZZLE) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivsdb'] = $this->_db;
// stay on database view
$tabs['privileges']['args']['viewing_mode'] = 'db';
$tabs['privileges']['text'] = __('Privileges');
$tabs['privileges']['icon'] = 's_rights.png';
}
if (!PMA_DRIZZLE) {
$tabs['routines']['link'] = 'db_routines.php';
$tabs['routines']['text'] = __('Routines');
$tabs['routines']['icon'] = 'b_routines.png';
}
if (!PMA_DRIZZLE && PMA_Util::currentUserHasPrivilege('EVENT', $this->_db)) {
$tabs['events']['link'] = 'db_events.php';
$tabs['events']['text'] = __('Events');
$tabs['events']['icon'] = 'b_events.png';
}
if (!PMA_DRIZZLE && PMA_Util::currentUserHasPrivilege('TRIGGER', $this->_db)) {
$tabs['triggers']['link'] = 'db_triggers.php';
$tabs['triggers']['text'] = __('Triggers');
$tabs['triggers']['icon'] = 'b_triggers.png';
}
}
if (PMA_Tracker::isActive()) {
$tabs['tracking']['text'] = __('Tracking');
$tabs['tracking']['icon'] = 'eye.png';
$tabs['tracking']['link'] = 'db_tracking.php';
}
if (!$db_is_system_schema) {
$tabs['designer']['text'] = __('Designer');
$tabs['designer']['icon'] = 'b_relations.png';
$tabs['designer']['link'] = 'db_designer.php';
$tabs['designer']['id'] = 'designer_tab';
}
if (!$db_is_system_schema && isset($cfgRelation['central_columnswork']) && $cfgRelation['central_columnswork']) {
$tabs['central_columns']['text'] = __('Central columns');
$tabs['central_columns']['icon'] = 'centralColumns.png';
$tabs['central_columns']['link'] = 'db_central_columns.php';
}
return $tabs;
}
示例7: PMA_getHtmlForOptionalActionLinks
/**
* Get HTML links for 'Print view', 'Relation view', 'Propose table structure',
* 'Track table' and 'Move columns'
*
* @param string $url_query url query
* @param boolean $tbl_is_view whether table is view or not
* @param boolean $db_is_system_schema whether db is information schema or not
* @param string $tbl_storage_engine table storage engine
* @param array $cfgRelation current relation parameters
*
* @return string $html_output
*/
function PMA_getHtmlForOptionalActionLinks($url_query, $tbl_is_view, $db_is_system_schema, $tbl_storage_engine, $cfgRelation)
{
$html_output = '<a href="tbl_printview.php?' . $url_query . '" target="print_view">' . PMA_Util::getIcon('b_print.png', __('Print view'), true) . '</a>';
if (!$tbl_is_view && !$db_is_system_schema) {
// if internal relations are available, or foreign keys are supported
// ($tbl_storage_engine comes from libraries/tbl_info.inc.php
if ($cfgRelation['relwork'] || PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
$html_output .= '<a href="tbl_relation.php?' . $url_query . '">' . PMA_Util::getIcon('b_relations.png', __('Relation view'), true) . '</a>';
}
if (!PMA_DRIZZLE) {
$html_output .= '<a href="sql.php?' . $url_query . '&session_max_rows=all&sql_query=' . urlencode('SELECT * FROM ' . PMA_Util::backquote($GLOBALS['table']) . ' PROCEDURE ANALYSE()') . '">' . PMA_Util::getIcon('b_tblanalyse.png', __('Propose table structure'), true) . '</a>';
$html_output .= PMA_Util::showMySQLDocu('procedure_analyse') . "\n";
}
if (PMA_Tracker::isActive()) {
$html_output .= '<a href="tbl_tracking.php?' . $url_query . '">' . PMA_Util::getIcon('eye.png', __('Track table'), true) . '</a>';
}
$html_output .= '<a href="#" id="move_columns_anchor">' . PMA_Util::getIcon('b_move.png', __('Move columns'), true) . '</a>';
}
return $html_output;
}
示例8: _getDbTabs
/**
* Returns the db tabs as an array
*
* @return array Data for generating db tabs
*/
private function _getDbTabs()
{
$db_is_information_schema = PMA_is_system_schema($this->_db);
$num_tables = count(PMA_DBI_get_tables($this->_db));
$is_superuser = PMA_isSuperuser();
/**
* Gets the relation settings
*/
$cfgRelation = PMA_getRelationsParam();
$tabs = array();
$tabs['structure']['link'] = 'db_structure.php';
$tabs['structure']['text'] = __('Structure');
$tabs['structure']['icon'] = 'b_props.png';
$tabs['sql']['link'] = 'db_sql.php';
$tabs['sql']['args']['db_query_force'] = 1;
$tabs['sql']['text'] = __('SQL');
$tabs['sql']['icon'] = 'b_sql.png';
$tabs['search']['text'] = __('Search');
$tabs['search']['icon'] = 'b_search.png';
$tabs['search']['link'] = 'db_search.php';
if ($num_tables == 0) {
$tabs['search']['warning'] = __('Database seems to be empty!');
}
$tabs['qbe']['text'] = __('Query');
$tabs['qbe']['icon'] = 's_db.png';
$tabs['qbe']['link'] = 'db_qbe.php';
if ($num_tables == 0) {
$tabs['qbe']['warning'] = __('Database seems to be empty!');
}
$tabs['export']['text'] = __('Export');
$tabs['export']['icon'] = 'b_export.png';
$tabs['export']['link'] = 'db_export.php';
if ($num_tables == 0) {
$tabs['export']['warning'] = __('Database seems to be empty!');
}
if (!$db_is_information_schema) {
$tabs['import']['link'] = 'db_import.php';
$tabs['import']['text'] = __('Import');
$tabs['import']['icon'] = 'b_import.png';
$tabs['operation']['link'] = 'db_operations.php';
$tabs['operation']['text'] = __('Operations');
$tabs['operation']['icon'] = 'b_tblops.png';
if ($is_superuser && !PMA_DRIZZLE) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivs'] = $this->_db;
// stay on database view
$tabs['privileges']['args']['viewing_mode'] = 'db';
$tabs['privileges']['text'] = __('Privileges');
$tabs['privileges']['icon'] = 's_rights.png';
}
if (!PMA_DRIZZLE) {
$tabs['routines']['link'] = 'db_routines.php';
$tabs['routines']['text'] = __('Routines');
$tabs['routines']['icon'] = 'b_routines.png';
}
if (PMA_MYSQL_INT_VERSION >= 50106 && !PMA_DRIZZLE && PMA_Util::currentUserHasPrivilege('EVENT', $this->_db)) {
$tabs['events']['link'] = 'db_events.php';
$tabs['events']['text'] = __('Events');
$tabs['events']['icon'] = 'b_events.png';
}
if (!PMA_DRIZZLE && PMA_Util::currentUserHasPrivilege('TRIGGER', $this->_db)) {
$tabs['triggers']['link'] = 'db_triggers.php';
$tabs['triggers']['text'] = __('Triggers');
$tabs['triggers']['icon'] = 'b_triggers.png';
}
}
if (PMA_Tracker::isActive()) {
$tabs['tracking']['text'] = __('Tracking');
$tabs['tracking']['icon'] = 'eye.png';
$tabs['tracking']['link'] = 'db_tracking.php';
}
if (!$db_is_information_schema && $cfgRelation['designerwork']) {
$tabs['designer']['text'] = __('Designer');
$tabs['designer']['icon'] = 'b_relations.png';
$tabs['designer']['link'] = 'pmd_general.php';
}
return $tabs;
}
示例9: PMA_DBI_try_query
/**
* runs a query and returns the result
*
* @param string $query query to run
* @param resource $link mysql link resource
* @param integer $options
* @return mixed
*/
function PMA_DBI_try_query($query, $link = null, $options = 0, $cache_affected_rows = true)
{
//print_r($query);
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
}
if ($GLOBALS['cfg']['DBG']['sql']) {
$time = microtime(true);
}
/*
if ($options == ($options | PMA_DBI_QUERY_STORE)) {
$r = mysql_query($query, $link);
} elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) {
$r = mysql_unbuffered_query($query, $link);
} else {
$r = mysql_query($query, $link);
}
*/
$stid = oci_parse($link, $query);
if (!$stid) {
$e = oci_error($link);
// For oci_execute errors pass the statement handle
PMA_mysqlDie($e['message'], $query);
}
$result_sql = oci_execute($stid);
if (!$result_sql) {
$e = oci_error($stid);
// For oci_execute errors pass the statement handle
//$error_str = ($e['message'])
//. ($e['sqltext']);
$sql_str = substr_replace($e['sqltext'], '^', $e['offset'], 0);
PMA_mysqlDie($e['message'], $sql_str);
}
$r = $stid;
if ($cache_affected_rows) {
$GLOBALS['cached_affected_rows'] = PMA_DBI_affected_rows($r, $get_from_cache = false);
}
if ($GLOBALS['cfg']['DBG']['sql']) {
$time = microtime(true) - $time;
$hash = md5($query);
if (isset($_SESSION['debug']['queries'][$hash])) {
$_SESSION['debug']['queries'][$hash]['count']++;
} else {
$_SESSION['debug']['queries'][$hash] = array();
$_SESSION['debug']['queries'][$hash]['count'] = 1;
$_SESSION['debug']['queries'][$hash]['query'] = $query;
$_SESSION['debug']['queries'][$hash]['time'] = $time;
}
$trace = array();
foreach (debug_backtrace() as $trace_step) {
$trace[] = PMA_Error::relPath($trace_step['file']) . '#' . $trace_step['line'] . ': ' . (isset($trace_step['class']) ? $trace_step['class'] : '') . (isset($trace_step['type']) ? $trace_step['type'] : '') . (isset($trace_step['function']) ? $trace_step['function'] : '') . '(' . (isset($trace_step['params']) ? implode(', ', $trace_step['params']) : '') . ')';
}
$_SESSION['debug']['queries'][$hash]['trace'][] = $trace;
}
if ($r != FALSE && PMA_Tracker::isActive() == TRUE) {
PMA_Tracker::handleQuery($query);
}
return $r;
}
示例10: PMA_getHtmlForOptionalActionLinks
/**
* Get HTML links for 'Print view', 'Relation view', 'Propose table structure',
* 'Track table' and 'Move columns'
*
* @param string $url_query url query
* @param boolean $tbl_is_view whether table is view or not
* @param boolean $db_is_system_schema whether db is information schema or not
*
* @return string $html_output
*/
function PMA_getHtmlForOptionalActionLinks($url_query, $tbl_is_view, $db_is_system_schema)
{
$html_output = '<a href="tbl_printview.php' . $url_query . '" target="print_view">' . PMA_Util::getIcon('b_print.png', __('Print view'), true) . '</a>';
if (!$tbl_is_view && !$db_is_system_schema) {
if (!PMA_DRIZZLE) {
$html_output .= '<a href="sql.php' . $url_query . '&session_max_rows=all&sql_query=' . urlencode('SELECT * FROM ' . PMA_Util::backquote($GLOBALS['table']) . ' PROCEDURE ANALYSE()') . '">' . PMA_Util::getIcon('b_tblanalyse.png', __('Propose table structure'), true) . '</a>';
$html_output .= PMA_Util::showMySQLDocu('procedure_analyse') . "\n";
}
if (PMA_Tracker::isActive()) {
$html_output .= '<a href="tbl_tracking.php' . $url_query . '">' . PMA_Util::getIcon('eye.png', __('Track table'), true) . '</a>';
}
$html_output .= '<a href="#" id="move_columns_anchor">' . PMA_Util::getIcon('b_move.png', __('Move columns'), true) . '</a>';
$html_output .= '<a href="normalization.php' . $url_query . '">' . PMA_Util::getIcon('normalize.png', __('Improve table structure'), true) . '</a>';
}
if ($tbl_is_view && !$db_is_system_schema) {
if (PMA_Tracker::isActive()) {
$html_output .= '<a href="tbl_tracking.php' . $url_query . '">' . PMA_Util::getIcon('eye.png', __('Track view'), true) . '</a>';
}
}
return $html_output;
}
示例11: PMA_DBI_try_query
/**
* runs a query and returns the result
*
* @param string $query query to run
* @param resource $link mysql link resource
* @param integer $options query options
* @param bool $cache_affected_rows whether to cache affected row
*
* @return mixed
*/
function PMA_DBI_try_query($query, $link = null, $options = 0, $cache_affected_rows = true)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
}
if ($GLOBALS['cfg']['DBG']['sql']) {
$time = microtime(true);
}
$result = PMA_DBI_real_query($query, $link, $options);
if ($cache_affected_rows) {
$GLOBALS['cached_affected_rows'] = PMA_DBI_affected_rows($link, $get_from_cache = false);
}
if ($GLOBALS['cfg']['DBG']['sql']) {
$time = microtime(true) - $time;
PMA_DBI_DBG_query($query, $link, $result, $time);
}
if ($result != false && PMA_Tracker::isActive() == true) {
PMA_Tracker::handleQuery($query);
}
return $result;
}
示例12: PMA_DBI_try_query
/**
* runs a query and returns the result
*
* @uses PMA_DBI_QUERY_STORE
* @uses PMA_DBI_QUERY_UNBUFFERED
* @uses $GLOBALS['userlink']
* @uses MYSQLI_STORE_RESULT
* @uses MYSQLI_USE_RESULT
* @uses mysqli_query()
* @uses defined()
* @param string $query query to execute
* @param object mysqli $link mysqli object
* @param integer $options
* @param boolean $cache_affected_rows
* @return mixed true, false or result object
*/
function PMA_DBI_try_query($query, $link = null, $options = 0, $cache_affected_rows = true)
{
if ($options == ($options | PMA_DBI_QUERY_STORE)) {
$method = MYSQLI_STORE_RESULT;
} elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) {
$method = MYSQLI_USE_RESULT;
} else {
$method = 0;
}
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
}
if ($GLOBALS['cfg']['DBG']['sql']) {
$time = microtime(true);
}
$r = mysqli_query($link, $query, $method);
if ($cache_affected_rows) {
$GLOBALS['cached_affected_rows'] = PMA_DBI_affected_rows($link, $get_from_cache = false);
}
if ($GLOBALS['cfg']['DBG']['sql']) {
$time = microtime(true) - $time;
$hash = md5($query);
if (isset($_SESSION['debug']['queries'][$hash])) {
$_SESSION['debug']['queries'][$hash]['count']++;
} else {
$_SESSION['debug']['queries'][$hash] = array();
$_SESSION['debug']['queries'][$hash]['count'] = 1;
$_SESSION['debug']['queries'][$hash]['query'] = $query;
$_SESSION['debug']['queries'][$hash]['time'] = $time;
}
$trace = array();
foreach (debug_backtrace() as $trace_step) {
$trace[] = PMA_Error::relPath($trace_step['file']) . '#' . $trace_step['line'] . ': ' . (isset($trace_step['class']) ? $trace_step['class'] : '') . (isset($trace_step['type']) ? $trace_step['type'] : '') . (isset($trace_step['function']) ? $trace_step['function'] : '') . '(' . (isset($trace_step['params']) ? implode(', ', $trace_step['params']) : '') . ')';
}
$_SESSION['debug']['queries'][$hash]['trace'][] = $trace;
}
if ($r != FALSE && PMA_Tracker::isActive() == TRUE) {
PMA_Tracker::handleQuery($query);
}
return $r;
// From the PHP manual:
// "note: returns true on success or false on failure. For SELECT,
// SHOW, DESCRIBE or EXPLAIN, mysqli_query() will return a result object"
// so, do not use the return value to feed mysqli_num_rows() if it's
// a boolean
}
示例13: PMA_URL_getCommon
require_once './libraries/bookmark.lib.php';
// Check parameters
PMA_Util::checkParameters(array('db', 'table'));
$db_is_system_schema = $GLOBALS['dbi']->isSystemSchema($db);
/**
* Set parameters for links
* @deprecated
*/
$url_query = PMA_URL_getCommon(array('db' => $db, 'table' => $table));
/**
* Set parameters for links
*/
$url_params = array();
$url_params['db'] = $db;
$url_params['table'] = $table;
/**
* Defines the urls to return to in case of error in a sql statement
*/
$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_URL_getCommon(array('db' => $db));
$err_url = $cfg['DefaultTabTable'] . PMA_URL_getCommon($url_params);
/**
* Ensures the database and the table exist (else move to the "parent" script)
*/
require_once './libraries/db_table_exists.lib.php';
if (PMA_Tracker::isActive() && PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"]) && !isset($_REQUEST['submit_deactivate_now']) && !(isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'sqldumpfile')) {
$temp_msg = '<a href="tbl_tracking.php' . $url_query . '">';
$temp_msg .= sprintf(__('Tracking of %s is activated.'), htmlspecialchars($GLOBALS["db"] . '.' . $GLOBALS["table"]));
$temp_msg .= '</a>';
$msg = PMA_Message::notice($temp_msg);
PMA_Response::getInstance()->addHTML($msg->getDisplay());
}
示例14: PMA_URL_getCommon
$db_is_system_schema = $GLOBALS['dbi']->isSystemSchema($db);
/**
* Set parameters for links
* @deprecated
*/
$url_query = PMA_URL_getCommon($db, $table);
/**
* Set parameters for links
*/
$url_params = array();
$url_params['db'] = $db;
$url_params['table'] = $table;
/**
* Defines the urls to return to in case of error in a sql statement
*/
$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_URL_getCommon(array('db' => $db));
$err_url = $cfg['DefaultTabTable'] . PMA_URL_getCommon($url_params);
/**
* Ensures the database and the table exist (else move to the "parent" script)
*/
require_once './libraries/db_table_exists.lib.php';
if (PMA_Tracker::isActive() && PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"]) && !isset($_REQUEST['submit_deactivate_now'])) {
$temp_msg = '<a href="tbl_tracking.php?' . $url_query . '">';
$temp_msg .= sprintf(__('Tracking of %s is activated.'), htmlspecialchars($GLOBALS["db"] . '.' . $GLOBALS["table"]));
$temp_msg .= '</a>';
$msg = PMA_Message::notice($temp_msg);
$msg->display();
}
?>
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
示例15: urlencode
if (!$db_is_information_schema) {
if (!empty($each_table['TABLE_ROWS'])) {
$empty_table = '<a ';
if ($GLOBALS['cfg']['AjaxEnable']) {
$empty_table .= 'class="truncate_table_anchor"';
}
$empty_table .= ' href="sql.php?' . $tbl_url_query . '&sql_query=';
$empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME'])) . '&message_to_show=' . urlencode(sprintf(__('Table %s has been emptied'), htmlspecialchars($each_table['TABLE_NAME']))) . '">' . $titles['Empty'] . '</a>';
} else {
$empty_table = $titles['NoEmpty'];
}
$drop_query = 'DROP ' . ($table_is_view ? 'VIEW' : 'TABLE') . ' ' . PMA_backquote($each_table['TABLE_NAME']);
$drop_message = sprintf($table_is_view ? __('View %s has been dropped') : __('Table %s has been dropped'), str_replace(' ', ' ', htmlspecialchars($each_table['TABLE_NAME'])));
}
$tracking_icon = '';
if (PMA_Tracker::isActive()) {
if (PMA_Tracker::isTracked($GLOBALS["db"], $truename)) {
$tracking_icon = '<a href="tbl_tracking.php?' . $url_query . '&table=' . $truename . '"><img class="icon" width="14" height="14" src="' . $pmaThemeImage . 'eye.png" alt="' . __('Tracking is active.') . '" title="' . __('Tracking is active.') . '" /></a>';
} elseif (PMA_Tracker::getVersion($GLOBALS["db"], $truename) > 0) {
$tracking_icon = '<a href="tbl_tracking.php?' . $url_query . '&table=' . $truename . '"><img class="icon" width="14" height="14" src="' . $pmaThemeImage . 'eye_grey.png" alt="' . __('Tracking is not active.') . '" title="' . __('Tracking is not active.') . '" /></a>';
}
}
if ($num_columns > 0 && $num_tables > $num_columns && $row_count % $num_columns == 0) {
$row_count = 1;
$odd_row = true;
?>
</tr>
</tbody>
</table>
<?php
PMA_TableHeader(false, $server_slave_status);