本文整理汇总了PHP中moodle_database::delete_records方法的典型用法代码示例。如果您正苦于以下问题:PHP moodle_database::delete_records方法的具体用法?PHP moodle_database::delete_records怎么用?PHP moodle_database::delete_records使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moodle_database
的用法示例。
在下文中一共展示了moodle_database::delete_records方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler_destroy
/**
* Destroy session handler.
*
* {@see http://php.net/manual/en/function.session-set-save-handler.php}
*
* @param string $sid
* @return bool success
*/
public function handler_destroy($sid)
{
if (!($session = $this->database->get_record('sessions', array('sid' => $sid), 'id, sid'))) {
if ($sid == session_id()) {
$this->recordid = null;
$this->lasthash = null;
}
return true;
}
if ($this->recordid and $session->id == $this->recordid) {
try {
$this->database->release_session_lock($this->recordid);
} catch (\Exception $ex) {
// Ignore problems.
}
$this->recordid = null;
$this->lasthash = null;
}
$this->database->delete_records('sessions', array('id' => $session->id));
return true;
}
示例2: clear_cache
/**
* Completely clear the cache.
* @param moodle_database $db the database connection to use to access the cache.
*/
public static function clear_cache($db)
{
// Delete the cache records from the database.
$db->delete_records('qtype_stack_cas_cache');
// Also take this opportunity to empty the plots folder on disc.
$plots = glob(stack_cas_configuration::images_location() . '/*.png');
foreach ($plots as $plot) {
unlink($plot);
}
}