| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/business/mpa/wp-content/plugins/akeebabackupwp/helpers/Solo/Session/ |
Upload File : |
<?php
/**
* @package solo
* @copyright Copyright (c)2014-2026 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Solo\Session;
use Awf\Session\SegmentInterface;
use Solo\Helper\HashHelper;
class Segment extends \Awf\Session\Segment implements SegmentInterface
{
/**
* Forces a session start (or reactivation) and loads the segment data from WordPress' user meta storage.
*
* @return void
*
*/
protected function load()
{
// CLI mode
if (!defined('WPINC'))
{
return;
}
// is data already loaded?
if ($this->data !== null)
{
// no need to re-load
return;
}
// if the session is not started, start it
if (!$this->session->isStarted())
{
$this->session->start();
}
// Intialize data
$this->data = array();
// Get the WordPress user meta key
$metaKey = $this->session->getName() . '_' . HashHelper::md5($this->getName());
$userId = get_current_user_id();
$this->data = get_user_meta($userId, $metaKey, true);
// Sometimes WordPress returns broken data
if (!is_array($this->data))
{
$this->data = array();
}
}
/**
* Commit the session data to WordPress' user meta storage.
*
* @return void
*/
public function save()
{
// CLI mode
if (!defined('WPINC'))
{
return;
}
$metaKey = $this->session->getName() . '_' . HashHelper::md5($this->getName());
$userId = get_current_user_id();
update_user_meta($userId, $metaKey, $this->data);
}
}