本文整理汇总了PHP中PMA_Tracker::getVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Tracker::getVersion方法的具体用法?PHP PMA_Tracker::getVersion怎么用?PHP PMA_Tracker::getVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Tracker
的用法示例。
在下文中一共展示了PMA_Tracker::getVersion方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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_information_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_information_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">' . $truename . '</a>';
if (!$db_is_information_schema) {
$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_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);
}
示例2: urlencode
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);
}
$ignored = false;
$do = false;
示例3: testGetVersion
/**
* Test for PMA_Tracker::getVersion()
*
* @return void
* @test
*/
public function testGetVersion()
{
if (! PMA_HAS_RUNKIT) {
$this->markTestSkipped("Cannot redefine constant");
}
$reflection = new \ReflectionProperty('PMA_Tracker', 'pma_table');
$reflection->setAccessible(true);
$reflection->setValue(null, 'pma_table_tracking');
runkit_constant_redefine("PMA_DRIZZLE", true);
$sql_query = " SELECT MAX(version) FROM pma_table_tracking" .
" WHERE `db_name` = 'pma''db' " .
" AND `table_name` = 'pma''table' ";
$sql_query_drizzle = ' AND tracking & 1 <> 0';
$sql_query_non_drizzle = " AND FIND_IN_SET('UPDATE',tracking) > 0" ;
$GLOBALS['controllink'] = null;
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->at(0))
->method('query')
->with($sql_query . $sql_query_drizzle, null, 0, false)
->will($this->returnValue("executed_1"));
$dbi->expects($this->at(1))
->method('fetchArray')
->with("executed_1")
->will($this->returnValue(array("executed_3")));
$dbi->expects($this->at(2))
->method('query')
->with($sql_query . $sql_query_non_drizzle, null, 0, false)
->will($this->returnValue("executed_2"));
$dbi->expects($this->at(3))
->method('fetchArray')
->with("executed_2")
->will($this->returnValue(array()));
$GLOBALS['dbi'] = $dbi;
// first assertion
$this->assertEquals(
"executed_3",
PMA_Tracker::getVersion("pma'db", "pma'table", "UPDATE")
);
// second assertion
runkit_constant_redefine("PMA_DRIZZLE", false);
$this->assertEquals(
-1,
PMA_Tracker::getVersion("pma'db", "pma'table", "UPDATE")
);
}
示例4: __
<table id="noversions" class="data">
<thead>
<tr>
<th style="width: 300px"><?php
echo __('Table');
?>
</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
// Print out list of untracked tables
$style = 'odd';
foreach ($my_tables as $key => $tablename) {
if (PMA_Tracker::getVersion($GLOBALS['db'], $tablename) == -1) {
$my_link = '<a href="tbl_tracking.php' . $url_query . '&table=' . htmlspecialchars($tablename) . '">';
$my_link .= PMA_Util::getIcon('eye.png', __('Track table'));
$my_link .= '</a>';
?>
<tr class="noclick <?php
echo $style;
?>
">
<td><?php
echo htmlspecialchars($tablename);
?>
</td>
<td><?php
echo $my_link;
?>
示例5: unset
if (isset($formatted_overhead)) {
$overhead = $formatted_overhead . ' ' . $overhead_unit;
unset($formatted_overhead);
} else {
$overhead = '-';
}
}
$new_table_string = '<tr>' . "\n";
$new_table_string .= '<td align="center"> <input type="checkbox" id="checkbox_tbl_" name="selected_tbl[]" value="' . htmlspecialchars($table) . '" /> </td>' . "\n";
$new_table_string .= '<th>';
$new_table_string .= '<a href="sql.php' . PMA_generate_common_url($tbl_url_params) . '">' . htmlspecialchars($table) . '</a>';
if (PMA_Tracker::isActive()) {
$truename = str_replace(' ', ' ', htmlspecialchars($table));
if (PMA_Tracker::isTracked($db, $truename)) {
$new_table_string .= '<a href="tbl_tracking.php' . PMA_generate_common_url($tbl_url_params) . '"><img class="icon" width="14" height="14" src="' . $pmaThemeImage . 'eye.png" alt="' . __('Tracking is active.') . '" title="' . __('Tracking is active.') . '" /></a>';
} elseif (PMA_Tracker::getVersion($db, $truename) > 0) {
$new_table_string .= '<a href="tbl_tracking.php' . PMA_generate_common_url($tbl_url_params) . '"><img class="icon" width="14" height="14" src="' . $pmaThemeImage . 'eye_grey.png" alt="' . __('Tracking is not active.') . '" title="' . __('Tracking is not active.') . '" /></a>';
}
unset($truename);
}
$new_table_string .= '</th>' . "\n";
$new_table_string .= '<td>' . $titles['NoBrowse'] . '</td>' . "\n";
$new_table_string .= '<td><a href="tbl_structure.php' . PMA_generate_common_url($tbl_url_params) . '">' . $titles['Structure'] . '</a></td>' . "\n";
$new_table_string .= '<td>' . $titles['NoSearch'] . '</td>' . "\n";
$new_table_string .= '<td><a href="tbl_change.php' . PMA_generate_common_url($tbl_url_params) . '">' . $titles['Insert'] . '</a></td>' . "\n";
$new_table_string .= '<td>' . $titles['NoEmpty'] . '</td>' . "\n";
$new_table_string .= '<td><a class="drop_table_anchor" href="sql.php' . PMA_generate_common_url($tbl_url_params) . '&sql_query=';
$new_table_string .= urlencode('DROP TABLE ' . PMA_backquote($table));
$new_table_string .= '">';
$new_table_string .= $titles['Drop'];
$new_table_string .= '</a></td>' . "\n";
示例6: PMA_getUntrackedTables
/**
* Get untracked tables
*
* @param string $db current database
*
* @return array $untracked_tables
*/
function PMA_getUntrackedTables($db)
{
$untracked_tables = array();
$sep = $GLOBALS['cfg']['NavigationTreeTableSeparator'];
// Get list of tables
$table_list = PMA_Util::getTableList($db);
// For each table try to get the tracking version
foreach ($table_list as $key => $value) {
// If $value is a table group.
if (array_key_exists('is' . $sep . 'group', $value) && $value['is' . $sep . 'group']) {
foreach ($value as $temp_table) {
// If $temp_table is a table with the value for 'Name' is set,
// rather than a property of the table group.
if (is_array($temp_table) && array_key_exists('Name', $temp_table)) {
$tracking_version = PMA_Tracker::getVersion($db, $temp_table['Name']);
if ($tracking_version == -1) {
$untracked_tables[] = $temp_table['Name'];
}
}
}
} else {
// If $value is a table.
if (PMA_Tracker::getVersion($db, $value['Name']) == -1) {
$untracked_tables[] = $value['Name'];
}
}
}
return $untracked_tables;
}