mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-04 08:52:20 +02:00
fixes #2134 make sure database is writeable before new version notification
This commit is contained in:
@@ -65,6 +65,8 @@ class updates
|
|||||||
*/
|
*/
|
||||||
function get_piwigo_new_versions()
|
function get_piwigo_new_versions()
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$new_versions = array(
|
$new_versions = array(
|
||||||
'piwigo.org-checked' => false,
|
'piwigo.org-checked' => false,
|
||||||
'is_dev' => true,
|
'is_dev' => true,
|
||||||
@@ -78,6 +80,7 @@ class updates
|
|||||||
$url = PHPWG_URL.'/download/all_versions.php';
|
$url = PHPWG_URL.'/download/all_versions.php';
|
||||||
$url.= '?rand='.md5(uniqid(rand(), true)); // Avoid server cache
|
$url.= '?rand='.md5(uniqid(rand(), true)); // Avoid server cache
|
||||||
$url.= '&show_requirements';
|
$url.= '&show_requirements';
|
||||||
|
$url.= '&origin_hash='.sha1($conf['secret_key'].get_absolute_root_url());
|
||||||
|
|
||||||
if (@fetchRemote($url, $result)
|
if (@fetchRemote($url, $result)
|
||||||
and $all_versions = @explode("\n", $result)
|
and $all_versions = @explode("\n", $result)
|
||||||
@@ -134,6 +137,11 @@ class updates
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
if (!pwg_is_dbconf_writeable())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$new_versions = $this->get_piwigo_new_versions();
|
$new_versions = $this->get_piwigo_new_versions();
|
||||||
conf_update_param('update_notify_last_check', date('c'));
|
conf_update_param('update_notify_last_check', date('c'));
|
||||||
|
|
||||||
|
|||||||
@@ -1421,6 +1421,29 @@ SELECT param, value
|
|||||||
trigger_notify('load_conf', $condition);
|
trigger_notify('load_conf', $condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the config table currentable writeable?
|
||||||
|
*
|
||||||
|
* @since 14
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function pwg_is_dbconf_writeable()
|
||||||
|
{
|
||||||
|
list($param, $value) = array('pwg_is_dbconf_writeable_'.generate_key(12), date('c').' '.generate_key(20));
|
||||||
|
|
||||||
|
conf_update_param($param, $value);
|
||||||
|
list($dbvalue) = pwg_db_fetch_row(pwg_query('SELECT value FROM '.CONFIG_TABLE.' WHERE param = \''.$param.'\''));
|
||||||
|
|
||||||
|
if ($dbvalue != $value)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
conf_delete_param($param);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add or update a config parameter
|
* Add or update a config parameter
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user