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