本文整理汇总了PHP中PMA_deleteUser函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_deleteUser函数的具体用法?PHP PMA_deleteUser怎么用?PHP PMA_deleteUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_deleteUser函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPMADeleteUser
/**
* Tests for PMA_deleteUser
*
* @return void
*/
function testPMADeleteUser()
{
//Mock DBI
$dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
$dbi->expects($this->any())->method('tryQuery')->will($this->onConsecutiveCalls(true, true, false));
$dbi->expects($this->any())->method('getError')->will($this->returnValue('Some error occurred!'));
$GLOBALS['dbi'] = $dbi;
// Test case 1 : empty queries
$queries = array();
$actual = PMA_deleteUser($queries);
$this->assertArrayHasKey(0, $actual);
$this->assertArrayHasKey(1, $actual);
$this->assertEquals('', $actual[0]);
$this->assertEquals('No users selected for deleting!', $actual[1]->getMessage());
// Test case 2 : all successful queries
$_REQUEST['mode'] = 3;
$queries = array('foo');
$actual = PMA_deleteUser($queries);
$this->assertArrayHasKey(0, $actual);
$this->assertArrayHasKey(1, $actual);
$this->assertEquals("foo\n# Reloading the privileges …\nFLUSH PRIVILEGES;", $actual[0]);
$this->assertEquals('The selected users have been deleted successfully.', $actual[1]->getMessage());
// Test case 3 : failing queries
$_REQUEST['mode'] = 1;
$queries = array('bar');
$actual = PMA_deleteUser($queries);
$this->assertArrayHasKey(0, $actual);
$this->assertArrayHasKey(1, $actual);
$this->assertEquals("bar", $actual[0]);
$this->assertEquals('Some error occurred!' . "\n", $actual[1]->getMessage());
}
示例2: list
list($message, $sql_query) = PMA_getMessageAndSqlQueryForPrivilegesRevoke(isset($dbname) ? $dbname : '', isset($tablename) ? $tablename : '', $username, $hostname);
}
/**
* Updates the password
*/
if (isset($_REQUEST['change_pw'])) {
$message = PMA_updatePassword($err_url, $username, $hostname);
}
/**
* Deletes users
* (Changes / copies a user, part IV)
*/
if (isset($_REQUEST['delete']) || isset($_REQUEST['change_copy']) && $_REQUEST['mode'] < 4) {
$queries = PMA_getDataForDeleteUsers($queries);
if (empty($_REQUEST['change_copy'])) {
list($sql_query, $message) = PMA_deleteUser($queries);
}
}
/**
* Changes / copies a user, part V
*/
if (isset($_REQUEST['change_copy'])) {
$queries = PMA_getDataForQueries($queries, $queries_for_display);
$message = PMA_Message::success();
$sql_query = join("\n", $queries);
}
/**
* Reloads the privilege tables into memory
*/
$message_ret = PMA_updateMessageForReload();
if (isset($message_ret)) {