File: mutualiser_upgradeplugins.php

package info (click to toggle)
spip 4.4.13%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 39,808 kB
  • sloc: php: 299,893; javascript: 67,976; xml: 4,389; sh: 165; makefile: 92
file content (55 lines) | stat: -rw-r--r-- 1,870 bytes parent folder | download | duplicates (2)
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
<?php

if (!defined('_ECRIRE_INC_VERSION')) {
	return;
}

function mutualiser_upgradeplugins() {
	define('_DOCTYPE_ECRIRE', ''); # on n'a pas lance spip_initialisation_suite() donc cette constante n'est pas definie
	include_spip('inc/minipres');

	// verif securite
	if (_request('secret') != md5($GLOBALS['meta']['version_installee'] . '-' . $GLOBALS['meta']['secret_du_site'])) {
		include_spip('inc/headers');
		redirige_par_entete($GLOBALS['meta']['adresse_site'] . '/' . _DIR_RESTREINT_ABS . '?exec=admin_plugin');
		exit;
	}

	// faire l'upgrade
	lire_metas();
	// Installer les plugins
	include_spip('inc/plugin');

	// si jamais la liste des plugins actifs change, il faut faire un refresh du hit
	// pour etre sur que les bons fichiers seront charges lors de l'install
	$new = actualise_plugins_actifs();
	if ($new and _request('actualise') < 2) {
		include_spip('inc/headers');
		redirige_par_entete(parametre_url(self(), 'actualise', _request('actualise')+1, '&'));
	} else {
		plugin_installes_meta();

		// vider tmp et recreer tmp/meta_cache.php
		include_spip('inc/invalideur');
		supprime_invalideurs();
		@spip_unlink(_CACHE_RUBRIQUES);
		@spip_unlink(_CACHE_CHEMIN);
		@spip_unlink(_DIR_TMP . "plugin_xml_cache.gz");
		@spip_unlink(_CACHE_PLUGINS_OPT);
		purger_repertoire(_DIR_CACHE, array('subdir' => true));
		purger_repertoire(_DIR_AIDE);
		purger_repertoire(_DIR_VAR . 'cache-css');
		purger_repertoire(_DIR_VAR . 'cache-js');
		purger_repertoire(_DIR_SKELS);

		if (_request('ajax') != 'oui') {
			echo minipres(_T('titre_page_upgrade'),
				_L('Mise &agrave; jour des plugins') . '<br/>' . _L('Aller dans <a href="@ecrire@">ecrire/</a>',
					array('ecrire' => $GLOBALS['meta']['adresse_site'] . '/' . _DIR_RESTREINT_ABS . '?exec=admin_plugin')));
		} else {
			header('Access-Control-Allow-Origin: *');
			echo _request('up');
		}
		exit;
	}
}