当前位置: 首页>>代码示例>>PHP>>正文


PHP manager::touch_session方法代码示例

本文整理汇总了PHP中Core\Session\manager::touch_session方法的典型用法代码示例。如果您正苦于以下问题:PHP manager::touch_session方法的具体用法?PHP manager::touch_session怎么用?PHP manager::touch_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core\Session\manager的用法示例。


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

示例1: session_touch

/**
 * Mark session as accessed, prevents timeouts.
 *
 * @deprecated since 2.6
 * @param string $sid
 */
function session_touch($sid)
{
    debugging('session_touch() is deprecated, use \\core\\session\\manager::touch_session() instead', DEBUG_DEVELOPER);
    \core\session\manager::touch_session($sid);
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:11,代码来源:deprecatedlib.php

示例2: test_touch_session

 public function test_touch_session()
 {
     global $DB;
     $this->resetAfterTest();
     $sid = md5('hokus');
     $record = new \stdClass();
     $record->state = 0;
     $record->sid = $sid;
     $record->sessdata = null;
     $record->userid = 2;
     $record->timecreated = time() - 60 * 60;
     $record->timemodified = time() - 30;
     $record->firstip = $record->lastip = '10.0.0.1';
     $record->id = $DB->insert_record('sessions', $record);
     $now = time();
     \core\session\manager::touch_session($sid);
     $updated = $DB->get_field('sessions', 'timemodified', array('id' => $record->id));
     $this->assertGreaterThanOrEqual($now, $updated);
     $this->assertLessThanOrEqual(time(), $updated);
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:20,代码来源:session_manager_test.php

示例3: foreach

 /**
  * Receives an array of usernames from a remote machine and prods their
  * sessions to keep them alive
  *
  * @param   array   $array      An array of usernames
  * @return  string              "All ok" or an error message
  */
 function keepalive_server($array)
 {
     global $CFG, $DB;
     $remoteclient = get_mnet_remote_client();
     // We don't want to output anything to the client machine
     $start = ob_start();
     // We'll get session records in batches of 30
     $superArray = array_chunk($array, 30);
     $returnString = '';
     foreach ($superArray as $subArray) {
         $subArray = array_values($subArray);
         $instring = "('" . implode("', '", $subArray) . "')";
         $query = "select id, session_id, username from {mnet_session} where username in {$instring}";
         $results = $DB->get_records_sql($query);
         if ($results == false) {
             // We seem to have a username that breaks our query:
             // TODO: Handle this error appropriately
             $returnString .= "We failed to refresh the session for the following usernames: \n" . implode("\n", $subArray) . "\n\n";
         } else {
             foreach ($results as $emigrant) {
                 \core\session\manager::touch_session($emigrant->session_id);
             }
         }
     }
     $end = ob_end_clean();
     if (empty($returnString)) {
         return array('code' => 0, 'message' => 'All ok', 'last log id' => $remoteclient->last_log_id);
     }
     return array('code' => 1, 'message' => $returnString, 'last log id' => $remoteclient->last_log_id);
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:37,代码来源:auth.php

示例4: header

//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Ensure that session is kept alive.
 *
 * @copyright 2014 Andrew Nicols
 * @package   core
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define('AJAX_SCRIPT', true);
require_once __DIR__ . '/../config.php';
// Require the session key - want to make sure that this isn't called
// maliciously to keep a session alive longer than intended.
if (!confirm_sesskey()) {
    header('HTTP/1.1 403 Forbidden');
    print_error('invalidsesskey');
}
// Update the session.
\core\session\manager::touch_session(session_id());
开发者ID:evltuma,项目名称:moodle,代码行数:30,代码来源:sessionkeepalive_ajax.php


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