Starts the lesson time for the current user
@return bool Returns true
323426
public function start_timer() {
        global $USER, $DB;

        $cm = get_coursemodule_from_instance('lesson', $this->properties()->id, $this->properties()->course,
            false, MUST_EXIST);

        // Trigger lesson started event.
        $event = \mod_lesson\event\lesson_started::create(array(
            'objectid' => $this->properties()->id,
            'context' => context_module::instance($cm->id),
            'courseid' => $this->properties()->course
        ));
        $event->trigger();

        $USER->startlesson[$this->properties->id] = true;

        $timenow = time();
        $startlesson = new stdClass;
        $startlesson->lessonid = $this->properties->id;
        $startlesson->userid = $USER->id;
        $startlesson->starttime = $timenow;
        $startlesson->lessontime = $timenow;
        if (WS_SERVER) {
            $startlesson->timemodifiedoffline = $timenow;
        }
        $DB->insert_record('lesson_timer', $startlesson);
        if ($this->properties->timelimit) {
            $this->add_message(get_string('timelimitwarning', 'lesson', format_time($this->properties->timelimit)), 'center');
        }
        return true;
    }
746383
public function start(): bool
    {
        if (!$this->started) {
            // check headers
            if (headers_sent($file, $line)) {
                throw new SessionException(sprintf("Cannot use '%s()', headers already sent in %s:%s",
                    __method__, $file, $line));
            }

            // start session
            $this->started = session_start();
            if (!$this->started) {
                session_write_close();
                throw new SessionException(sprintf("Session start failed in '%s()'", __method__));
            }

            // check id for last time
            if (session_id() !== $this->id) {
                session_write_close();
                throw new SessionException(sprintf("Session ID match failed in '%s()'", __method__));
            }

            // init sub-array
            if (!isset($_SESSION[$this->name])) {
                $_SESSION[$this->name] = [];
            }
        }

        return $this->started;
    }
659589
public function start() {
        if ($this->dialect) {
            //允许事务嵌套
            $this->transLevel += 1;
            $dialect          = $this->dialect;
            if ($dialect->inTransaction()) {
                return true;
            }
            $rst = $dialect->beginTransaction();
            if ($rst) {
                return true;
            } else {
                $this->transLevel -= 1;
            }
        }

        return false;
    }
