source: extensions/autoupdate/trunk/ajax/check_updates.php @ 9729

Last change on this file since 9729 was 9729, checked in by patdenice, 13 years ago

Only one request to PEM server for plugins, themes and languages.

File size: 1.2 KB
Line 
1<?php
2
3define('PHPWG_ROOT_PATH','../../../');
4define('IN_ADMIN', true);
5include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
6include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
7include_once(AUTOUPDATE_PATH.'include/autoupdate.class.php');
8$autoupdate = new autoupdate();
9
10check_status(ACCESS_ADMINISTRATOR);
11
12// Check if gallery or plugins are up to date
13load_language('plugin.lang', dirname(dirname(__FILE__)).'/');
14header('Content-Type: text/html; charset=UTF-8');
15
16function autoupdate_error()
17{
18  unset($_SESSION['extensions_need_update']);
19  echo 'error';
20  exit;
21}
22
23if (!isset($_SESSION['need_update']))
24{
25  $autoupdate->check_piwigo_upgrade();
26}
27
28if ($_SESSION['need_update'])
29{
30  echo 'piwigo_upgrade'; exit();
31}
32else
33{
34  // Gallery is up to date -> check extensions
35  if (!isset($_SESSION['extensions_need_update']))
36  {
37    $autoupdate->check_extensions();
38  }
39  else
40  {
41    $autoupdate->check_updated_extensions();
42  }
43}
44
45if (!empty($_SESSION['extensions_need_update']))
46{
47  echo 'ext_upgrade'; exit;
48}
49elseif ($_SESSION['need_update'] === false and $_SESSION['extensions_need_update'] === array())
50{
51  echo 'up_to_date'; exit;
52}
53else
54{
55  autoupdate_error();
56}
57
58?>
Note: See TracBrowser for help on using the repository browser.