aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/cache/driver/xcache.php
blob: 0c845a6a8d5d05526663a57334982295046dd3e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/

namespace phpbb\cache\driver;

/**
* ACM for XCache
*
* To use this module you need ini_get() enabled and the following INI settings configured as follows:
* - xcache.var_size > 0
* - xcache.admin.enable_auth = off (or xcache.admin.user and xcache.admin.password set)
*
*/
class xcache extends \phpbb\cache\driver\memory
{
	var $extension = 'XCache';

	function __construct()
	{
		parent::__construct();

		if (!function_exists('ini_get') || (int) ini_get('xcache.var_size') <= 0)
		{
			trigger_error('Increase xcache.var_size setting above 0 or enable ini_get() to use this ACM module.', E_USER_ERROR);
		}
	}

	/**
	* {@inheritDoc}
	*/
	function purge()
	{
		// Run before for XCache, if admin functions are disabled it will terminate execution
		parent::purge();

		// If the admin authentication is enabled but not set up, this will cause a nasty error.
		// Not much we can do about it though.
		$n = xcache_count(XC_TYPE_VAR);

		for ($i = 0; $i < $n; $i++)
		{
			xcache_clear_cache(XC_TYPE_VAR, $i);
		}
	}

	/**
	* Fetch an item from the cache
	*
	* @access protected
	* @param string $var Cache key
	* @return mixed Cached data
	*/
	function _read($var)
	{
		$result = xcache_get($this->key_prefix . $var);

		return ($result !== null) ? $result : false;
	}

	/**
	* Store data in the cache
	*
	* @access protected
	* @param string $var Cache key
	* @param mixed $data Data to store
	* @param int $ttl Time-to-live of cached data
	* @return bool True if the operation succeeded
	*/
	function _write($var, $data, $ttl = 2592000)
	{
		return xcache_set($this->key_prefix . $var, $data, $ttl);
	}

	/**
	* Remove an item from the cache
	*
	* @access protected
	* @param string $var Cache key
	* @return bool True if the operation succeeded
	*/
	function _delete($var)
	{
		return xcache_unset($this->key_prefix . $var);
	}

	/**
	* Check if a cache var exists
	*
	* @access protected
	* @param string $var Cache key
	* @return bool True if it exists, otherwise false
	*/
	function _isset($var)
	{
		return xcache_isset($this->key_prefix . $var);
	}
}
opt">; rm -rf alternatives if [ `ls $(ROOTDEST)/images/*.img-* 2>/dev/null | wc -l` -gt 0 ]; then \ cd $(ROOTDEST)/images; mkdir alternatives; cd alternatives; mv ../*.img-* .; md5sum *.img-* > MD5SUM; \ fi cd $(ROOTDEST)/images; md5sum *.img* > MD5SUM ifeq (i386,$(ARCH)) rm -rf $(ROOTDEST)/isolinux cp -af isolinux $(ROOTDEST) cp -f images/cdrom-changedisk.img $(ROOTDEST)/images endif install live_update $(ROOTDEST)/live_update make -C perl-install full_stage2 make -C perl-install/share/advertising install make -C rescue install clean: rm -rf images all.modules all.modules64 for i in $(DIRS); do make -C $$i clean; done find . -name "*~" -o -name ".#*" | xargs rm -f check: @badrights=`find $(ROOTDEST)/Mandrake/mdkinst | perl -lne 'print if !((stat)[2] & 4)'`; [ -z "$$badrights" ] || { echo "bad rights for files vvvvvvvvvvvvvvvvvvvvvvvvvv" ; echo "$$badrights" ; echo "bad rights for files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" ; exit 1; } @missing_kb=`find -name "Entries" | xargs perl -F/ -alne 'print $$ARGV =~ m|(.*)/CVS|, "/$$F[1]" if $$F[1] =~ /\.(png|gif|bmp|xcf|gz|bz2|tar|rdz|so|a|o|mar|img|exe)$$/ && $$F[4] ne "-kb"'` ; [ -z "$$missing_kb" ] || { echo "missing -kb in CVS for files vvvvvvvvvvvvvvvvvvvvvvvvvv" ; echo "$$missing_kb" ; echo "missing -kb in CVS for files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" ; exit 1; } $(MAKE) -C perl-install check upload: $(MAKE) clean # # done before make install to increment ChangeLog version tools/addchangelog.pl tools/cvslog2changelog.pl | tools/mailchangelog.pl & $(MAKE) install $(MAKE) check $(MAKE) upload_only upload_only: function upload() { rsync -qSavz --verbose --exclude '*~' -e ssh --delete $(ROOTDEST)/$$1/$$2 mandrake@ken:/c/cooker/$$1; } ;\ upload Mandrake/mdkinst '' ;\ upload Mandrake/base compssUsers* ;\ upload Mandrake/base rpmsrate ;\ upload Mandrake/base *_stage2.bz2 ;\ upload Mandrake/share/advertising '' ;\ upload misc gendistrib ;\ upload misc make_mdkinst_stage2 ;\ upload misc packdrake ;\ upload misc packdrake.pm ;\ upload misc rpmtools.pm ;\ upload misc auto ;\ upload '' live_update ;\ upload images MD5SUM ;\ upload images *.img* ;\ upload images/alternatives '' ;\ upload isolinux '' ;\ echo