本文整理汇总了PHP中PMA_Tracker::activateTracking方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Tracker::activateTracking方法的具体用法?PHP PMA_Tracker::activateTracking怎么用?PHP PMA_Tracker::activateTracking使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Tracker
的用法示例。
在下文中一共展示了PMA_Tracker::activateTracking方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testChangeTracking
/**
* Test for PMA_Tracker::changeTracking(). This test is also invoked by two
* other tests: testActivateTracking() and testDeactivateTracking()
*
* @param string $dbname Database name
* @param string $tablename Table name
* @param string $version Version
* @param string $new_state State to change to
* @param string $type Type of test
*
* @return void
*
* @test
*
*/
public function testChangeTracking($dbname = 'pma_db', $tablename = 'pma_tbl',
$version = '0.1', $new_state = '1', $type = null
) {
$reflection = new \ReflectionProperty('PMA_Tracker', 'pma_table');
$reflection->setAccessible(true);
$reflection->setValue(null, 'pma_table_tracking');
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$sql_query = " UPDATE pma_table_tracking SET `tracking_active` = " .
"'" . $new_state ."' " .
" WHERE `db_name` = '". $dbname ."' " .
" AND `table_name` = '". $tablename ."' " .
" AND `version` = '". $version ."' ";
$GLOBALS['controllink'] = null;
$dbi->expects($this->exactly(1))
->method('query')
->with($sql_query, null, 0, false)
->will($this->returnValue("executed"));
$GLOBALS['dbi'] = $dbi;
if ($type == null) {
$method = new \ReflectionMethod('PMA_Tracker', '_changeTracking');
$method->setAccessible(true);
$result = $method->invoke(
null,
$dbname,
$tablename,
$version,
$new_state
);
} elseif ($type == "activate") {
$result = PMA_Tracker::activateTracking($dbname, $tablename, $version);
} elseif ($type == "deactivate") {
$result = PMA_Tracker::deactivateTracking($dbname, $tablename, $version);
}
$this->assertEquals(
'executed',
$result
);
}
示例2: rtrim
$tracking_set = rtrim($tracking_set, ',');
if (PMA_Tracker::createVersion($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'], $tracking_set)) {
$msg = PMA_Message::success(sprintf($strTrackingVersionCreated, $_REQUEST['version'], $GLOBALS['db'], $GLOBALS['table']));
$msg->display();
}
}
// Deactivate tracking
if (isset($_REQUEST['submit_deactivate_now'])) {
if (PMA_Tracker::deactivateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])) {
$msg = PMA_Message::success(sprintf($strTrackingVersionDeactivated, $GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version']));
$msg->display();
}
}
// Activate tracking
if (isset($_REQUEST['submit_activate_now'])) {
if (PMA_Tracker::activateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])) {
$msg = PMA_Message::success(sprintf($strTrackingVersionActivated, $GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version']));
$msg->display();
}
}
// Export as SQL execution
if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'execution') {
foreach ($entries as $entry) {
$sql_result = PMA_DBI_query("/*NOTRACK*/\n" . $entry['statement']);
}
$msg = PMA_Message::success($strTrackingSQLExecuted);
$msg->display();
}
// Export as SQL dump
if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'sqldump') {
$new_query = "# " . $strTrackingYouCanExecute . "\n" . "# " . $strTrackingCommentOut . "\n" . "\n" . "CREATE database IF NOT EXISTS pma_temp_db; \n" . "USE pma_temp_db; \n" . "\n";
示例3: PMA_activateTracking
/**
* Function to activate tracking
*
* @return string HTML for the success message
*/
function PMA_activateTracking()
{
$html = '';
$activated = PMA_Tracker::activateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version']);
if ($activated) {
$msg = PMA_Message::success(sprintf(__('Tracking for %1$s was activated at version %2$s.'), htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']), htmlspecialchars($_REQUEST['version'])));
$html .= $msg->getDisplay();
}
return $html;
}