1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Session
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * WINCACHE session storage handler for PHP
14 *
15 * @since 11.1
16 * @deprecated 4.0 The CMS' Session classes will be replaced with the `joomla/session` package
17 */
18 class JSessionStorageWincache extends JSessionStorage
19 {
20 /**
21 * Constructor
22 *
23 * @param array $options Optional parameters.
24 *
25 * @since 11.1
26 * @throws RuntimeException
27 */
28 public function __construct($options = array())
29 {
30 if (!self::isSupported())
31 {
32 throw new RuntimeException('Wincache Extension is not available', 404);
33 }
34
35 parent::__construct($options);
36 }
37
38 /**
39 * Register the functions of this class with PHP's session handler
40 *
41 * @return void
42 *
43 * @since 12.2
44 */
45 public function register()
46 {
47 ini_set('session.save_handler', 'wincache');
48 }
49
50 /**
51 * Test to see if the SessionHandler is available.
52 *
53 * @return boolean True on success, false otherwise.
54 *
55 * @since 12.1
56 */
57 public static function isSupported()
58 {
59 return extension_loaded('wincache') && function_exists('wincache_ucache_get') && !strcmp(ini_get('wincache.ucenabled'), '1');
60 }
61 }
62