本文整理汇总了PHP中PMA_filterTracking函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_filterTracking函数的具体用法?PHP PMA_filterTracking怎么用?PHP PMA_filterTracking使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_filterTracking函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPMAFilterTracking
/**
* Tests for PMA_filterTracking() method.
*
* @return void
* @test
*/
public function testPMAFilterTracking()
{
$data = array(array("date" => "20120102", "username" => "username1", "statement" => "statement1"), array("date" => "20130102", "username" => "username2", "statement" => "statement2"));
$filter_ts_from = 0;
$filter_ts_to = 999999999999;
$filter_users = array("username1");
$ret = PMA_filterTracking($data, $filter_ts_from, $filter_ts_to, $filter_users);
$this->assertEquals('username1', $ret[0]['username']);
$this->assertEquals('statement1', $ret[0]['statement']);
}
示例2: PMA_getEntries
/**
* Function to get the entries
*
* @param array $data data
* @param int $filter_ts_from filter time stamp from
* @param int $filter_ts_to filter time stamp to
* @param array $filter_users filter users
*
* @return array
*/
function PMA_getEntries($data, $filter_ts_from, $filter_ts_to, $filter_users)
{
$entries = array();
// Filtering data definition statements
if ($_REQUEST['logtype'] == 'schema' || $_REQUEST['logtype'] == 'schema_and_data') {
$entries = array_merge($entries, PMA_filterTracking($data['ddlog'], $filter_ts_from, $filter_ts_to, $filter_users));
}
// Filtering data manipulation statements
if ($_REQUEST['logtype'] == 'data' || $_REQUEST['logtype'] == 'schema_and_data') {
$entries = array_merge($entries, PMA_filterTracking($data['dmlog'], $filter_ts_from, $filter_ts_to, $filter_users));
}
// Sort it
$ids = $timestamps = $usernames = $statements = array();
foreach ($entries as $key => $row) {
$ids[$key] = $row['id'];
$timestamps[$key] = $row['timestamp'];
$usernames[$key] = $row['username'];
$statements[$key] = $row['statement'];
}
array_multisort($timestamps, SORT_ASC, $ids, SORT_ASC, $usernames, SORT_ASC, $statements, SORT_ASC, $entries);
return $entries;
}