本文整理汇总了PHP中R::trash方法的典型用法代码示例。如果您正苦于以下问题:PHP R::trash方法的具体用法?PHP R::trash怎么用?PHP R::trash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类R
的用法示例。
在下文中一共展示了R::trash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_event
function delete_event($id)
{
$event = R::load('events', $id);
//reloads our event
R::trash($event);
//for one bean
}
示例2: clean
public static function clean($f3, $filename)
{
$total_filesize = R::getCell('select sum(filesize) as total_filesize from cache');
$cache_total_filesize_limit = $f3->get("UPLOAD.cache_total_size_limit");
$cache_total_filesize_limit = PFH_File_helper::convert_filesize_in_bytes($cache_total_filesize_limit);
if ($total_filesize > $cache_total_filesize_limit) {
$caches = R::find("cache", "ORDER BY datetime");
$count = count($caches);
// 只有一個不刪除
//if ($count < 2) {
// return;
//}
foreach ($caches as $key => $cache) {
//不刪除最後一個
//if ($key > $count - 1) {
// return;
//}
if ($cache->path === $filename) {
continue;
}
//throw new Exception("$key $cache->path");
//echo $cache->path . "<br />";
if (is_file($cache->path)) {
unlink($cache->path);
}
$total_filesize = $total_filesize - $cache->filesize;
R::trash($cache);
if ($total_filesize < $cache_total_filesize_limit) {
break;
}
}
}
}
示例3: delete_news
function delete_news($id)
{
$news = R::load('news', $id);
//reloads our event
R::trash($news);
//for one bean
}
示例4: doDeleteById
public static function doDeleteById($id)
{
$user = R::dispense('user');
$user->id = $id;
R::trash($user);
//for one bean
}
示例5: deleteFromList
public function deleteFromList($id)
{
$ban = R::load('banlist', $id);
$value = $ban->value;
R::trash($ban);
return $value;
}
示例6: testRebuilder
/**
* Test SQLite table rebuilding.
*
* @return void
*/
public function testRebuilder()
{
$toolbox = R::$toolbox;
$adapter = $toolbox->getDatabaseAdapter();
$writer = $toolbox->getWriter();
$redbean = $toolbox->getRedBean();
$pdo = $adapter->getDatabase();
R::dependencies(array('page' => array('book')));
$book = R::dispense('book');
$page = R::dispense('page');
$book->ownPage[] = $page;
$id = R::store($book);
$book = R::load('book', $id);
asrt(count($book->ownPage), 1);
asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 1);
R::trash($book);
asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 0);
$book = R::dispense('book');
$page = R::dispense('page');
$book->ownPage[] = $page;
$id = R::store($book);
$book = R::load('book', $id);
asrt(count($book->ownPage), 1);
asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 1);
$book->added = 2;
R::store($book);
$book->added = 'added';
R::store($book);
R::trash($book);
asrt((int) R::getCell('SELECT COUNT(*) FROM page'), 0);
}
示例7: delrole
/**
* Check for a role
*
* @param string $contextname The name of a context...
* @param string $rolename The name of a role....
*
* @return void
*/
public function delrole($contextname, $rolename)
{
$cname = R::findOne('rolecontext', 'name=?', array($contextname));
$rname = R::findOne('rolename', 'name=?', array($rolename));
$bn = R::findOne('role', 'rolecontext_id=? and rolename_id=? and user_id=? and start <= UTC_TIMESTAMP() and (end is NULL or end >= UTC_TIMESTAMP())', array($cname->getID(), $rname->getID(), $this->bean->getID()));
if (is_object($bn)) {
R::trash($bn);
}
}
示例8: eliminar
public static function eliminar()
{
if (isset($_GET['id'])) {
$user = R::load('user', $_GET['id']);
$username = $user->name;
R::trash($user);
//$_SESSION['flash'] = "Usuario $username eliminado exitosamente";
}
}
示例9: destruir
public static function destruir()
{
global $session, $logged;
if (isset($logged) && isset($session)) {
R::trash($session);
setcookie("logged", "", time() - 1);
$_SESSION['flash'] = 'Ha cerrado sesión correctamente';
}
header('Location:/');
}
示例10: clearInvalidLoginAttempts
/**
* Function to clear invalid login attempts
* @param string $username email or username of user
* @return int login attempts left
* **/
public function clearInvalidLoginAttempts($username)
{
$userRow = \R::findOne('users', 'email=:ui OR user_name = :ui', array(':ui' => $username));
if ($userRow) {
$userAttemptRow = \R::findOne($this->_name, 'user_id = :ui', array(':ui' => $userRow->id));
if ($userAttemptRow) {
\R::trash($userAttemptRow);
}
}
}
示例11: delete_page
public function delete_page($args)
{
$page_id = array_shift($args);
if ($page = R::load('page', $page_id)) {
$old = clone $page;
R::trash($page);
Audit::create($old, NULL, 'Developer deleted page from system');
}
$this->redirect(PACKAGE_URL);
}
示例12: deleteMessage
public function deleteMessage($user_id, $m_id)
{
$message = R::findOne('message', ' recipient_id = ? && id = ? ', [$user_id, $m_id]);
if ($message == NULL) {
return NULL;
}
R::trash($message);
$data = array("rc" => 0);
return json_encode($data);
}
示例13: deleteCity
public function deleteCity()
{
$count = R::count('jobs', " city=:city ", array(':city' => $this->_id));
if (!$count) {
$city = R::load('cities', $this->_id);
R::trash($city);
return true;
}
return false;
}
示例14: show_deleteUser
public function show_deleteUser()
{
if ($this->user->password != Framework::hash($_POST['password'])) {
$this->error('Das Passwort war falsch!');
}
R::trash($this->user);
$this->show_Logoff();
$this->output('deleted', true);
$this->output('message', 'Der Account wurde gelöscht.');
}
示例15: deleteCategory
public function deleteCategory()
{
$count = R::count('jobs', " category=:category ", array(':category' => $this->_id));
if (!$count) {
$category = R::load('categories', $this->_id);
R::trash($category);
return true;
}
return false;
}