1 | <?php |
---|
2 | |
---|
3 | /***************************************************************************\ |
---|
4 | * SPIP, Systeme de publication pour l'internet * |
---|
5 | * * |
---|
6 | * Copyright (c) 2001-2010 * |
---|
7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
---|
8 | * * |
---|
9 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
---|
10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
---|
11 | \***************************************************************************/ |
---|
12 | |
---|
13 | if (!defined("_ECRIRE_INC_VERSION")) return; // securiser |
---|
14 | |
---|
15 | // http://doc.spip.org/@action_purger_dist |
---|
16 | function action_purger_dist($arg=null) |
---|
17 | { |
---|
18 | if (is_null($arg)) { |
---|
19 | if ($securiser_action = charger_fonction('securiser_action', 'inc', true)) |
---|
20 | $arg = $securiser_action(); |
---|
21 | else { |
---|
22 | /* compat SPIP 1.9 */ |
---|
23 | $arg = _request('arg'); |
---|
24 | $redirect = 'ecrire/'._request('redirect'); |
---|
25 | include_spip('inc/meta'); |
---|
26 | function spip_unlink($u) { |
---|
27 | return unlink($u); |
---|
28 | } |
---|
29 | } |
---|
30 | } |
---|
31 | |
---|
32 | include_spip('inc/invalideur'); |
---|
33 | |
---|
34 | spip_log("purger $arg"); |
---|
35 | |
---|
36 | switch ($arg) { |
---|
37 | |
---|
38 | case 'cache': |
---|
39 | supprime_invalideurs(); |
---|
40 | @spip_unlink(_CACHE_RUBRIQUES); |
---|
41 | @spip_unlink(_CACHE_PIPELINES); |
---|
42 | @spip_unlink(_CACHE_PLUGINS_PATH); |
---|
43 | @spip_unlink(_CACHE_PLUGINS_OPT); |
---|
44 | @spip_unlink(_CACHE_PLUGINS_FCT); |
---|
45 | @spip_unlink(_CACHE_PLUGINS_VERIF); |
---|
46 | @spip_unlink(_CACHE_CHEMIN); |
---|
47 | purger_repertoire(_DIR_AIDE); |
---|
48 | purger_repertoire(_DIR_VAR.'cache-css'); |
---|
49 | purger_repertoire(_DIR_VAR.'cache-js'); |
---|
50 | |
---|
51 | # purge a l'ancienne des fichiers de tmp/cache/ |
---|
52 | purger_repertoire(_DIR_CACHE,array('subdir'=>true)); |
---|
53 | |
---|
54 | # ajouter une mark pour les autres methodes de memoization |
---|
55 | ecrire_meta('cache_mark', time()); |
---|
56 | /* compat SPIP 1.9 */ |
---|
57 | if (function_exists('ecrire_metas')) ecrire_metas(); |
---|
58 | |
---|
59 | break; |
---|
60 | |
---|
61 | case 'squelettes': |
---|
62 | purger_repertoire(_DIR_SKELS); |
---|
63 | break; |
---|
64 | |
---|
65 | case 'vignettes': |
---|
66 | purger_repertoire(_DIR_VAR,array('subdir'=>true)); |
---|
67 | supprime_invalideurs(); |
---|
68 | purger_repertoire(_DIR_CACHE); |
---|
69 | break; |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | /* compat SPIP 1.9 */ |
---|
74 | if (isset($redirect)) { |
---|
75 | include_spip('inc/headers'); |
---|
76 | redirige_par_entete($redirect); |
---|
77 | } |
---|
78 | } |
---|
79 | |
---|
80 | ?> |
---|