当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_Tracker::activateTracking方法代码示例

本文整理汇总了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
        );
    }
开发者ID:roccivic,项目名称:phpmyadmin,代码行数:62,代码来源:PMA_Tracker_test.php

示例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";
开发者ID:shishenkov,项目名称:zpanel,代码行数:31,代码来源:tbl_tracking.php

示例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;
}
开发者ID:saisai,项目名称:phpmyadmin,代码行数:15,代码来源:tracking.lib.php


注:本文中的PMA_Tracker::activateTracking方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。