Open Sencillo  2015.107
Long live the simplicity of PHP
 All Data Structures Namespaces Functions Pages
/home/peter/git/OpenSencillo/cache.php
1 <?php
2 /*~ cache.php
3 .---------------------------------------------------------------------------.
4 | Software: SencilloCache |
5 | Version: 2015.003 |
6 | Contact: ph@mastery.sk |
7 | ------------------------------------------------------------------------- |
8 | Author: Bc. Peter Horváth (original founder) |
9 | Copyright (c) 2015, Bc. Peter Horváth. All Rights Reserved. |
10 | ------------------------------------------------------------------------- |
11 | License: Distributed under the General Public License (GPL) |
12 | http://www.gnu.org/licenses/gpl-3.0.html |
13 | This program is distributed in the hope that it will be useful - WITHOUT |
14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
15 | FITNESS FOR A PARTICULAR PURPOSE. |
16 '---------------------------------------------------------------------------'
17 ~*/
18 
19 /* Credits:
20  *
21  * Based upon and inspired by:
22  * QuickCache <andy.prevost@worxteam.com> (http://sourceforge.net/projects/quickcache)
23  */
24 
25 $QUICKCACHE_VERSION="v2015.003";
26 
27 // Set the includedir to the quickcache-directory
28 $includedir = "./fw_cache";
29 
30 /* File based caching setting. */
31 $QUICKCACHE_DIR = $includedir . '/tmp';
32  // Directory where quickcache will store generated files.
33  // Please use a dedicated directory, and make it writable
34 
35 /* IF USING DATABASE TYPE CACHE STORAGE, FILL INFO BELOW */
36 
37 /* Some settings are specific for the type of cache you are running, like
38  * file- or database-based.
39  * Define which QuickCache type you want to use (db storage and/or system).
40  * Note: with 2.1rc1, file type is assumed unless another type is selected
41  * This allows for system-specific patches & handling, as sometimes
42  * 'platform independent' is behaving quite differently.
43  */
44 
45 /* DB based caching settings
46  * Fill in your username and password
47  * ONLY if you intend to use the MySQL database to store
48  * cache settings, otherwise, leave blank
49  */
50 $QUICKCACHE_DB_HOST = $DBHost; // Database Server
51 $QUICKCACHE_DB_DATABASE = $DBName; // Database-name to use
52 $QUICKCACHE_DB_USERNAME = $DBUser; // Username
53 $QUICKCACHE_DB_PASSWORD = $DBPass; // Password
54 $QUICKCACHE_DB_TABLE = 'sencillo_cache'; // Table that holds the data
55 $QUICKCACHE_OPTIMIZE = 1; // If 'OPTIMIZE TABLE' after garbage
56  // collection is executed. Please check
57  // first if this works on your mySQL!
58 
59 IF ($QUICKCACHE_DB_USERNAME != '') {
60  $QUICKCACHE_TYPE = 'mysql'; /* means this is a 'MySQL' type cache */
61 } else {
62  $QUICKCACHE_TYPE = 'file'; /* means this is a 'file' type cache */
63 }
64 
65 /* IF YOU HAVE IMPLEMENTED YOUR OWN TYPE OF STORAGE OR FILE SYSTEM
66  * FILL IN BELOW AND EMAIL TO 'andy.prevost@worxteam.com' TO INCLUDE IN
67  * THE NEXT RELEASE OF QUICKCACHE
68  */
69 // $QCACHE_TYPE = 'template';
70 
71 /* General configuration options */
72 $QUICKCACHE_TIME = 900; // Default number of seconds to cache a page
73 $QUICKCACHE_DEBUG = 0; // Turn debugging on/off
74 $QUICKCACHE_IGNORE_DOMAIN= 1; // Ignore domain name in request(single site)
75 //$QUICKCACHE_ON = 1; // Turn caching on/off
76 $QUICKCACHE_USE_GZIP = 1; // Whether or not to use GZIP
77 $QUICKCACHE_POST = 0; // Should POST's be cached (default OFF)
78 $QUICKCACHE_GC = 1; // Probability % of garbage collection
79 $QUICKCACHE_GZIP_LEVEL = 9; // GZIPcompressionlevel to use (1=low,9=high)
80 $QUICKCACHE_CLEANKEYS = 0; // Set to 1 to avoid hashing storage-key:
81  // you can easily see cachefile-origin.
82 
83 $QUICKCACHE_FILEPREFIX = 'qcc-';
84  // Prefix used in the filename. This enables
85  // QuickCache to (more accurately) recognize
86  // quickcache files.
87 
88 if ( isCGI() ) {
89  $QUICKCACHE_ISCGI = 1; // CGI-PHP is running
90 } else {
91  $QUICKCACHE_ISCGI = 0; // PHP is running as module - definitely not CGI
92 }
93 
94 // Standard functions
95 require $includedir . "/cache_main.php";
96 
97 // Type specific implementations
98 require $includedir . "/type/" . $QUICKCACHE_TYPE . ".php";
99 
100 // Start caching
101 if($QUICKCACHE_ON===1)
102 {
103  quickcache_start();
104 }
105 
106 /* function to determine if PHP is loaded as a CGI-PHP or as an Apache module */
107 function isCGI() {
108  if (substr(php_sapi_name(), 0, 3) == 'cgi') {
109  return true;
110  } else {
111  return false;
112  }
113 }
114 
115 ?>