| Server IP : 81.19.159.101 / Your IP : 216.73.217.111 Web Server : Apache System : Linux www58.world4you.com 4.18.0-553.126.2.lve.el8.x86_64 #1 SMP Thu May 28 14:12:30 UTC 2026 x86_64 User : ftp8817043 ( 2681) PHP Version : 8.4.21 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/.sites/103/site8817043/web/wp-content/plugins/akeebabackupwp/helpers/Solo/Session/ |
Upload File : |
<?php
/**
* @package solo
* @copyright Copyright (c)2014-2025 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);
}
}