diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 0aaa5f561..2646abbe0 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -2845,6 +2845,7 @@ function ws_extensions_ignoreupdate($params, &$service)
$conf['updates_ignored'] = unserialize($conf['updates_ignored']);
+ // Reset ignored extension
if ($params['reset'])
{
$conf['updates_ignored'] = array(
@@ -2871,4 +2872,40 @@ function ws_extensions_ignoreupdate($params, &$service)
unset($_SESSION['extensions_need_update']);
return true;
}
+
+function ws_extensions_checkupdates($params, &$service)
+{
+ global $conf;
+
+ define('IN_ADMIN', true);
+ include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+ include_once(PHPWG_ROOT_PATH.'admin/include/updates.class.php');
+ $update = new updates();
+
+ if (!is_admin())
+ {
+ return new PwgError(401, 'Access denied');
+ }
+
+ $result = array();
+
+ if (!isset($_SESSION['need_update']))
+ $update->check_piwigo_upgrade();
+
+ $result['piwigo_need_update'] = $_SESSION['need_update'];
+
+ $conf['updates_ignored'] = unserialize($conf['updates_ignored']);
+
+ if (!isset($_SESSION['extensions_need_update']))
+ $update->check_extensions();
+ else
+ $update->check_updated_extensions();
+
+ if (!is_array($_SESSION['extensions_need_update']))
+ $result['ext_need_update'] = null;
+ else
+ $result['ext_need_update'] = !empty($_SESSION['extensions_need_update']);
+
+ return $result;
+}
?>
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index 5b70871c3..a0e36b216 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -822,4 +822,7 @@ $lang['Include history data (Warning: server memory limit may be exceeded)'] = '
$lang['Unable to write new local directory.'] = 'Unable to write new local directory.';
$lang['Unable to send template directory.'] = 'Unable to send template directory.';
$lang['Unable to dump database.'] = 'Unable to dump database.';
+$lang['Some upgrades are available for extensions.'] = 'Some upgrades are available for extensions.';
+$lang['Please wait...'] = 'Please wait...';
+$lang['Ignore All'] = 'Ignore All';
?>
\ No newline at end of file
diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php
index 92239633c..f66902c2c 100644
--- a/language/fr_FR/admin.lang.php
+++ b/language/fr_FR/admin.lang.php
@@ -833,4 +833,7 @@ $lang['Include history data (Warning: server memory limit may be exceeded)'] = '
$lang['Unable to write new local directory.'] = 'Impossible d\'écrire le nouveau dossier local.';
$lang['Unable to send template directory.'] = 'Impossible d\'envoyer le dossier template.';
$lang['Unable to dump database.'] = 'Impossible de sauvegarder la base de données.';
+$lang['Some upgrades are available for extensions.'] = 'Des mises à jour sont disponibles pour les extensions.';
+$lang['Please wait...'] = 'Please wait...';
+$lang['Ignore All'] = 'Tout ignorer';
?>
\ No newline at end of file
diff --git a/ws.php b/ws.php
index 046ee4743..46429b021 100644
--- a/ws.php
+++ b/ws.php
@@ -445,6 +445,13 @@ function ws_addDefaultMethods( $arr )
Parameter type must be "plugins", "languages" or "themes".
If reset parameter is true, all ignored extensions will be reinitilized.'
);
+
+ $service->addMethod(
+ 'pwg.extensions.checkUpdates',
+ 'ws_extensions_checkupdates',
+ array(),
+ 'Check if piwigo or extensions are up to date.'
+ );
}
add_event_handler('ws_add_methods', 'ws_addDefaultMethods');