mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-06 16:53:34 +02:00
fixes #583 check PHP version requirement before update
* piwigo.org can now tell Piwigo which version of PHP is required for each version of Piwigo. If the installed version of PHP is too old, do not let the user update. * slight visual enhancements on the update page
This commit is contained in:
+35
-10
@@ -27,25 +27,17 @@ check_input_parameter('to', $_GET, false, '/^\d+\.\d+\.\d+$/');
|
||||
$upgrade_to = isset($_GET['to']) ? $_GET['to'] : '';
|
||||
|
||||
$updates = new updates();
|
||||
$new_versions = $updates->get_piwigo_new_versions();
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Step 0 |
|
||||
// +-----------------------------------------------------------------------+
|
||||
if ($step == 0)
|
||||
{
|
||||
$new_versions = $updates->get_piwigo_new_versions();
|
||||
|
||||
if (isset($new_versions['minor']) and isset($new_versions['major']))
|
||||
{
|
||||
$step = 1;
|
||||
$upgrade_to = $new_versions['major'];
|
||||
|
||||
$template->assign(
|
||||
array(
|
||||
'MINOR_VERSION' => $new_versions['minor'],
|
||||
'MAJOR_VERSION' => $new_versions['major'],
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif (isset($new_versions['minor']))
|
||||
{
|
||||
@@ -96,6 +88,20 @@ if ($step == 3 and is_webmaster())
|
||||
$template->assign('missing', $updates->missing);
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Check for requirements |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
if (isset($new_versions['minor_php']) and version_compare(phpversion(), $new_versions['minor_php'], '<'))
|
||||
{
|
||||
$template->assign('MINOR_RELEASE_PHP_REQUIRED', $new_versions['minor_php']);
|
||||
}
|
||||
|
||||
if (isset($new_versions['major_php']) and version_compare(phpversion(), $new_versions['major_php'], '<'))
|
||||
{
|
||||
$template->assign('MAJOR_RELEASE_PHP_REQUIRED', $new_versions['major_php']);
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Process template |
|
||||
// +-----------------------------------------------------------------------+
|
||||
@@ -109,10 +115,29 @@ $template->assign(array(
|
||||
'STEP' => $step,
|
||||
'PHPWG_VERSION' => PHPWG_VERSION,
|
||||
'UPGRADE_TO' => $upgrade_to,
|
||||
'RELEASE_URL' => PHPWG_URL.'/releases/'.$upgrade_to,
|
||||
)
|
||||
);
|
||||
|
||||
if (isset($new_versions['minor']))
|
||||
{
|
||||
$template->assign(
|
||||
array(
|
||||
'MINOR_VERSION' => $new_versions['minor'],
|
||||
'MINOR_RELEASE_URL' => PHPWG_URL.'/releases/'.$new_versions['minor'],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($new_versions['major']))
|
||||
{
|
||||
$template->assign(
|
||||
array(
|
||||
'MAJOR_VERSION' => $new_versions['major'],
|
||||
'MAJOR_RELEASE_URL' => PHPWG_URL.'/releases/'.$new_versions['major'],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$template->set_filename('plugin_admin_content', 'updates_pwg.tpl');
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user