本文整理汇总了PHP中OC_Preferences::deleteUser方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Preferences::deleteUser方法的具体用法?PHP OC_Preferences::deleteUser怎么用?PHP OC_Preferences::deleteUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Preferences
的用法示例。
在下文中一共展示了OC_Preferences::deleteUser方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
$userId = OCA_mozilla_sync\User::userHashToId($this->userHash);
if ($userId != false) {
OCA_mozilla_sync\User::deleteUser($userId);
}
OC_Preferences::deleteUser($this->userName);
OC_User::deleteUser($this->userName);
}
示例2: tearDown
public function tearDown()
{
$this->user = null;
if ($this->storageMock) {
$this->storageMock->getCache()->clear();
$this->storageMock = null;
}
\OC\Files\Filesystem::tearDown();
\OC_User::setUserId('');
\OC_User::deleteUser($this->user);
\OC_Preferences::deleteUser($this->user);
}
示例3: testHomeStorageWrapperWithQuota
/**
* Tests that the home storage is not wrapped when no quota exists.
*/
function testHomeStorageWrapperWithQuota()
{
$user1 = uniqid();
\OC_User::createUser($user1, 'test');
OC_Preferences::setValue($user1, 'files', 'quota', '1024');
\OC_User::setUserId($user1);
\OC_Util::setupFS($user1);
$userMount = \OC\Files\Filesystem::getMountManager()->find('/' . $user1 . '/');
$this->assertNotNull($userMount);
$this->assertTrue($userMount->getStorage()->instanceOfStorage('\\OC\\Files\\Storage\\Wrapper\\Quota'));
// ensure that root wasn't wrapped
$rootMount = \OC\Files\Filesystem::getMountManager()->find('/');
$this->assertNotNull($rootMount);
$this->assertNotInstanceOf('\\OC\\Files\\Storage\\Wrapper\\Quota', $rootMount->getStorage());
// clean up
\OC_User::setUserId('');
\OC_User::deleteUser($user1);
OC_Preferences::deleteUser($user1);
\OC_Util::tearDownFS();
}
示例4: deleteUser
/**
* @brief delete a user
* @param $uid The username of the user to delete
* @returns true/false
*
* Deletes a user
*/
public static function deleteUser($uid)
{
$run = true;
OC_Hook::emit("OC_User", "pre_deleteUser", array("run" => &$run, "uid" => $uid));
if ($run) {
//delete the user from all backends
foreach (self::$_usedBackends as $backend) {
$backend->deleteUser($uid);
}
if (self::userExists($uid)) {
return false;
}
// We have to delete the user from all groups
foreach (OC_Group::getUserGroups($uid) as $i) {
OC_Group::removeFromGroup($uid, $i);
}
// Delete the user's keys in preferences
OC_Preferences::deleteUser($uid);
// Delete user files in /data/
OC_Helper::rmdirr(OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data") . '/' . $uid . '/');
// Emit and exit
OC_Hook::emit("OC_User", "post_deleteUser", array("uid" => $uid));
return true;
} else {
return false;
}
}
示例5: deleteUser
/**
* @brief delete a user
* @param $uid The username of the user to delete
* @returns true/false
*
* Deletes a user
*/
public static function deleteUser($uid)
{
$run = true;
OC_Hook::emit("OC_User", "pre_deleteUser", array("run" => &$run, "uid" => $uid));
if ($run) {
//delete the user from all backends
foreach (self::$_usedBackends as $backend) {
if ($backend->implementsActions(OC_USER_BACKEND_DELETE_USER)) {
$backend->deleteUser($uid);
}
}
// We have to delete the user from all groups
foreach (OC_Group::getUserGroups($uid) as $i) {
OC_Group::removeFromGroup($uid, $i);
}
// Delete the user's keys in preferences
OC_Preferences::deleteUser($uid);
// Emit and exit
OC_Hook::emit("OC_User", "post_deleteUser", array("uid" => $uid));
return true;
} else {
return false;
}
}
示例6: testDeleteUser
public function testDeleteUser()
{
$this->assertTrue(\OC_Preferences::deleteUser('Deleteuser'));
$query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?');
$result = $query->execute(array('Deleteuser'));
$this->assertEquals(0, count($result->fetchAll()));
}
示例7: deleteUser
/**
* @brief delete a user
* @param string $uid The username of the user to delete
* @return bool
*
* Deletes a user
*/
public static function deleteUser($uid)
{
$user = self::getManager()->get($uid);
if ($user) {
$result = $user->delete();
// if delete was successful we clean-up the rest
if ($result) {
// We have to delete the user from all groups
foreach (OC_Group::getUserGroups($uid) as $i) {
OC_Group::removeFromGroup($uid, $i);
}
// Delete the user's keys in preferences
OC_Preferences::deleteUser($uid);
// Delete user files in /data/
$home = \OC_User::getHome($uid);
OC_Helper::rmdirr($home);
// Delete the users entry in the storage table
\OC\Files\Cache\Storage::remove('home::' . $uid);
\OC\Files\Cache\Storage::remove('local::' . $home . '/');
// Remove it from the Cache
self::getManager()->delete($uid);
}
return true;
} else {
return false;
}
}