1 | <?php
|
---|
2 |
|
---|
3 | /***************************************************************************
|
---|
4 | * Dolphin Smart Community Builder
|
---|
5 | * -----------------
|
---|
6 | * begin : Mon Mar 23 2006
|
---|
7 | * copyright : (C) 2006 BoonEx Group
|
---|
8 | * website : http://www.boonex.com/
|
---|
9 | * This file is part of Dolphin - Smart Community Builder
|
---|
10 | *
|
---|
11 | * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
|
---|
12 | * http://creativecommons.org/licenses/by/3.0/
|
---|
13 | *
|
---|
14 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
---|
15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
16 | * See the Creative Commons Attribution 3.0 License for more details.
|
---|
17 | * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
|
---|
18 | * see license.txt file; if not, write to marketing@boonex.com
|
---|
19 | ***************************************************************************/
|
---|
20 |
|
---|
21 | require_once( '../inc/header.inc.php' );
|
---|
22 | require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
|
---|
23 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
|
---|
24 | require_once( BX_DIRECTORY_PATH_INC . 'admin_design.inc.php' );
|
---|
25 | require_once( BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php' );
|
---|
26 |
|
---|
27 | $logged['admin'] = member_auth( 1, true, true );
|
---|
28 |
|
---|
29 | $aResult = array();
|
---|
30 | switch($_POST['type']) {
|
---|
31 | case 'all':
|
---|
32 | $aResult = clearCache('db_', BX_DIRECTORY_PATH_DBCACHE);
|
---|
33 | if($aResult['code'] != 0)
|
---|
34 | break;
|
---|
35 |
|
---|
36 | $aResult = clearCache($GLOBALS['oSysTemplate']->_sCacheFilePrefix, BX_DIRECTORY_PATH_CACHE);
|
---|
37 | if($aResult['code'] != 0)
|
---|
38 | break;
|
---|
39 |
|
---|
40 | $aResult = clearCache($GLOBALS['oSysTemplate']->_sCssCachePrefix, BX_DIRECTORY_PATH_CACHE_PUBLIC);
|
---|
41 | if($aResult['code'] != 0)
|
---|
42 | break;
|
---|
43 |
|
---|
44 | $aResult = clearCache($GLOBALS['oSysTemplate']->_sJsCachePrefix, BX_DIRECTORY_PATH_CACHE_PUBLIC);
|
---|
45 | break;
|
---|
46 | case 'db':
|
---|
47 | $aResult = clearCache('db_', BX_DIRECTORY_PATH_DBCACHE);
|
---|
48 | break;
|
---|
49 | case 'template':
|
---|
50 | $aResult = clearCache($GLOBALS['oSysTemplate']->_sCacheFilePrefix, BX_DIRECTORY_PATH_CACHE);
|
---|
51 | break;
|
---|
52 | case 'js_css':
|
---|
53 | $aResult = clearCache($GLOBALS['oSysTemplate']->_sCssCachePrefix, BX_DIRECTORY_PATH_CACHE_PUBLIC);
|
---|
54 | if($aResult['code'] == 0)
|
---|
55 | $aResult = clearCache($GLOBALS['oSysTemplate']->_sJsCachePrefix, BX_DIRECTORY_PATH_CACHE_PUBLIC);
|
---|
56 | break;
|
---|
57 | }
|
---|
58 | $oJson = new Services_JSON();
|
---|
59 | echo $oJson->encode($aResult);
|
---|
60 | exit;
|
---|
61 |
|
---|
62 |
|
---|
63 | function clearCache($sPrefix, $sPath) {
|
---|
64 | $aResult = array('code' => 0, 'message' => _t('_adm_txt_dashboard_cache_clean_success'));
|
---|
65 |
|
---|
66 | if($rHandler = opendir($sPath)) {
|
---|
67 | while(($sFile = readdir($rHandler)) !== false)
|
---|
68 | if(substr($sFile, 0, strlen($sPrefix)) == $sPrefix)
|
---|
69 | @unlink($sPath . $sFile);
|
---|
70 | }
|
---|
71 | else
|
---|
72 | $aResult = array('code' => 1, 'message' => _t('_adm_txt_dashboard_cache_clean_failed'));
|
---|
73 |
|
---|
74 | return $aResult;
|
---|
75 | }
|
---|
76 | ?> |
---|