375779
public function startCache()
    {
        global $USER;

        if ($this->arParams['CACHE_TYPE'] && $this->arParams['CACHE_TYPE'] !== 'N' && $this->arParams['CACHE_TIME'] > 0)
        {
            if ($this->templatePage)
            {
                $this->cacheAdditionalId[] = $this->templatePage;
            }

            if ($this->arParams['CACHE_GROUPS'] === 'Y')
            {
                $this->cacheAdditionalId[] = $USER->GetGroups();
            }

            if ($this->startResultCache($this->arParams['CACHE_TIME'], $this->cacheAdditionalId, $this->cacheDir))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        return true;
    }
977843
public function login()
    {
        if ($this->validate()) {
            return Podium::getInstance()->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
        }
        return false;
    }
399284
public function start()
    {
        $time = microtime(true);

        $this->startTime = $time;
        $this->lastTime = $time;

        $this->displayLine('step', 'time', 'delta', 'memory', 'peak');
        $this->addStep('Init debug');

        return $this;
    }
758781
public function timer_start()
    {
        $PAGELOADTIME = microtime();
        $PAGELOADTIME = explode(' ', $PAGELOADTIME);
        $PAGELOADTIME = $PAGELOADTIME[1] + $PAGELOADTIME[0];
        $this->basetime = $PAGELOADTIME;
    }
680354
public function execute() {
        global $CFG, $DB;

        require_once($CFG->libdir . '/bennu/bennu.inc.php');

        $time = time();
        $sql = "SELECT *
                  FROM {event_subscriptions}
                 WHERE pollinterval > 0
                   AND lastupdated + pollinterval < :time";
        $subscriptions = $DB->get_records_sql($sql, array('time' => $time));
        foreach ($subscriptions as $sub) {
            mtrace("Updating calendar subscription {$sub->name} in course {$sub->courseid}");
            try {
                $log = calendar_update_subscription_events($sub->id);
                mtrace(trim(strip_tags($log)));
            } catch (\moodle_exception $ex) {
                mtrace('Error updating calendar subscription: ' . $ex->getMessage());
            }
        }

        return true;
    }
758693
public function start()
    {
        if ($this->_started) {
            return true;
        }

        if ($this->_isCLI) {
            $_SESSION = [];
            $this->id('cli');

            return $this->_started = true;
        }

        if (session_status() === \PHP_SESSION_ACTIVE) {
            throw new RuntimeException('Session was already started');
        }

        if (ini_get('session.use_cookies') && headers_sent($file, $line)) {
            return false;
        }

        if (!session_start()) {
            throw new RuntimeException('Could not start the session');
        }

        $this->_started = true;

        if ($this->_timedOut()) {
            $this->destroy();

            return $this->start();
        }

        return $this->_started;
    }
776483
function start(): void {
        if($this->nativeHrtime) {
            $this->timer = \hrtime(true);
        } elseif($this->hrtime) {
            $this->timer->start();
        } else {
            $this->timer = \microtime(true);
        }
    }
729821
public function started()
	{
		// If it doesn't exist or isn't published
		if ($this->isNew())
		{
			return false;
		}

		if ($this->get('publish_up')
		 && $this->get('publish_up') != '0000-00-00 00:00:00'
		 && $this->get('publish_up') > Date::toSql())
		{
			return false;
		}

		return true;
	}
809670
public function start()
  {
    $rememberMe = Remember::$rememberMe;
    $loginResult = $rememberMe->login();

    if ($loginResult->isSuccess()) {
      $_SESSION['_uas'] = $loginResult->getCredential();
      $_SESSION['remembered_by_cookie'] = true;
      return;
    }

    if ($loginResult->hasPossibleManipulation()) {
      exit();
    }

    if ($loginResult->isExpired() && !empty($_SESSION['_uas']) && !empty($_SESSION['remembered_by_cookie'])) {
      $rememberMe->clearCookie();
      unset($_SESSION['_uas']);
      unset($_SESSION['remembered_by_cookie']);
      exit();
    }
    if ($loginResult->isExpired() && !empty($_SESSION['_uas'])) {
      sleep(5);
    }
  }
1348474
protected function refreshSession()
    {
        //  Get the user; be wary of admin's logged in as other people
        $oSession = Factory::service('Session', 'nails/module-auth');
        if ($this->wasAdmin()) {

            $recoveryData = $this->getAdminRecoveryData();

            if (!empty($recoveryData->newUserId)) {
                $me = $recoveryData->newUserId;
            } else {
                $me = $oSession->getUserData('id');
            }

        } else {
            $me = $oSession->getUserData('id');
        }

        //  Is anybody home? Hello...?
        if (!$me) {
            $me = $this->me;
            if (!$me) {
                return false;
            }
        }

        $me = $this->getById($me);

        // --------------------------------------------------------------------------

        /**
         * If the user is isn't found (perhaps deleted) or has been suspended then
         * obviously don't proceed with the log in
         */

        if (!$me || !empty($me->is_suspended)) {
            $this->clearRememberCookie();
            $this->clearActiveUser();
            $this->clearLoginData();
            $this->bIsLoggedIn = false;
            return false;
        }

        // --------------------------------------------------------------------------

        //  Store this entire user in memory
        $this->setActiveUser($me);

        // --------------------------------------------------------------------------

        //  Set the user's logged in flag
        $this->bIsLoggedIn = true;

        // --------------------------------------------------------------------------

        //  Update user's `last_seen` and `last_ip` properties
        $oDb    = Factory::service('Database');
        $oInput = Factory::service('Input');

        $oDb->set('last_seen', 'NOW()', false);
        $oDb->set('last_ip', $oInput->ipAddress());
        $oDb->where('id', $me->id);
        $oDb->update($this->table);

        return true;
    }
1305125
public function get_start() {

        if ($this->starttime !== null) {
            return $this->starttime;
        }

        // The field always exist but may have no valid if the course is created through a sync process.
        if (!empty($this->get_course_data()->startdate)) {
            $this->starttime = (int)$this->get_course_data()->startdate;
        } else {
            $this->starttime = 0;
        }

        return $this->starttime;
    }
1147057
public function start() {
        // NOTE: memcached before 2.2.0 expires session locks automatically after max_execution_time,
        //       this leads to major difference compared to other session drivers that timeout
        //       and stop the second request execution instead.

        $default = ini_get('max_execution_time');
        set_time_limit($this->acquiretimeout);

        $isnewsession = empty($_COOKIE[session_name()]);
        $starttimer = microtime(true);

        $result = parent::start();

        // If session_start returned TRUE, but it took as long
        // as the timeout value, and the $_SESSION returned is
        // empty when should not have been (isnewsession false)
        // then assume it did timeout and is invalid.
        // Add 1 second to elapsed time to account for inexact
        // timings in php_memcached_session.c.
        // @TODO Remove this check when php-memcached is fixed
        // to return false after key lock acquisition timeout.
        if (!$isnewsession && $result && count($_SESSION) == 0
            && (microtime(true) - $starttimer + 1) >= floatval($this->acquiretimeout)) {
            $result = false;
        }

        set_time_limit($default);
        return $result;
    }
201108
protected function _start()
	{
		// Start session if not started
		if ($this->getState() === 'restart')
		{
			session_regenerate_id(true);
		}
		else
		{
			$session_name = session_name();

			// Get the Joomla\Input\Cookie object
			$cookie = $this->input->cookie;

			if ($cookie->get($session_name) === null)
			{
				$session_clean = $this->input->get($session_name, false, 'string');

				if ($session_clean)
				{
					session_id($session_clean);
					$cookie->set($session_name, '', 1);
				}
			}
		}

		/**
		 * Write and Close handlers are called after destructing objects since PHP 5.0.5.
		 * Thus destructors can use sessions but session handler can't use objects.
		 * So we are moving session closure before destructing objects.
		 *
		 * Replace with session_register_shutdown() when dropping compatibility with PHP 5.3
		 */
		register_shutdown_function('session_write_close');

		session_cache_limiter('none');
		session_start();

		return true;
	}
337267
public function Start() {
		if ($this->triedstart) {
			return $this->triedresult;
		}
		BLog::addToLog('[Users.Session]: Start()');
		$this->triedresult = false;
		$this->triedstart = true;
		$secret = explode(':', $_COOKIE['brillsecret']);
		if (count($secret) < 2) {
			$this->triedresult = false;
			return false;
		}
		$bCache = BFactory::getCache();
		if (!empty($bCache)) {
			$sess = $bCache->get('session:' . $secret[1]);
			if (($sess !== false) && ($sess !== NULL)) {
				$this->load($sess);
				$this->triedresult = true;
				return true;
			}
		}
		$db = BFactory::getDBO();
		if (empty($db)) {
			return false;
		}
		$qr = 'SELECT * from `sessions` WHERE (sessionid=' . $db->escapeString($secret[1]) . '&&userid=' . (int)$secret[0] . ')';
		$q = $db->Query($qr);
		if (empty($q)) {
			if (DEBUG_MODE) {
				BLog::addToLog('[Session]: Could not execute query! MySQL error: ' . $db->lasterror(), LL_ERROR);
			}
			return false;
		}
		$l = $db->fetch($q);
		if (empty($l)) {
			setcookie('brillsecret', '', time(), '/', BHOSTNAME);
			return false;
		}
		if (!empty($bCache)) {
			$bCache->set('session:' . $l['sessionid'], $l, 600);
		}
		$this->load($l, true);
		$this->triedstart = true;
		$this->triedresult = true;
		return true;
	}