• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP unset_cache_flag函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中unset_cache_flag函数的典型用法代码示例。如果您正苦于以下问题:PHP unset_cache_flag函数的具体用法?PHP unset_cache_flag怎么用?PHP unset_cache_flag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了unset_cache_flag函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: set_cache_flag

/**
 * Set a volatile flag
 *
 * @param string $type the "type" namespace for the key
 * @param string $name the key to set
 * @param string $value the value to set (without magic quotes) - null will remove the flag
 * @param int $expiry (optional) epoch indicating expiry - defaults to now()+ 24hs
 * @return bool Always returns true
 */
function set_cache_flag($type, $name, $value, $expiry = null)
{
    global $DB;
    $timemodified = time();
    if ($expiry === null || $expiry < $timemodified) {
        $expiry = $timemodified + 24 * 60 * 60;
    } else {
        $expiry = (int) $expiry;
    }
    if ($value === null) {
        unset_cache_flag($type, $name);
        return true;
    }
    if ($f = $DB->get_record('cache_flags', array('name' => $name, 'flagtype' => $type), '*', IGNORE_MULTIPLE)) {
        // This is a potential problem in DEBUG_DEVELOPER.
        if ($f->value == $value and $f->expiry == $expiry and $f->timemodified == $timemodified) {
            return true;
            // No need to update.
        }
        $f->value = $value;
        $f->expiry = $expiry;
        $f->timemodified = $timemodified;
        $DB->update_record('cache_flags', $f);
    } else {
        $f = new stdClass();
        $f->flagtype = $type;
        $f->name = $name;
        $f->value = $value;
        $f->expiry = $expiry;
        $f->timemodified = $timemodified;
        $DB->insert_record('cache_flags', $f);
    }
    return true;
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:43,代码来源:moodlelib.php


示例2: ntlmsso_finish

 /**
  * Find the session set by ntlmsso_magic(), validate it and
  * call authenticate_user_login() to authenticate the user through
  * the auth machinery.
  *
  * It is complemented by a similar check in user_login().
  *
  * If it succeeds, it never returns.
  *
  */
 function ntlmsso_finish()
 {
     global $CFG, $USER, $SESSION;
     $key = sesskey();
     $cf = get_cache_flags($this->pluginconfig . '/ntlmsess');
     if (!isset($cf[$key]) || $cf[$key] === '') {
         return false;
     }
     $username = $cf[$key];
     // Here we want to trigger the whole authentication machinery
     // to make sure no step is bypassed...
     $user = authenticate_user_login($username, $key);
     if ($user) {
         complete_user_login($user);
         // Cleanup the key to prevent reuse...
         // and to allow re-logins with normal credentials
         unset_cache_flag($this->pluginconfig . '/ntlmsess', $key);
         // Redirection
         if (user_not_fully_set_up($USER)) {
             $urltogo = $CFG->wwwroot . '/user/edit.php';
             // We don't delete $SESSION->wantsurl yet, so we get there later
         } else {
             if (isset($SESSION->wantsurl) and strpos($SESSION->wantsurl, $CFG->wwwroot) === 0) {
                 $urltogo = $SESSION->wantsurl;
                 // Because it's an address in this site
                 unset($SESSION->wantsurl);
             } else {
                 // No wantsurl stored or external - go to homepage
                 $urltogo = $CFG->wwwroot . '/';
                 unset($SESSION->wantsurl);
             }
         }
         // We do not want to redirect if we are in a PHPUnit test.
         if (!PHPUNIT_TEST) {
             redirect($urltogo);
         }
     }
     // Should never reach here.
     return false;
 }
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:50,代码来源:auth.php


示例3: set_cache_flag

/**
 * Set a volatile flag
 *
 * @param string $type the "type" namespace for the key
 * @param string $name the key to set
 * @param string $value the value to set (without magic quotes) - NULL will remove the flag
 * @param int $expiry (optional) epoch indicating expiry - defaults to now()+ 24hs
 * @return bool
 */
function set_cache_flag($type, $name, $value, $expiry = NULL)
{
    $timemodified = time();
    if ($expiry === NULL || $expiry < $timemodified) {
        $expiry = $timemodified + 24 * 60 * 60;
    } else {
        $expiry = (int) $expiry;
    }
    if ($value === NULL) {
        return unset_cache_flag($type, $name);
    }
    $type = addslashes($type);
    $name = addslashes($name);
    if ($f = get_record('cache_flags', 'name', $name, 'flagtype', $type)) {
        // this is a potentail problem in DEBUG_DEVELOPER
        if ($f->value == $value and $f->expiry == $expiry and $f->timemodified == $timemodified) {
            return true;
            //no need to update; helps rcache too
        }
        $f->value = addslashes($value);
        $f->expiry = $expiry;
        $f->timemodified = $timemodified;
        return update_record('cache_flags', $f);
    } else {
        $f = new object();
        $f->flagtype = $type;
        $f->name = $name;
        $f->value = addslashes($value);
        $f->expiry = $expiry;
        $f->timemodified = $timemodified;
        return (bool) insert_record('cache_flags', $f);
    }
}
开发者ID:nadavkav,项目名称:rtlMoodle,代码行数:42,代码来源:moodlelib.php


示例4: set_cache_flag

/**
 * Set a volatile flag
 *
 * @param string $type the "type" namespace for the key
 * @param string $name the key to set
 * @param string $value the value to set (without magic quotes) - NULL will remove the flag
 * @param int $expiry (optional) epoch indicating expiry - defaults to now()+ 24hs
 * @return bool
 */
function set_cache_flag($type, $name, $value, $expiry = NULL)
{
    $timemodified = time();
    if ($expiry === NULL || $expiry < $timemodified) {
        $expiry = $timemodified + 24 * 60 * 60;
    } else {
        $expiry = (int) $expiry;
    }
    if ($value === NULL) {
        return unset_cache_flag($type, $name);
    }
    $type = addslashes($type);
    $name = addslashes($name);
    $value = addslashes($value);
    if ($f = get_record('cache_flags', 'name', $name, 'flagtype', $type)) {
        $f->value = $value;
        $f->expiry = $expiry;
        $f->timemodified = $timemodified;
        return update_record('cache_flags', $f);
    } else {
        $f = new StdClass();
        $f->flagtype = $type;
        $f->name = $name;
        $f->value = $value;
        $f->expiry = $expiry;
        $f->timemodified = $timemodified;
        return insert_record('cache_flags', $f);
    }
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:38,代码来源:moodlelib.php


示例5: ntlmsso_finish

 /**
  * Find the session set by ntlmsso_magic(), validate it and 
  * call authenticate_user_login() to authenticate the user through
  * the auth machinery.
  * 
  * It is complemented by a similar check in user_login().
  * 
  * If it succeeds, it never returns. 
  *
  */
 function ntlmsso_finish()
 {
     global $CFG, $USER, $SESSION;
     $key = sesskey();
     $cf = get_cache_flags('auth/ldap/ntlmsess');
     if (!isset($cf[$key]) || $cf[$key] === '') {
         return false;
     }
     $username = $cf[$key];
     // Here we want to trigger the whole authentication machinery
     // to make sure no step is bypassed...
     $user = authenticate_user_login($username, $key);
     if ($user) {
         add_to_log(SITEID, 'user', 'login', "view.php?id={$USER->id}&course=" . SITEID, $user->id, 0, $user->id);
         $USER = complete_user_login($user);
         // Cleanup the key to prevent reuse...
         // and to allow re-logins with normal credentials
         unset_cache_flag('auth/ldap/ntlmsess', $key);
         /// Redirection
         if (user_not_fully_set_up($USER)) {
             $urltogo = $CFG->wwwroot . '/user/edit.php';
             // We don't delete $SESSION->wantsurl yet, so we get there later
         } else {
             if (isset($SESSION->wantsurl) and strpos($SESSION->wantsurl, $CFG->wwwroot) === 0) {
                 $urltogo = $SESSION->wantsurl;
                 /// Because it's an address in this site
                 unset($SESSION->wantsurl);
             } else {
                 // no wantsurl stored or external - go to homepage
                 $urltogo = $CFG->wwwroot . '/';
                 unset($SESSION->wantsurl);
             }
         }
         redirect($urltogo);
     }
     // Should never reach here.
     return false;
 }
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:48,代码来源:auth.php


示例6: set_cache_flag

/**
 * Set a volatile flag
 *
 * @param string $type the "type" namespace for the key
 * @param string $name the key to set
 * @param string $value the value to set (without magic quotes) - NULL will remove the flag
 * @param int $expiry (optional) epoch indicating expiry - defaults to now()+ 24hs
 * @return bool
 */
function set_cache_flag($type, $name, $value, $expiry = NULL)
{
    global $DB;
    $timemodified = time();
    if ($expiry === NULL || $expiry < $timemodified) {
        $expiry = $timemodified + 24 * 60 * 60;
    } else {
        $expiry = (int) $expiry;
    }
    if ($value === NULL) {
        unset_cache_flag($type, $name);
        return true;
    }
    if ($f = $DB->get_record('cache_flags', array('name' => $name, 'flagtype' => $type))) {
        // this is a potentail problem in DEBUG_DEVELOPER
        if ($f->value == $value and $f->expiry == $expiry and $f->timemodified == $timemodified) {
            return true;
            //no need to update; helps rcache too
        }
        $f->value = $value;
        $f->expiry = $expiry;
        $f->timemodified = $timemodified;
        $DB->update_record('cache_flags', $f);
    } else {
        $f = new object();
        $f->flagtype = $type;
        $f->name = $name;
        $f->value = $value;
        $f->expiry = $expiry;
        $f->timemodified = $timemodified;
        $DB->insert_record('cache_flags', $f);
    }
    return true;
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:43,代码来源:moodlelib.php



注:本文中的unset_cache_flag函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP unset_config函数代码示例发布时间:2022-05-23
下一篇:
PHP unset_all_config_for_plugin函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap