mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-05-03 12:02:51 +02:00
fixes #1841 register system activities
This commit is contained in:
@@ -285,6 +285,7 @@ WHERE param = \''.$row['param'].'\'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$page['infos'][] = l10n('Information data registered in database');
|
$page['infos'][] = l10n('Information data registered in database');
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_CORE, 'config', array('config_section'=>$page['section']));
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------ $conf reinitialization
|
//------------------------------------------------------ $conf reinitialization
|
||||||
@@ -299,6 +300,7 @@ if ('sizes' == $page['section'] and isset($_GET['action']) and 'restore_settings
|
|||||||
clear_derivative_cache();
|
clear_derivative_cache();
|
||||||
|
|
||||||
$page['infos'][] = l10n('Your configuration settings are saved');
|
$page['infos'][] = l10n('Your configuration settings are saved');
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_CORE, 'config', array('config_section'=>$page['section'],'config_action'=>$_GET['action']));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------- template initialization
|
//----------------------------------------------------- template initialization
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ if (count($errors) == 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$page['infos'][] = l10n('Your configuration settings are saved');
|
$page['infos'][] = l10n('Your configuration settings are saved');
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_CORE, 'config', array('config_section'=>'sizes'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ if (count($errors) == 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$page['infos'][] = l10n('Your configuration settings are saved');
|
$page['infos'][] = l10n('Your configuration settings are saved');
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_CORE, 'config', array('config_section'=>'watermark'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -117,6 +117,8 @@ class plugins
|
|||||||
$plugin_maintain = self::build_maintain_class($plugin_id);
|
$plugin_maintain = self::build_maintain_class($plugin_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$activity_details = array('plugin_id'=>$plugin_id);
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
switch ($action)
|
switch ($action)
|
||||||
@@ -128,6 +130,7 @@ class plugins
|
|||||||
}
|
}
|
||||||
|
|
||||||
$plugin_maintain->install($this->fs_plugins[$plugin_id]['version'], $errors);
|
$plugin_maintain->install($this->fs_plugins[$plugin_id]['version'], $errors);
|
||||||
|
$activity_details['version'] = $this->fs_plugins[$plugin_id]['version'];
|
||||||
|
|
||||||
if (empty($errors))
|
if (empty($errors))
|
||||||
{
|
{
|
||||||
@@ -137,16 +140,22 @@ INSERT INTO '. PLUGINS_TABLE .' (id,version)
|
|||||||
;';
|
;';
|
||||||
pwg_query($query);
|
pwg_query($query);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$activity_details['result'] = 'error';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'update':
|
case 'update':
|
||||||
$previous_version = $this->fs_plugins[$plugin_id]['version'];
|
$previous_version = $this->fs_plugins[$plugin_id]['version'];
|
||||||
|
$activity_details['from_version'] = $previous_version;
|
||||||
$errors[0] = $this->extract_plugin_files('upgrade', $options['revision'], $plugin_id);
|
$errors[0] = $this->extract_plugin_files('upgrade', $options['revision'], $plugin_id);
|
||||||
|
|
||||||
if ($errors[0] === 'ok')
|
if ($errors[0] === 'ok')
|
||||||
{
|
{
|
||||||
$this->get_fs_plugin($plugin_id); // refresh plugins list
|
$this->get_fs_plugin($plugin_id); // refresh plugins list
|
||||||
$new_version = $this->fs_plugins[$plugin_id]['version'];
|
$new_version = $this->fs_plugins[$plugin_id]['version'];
|
||||||
|
$activity_details['to_version'] = $new_version;
|
||||||
|
|
||||||
$plugin_maintain = self::build_maintain_class($plugin_id);
|
$plugin_maintain = self::build_maintain_class($plugin_id);
|
||||||
$plugin_maintain->update($previous_version, $new_version, $errors);
|
$plugin_maintain->update($previous_version, $new_version, $errors);
|
||||||
@@ -161,6 +170,11 @@ UPDATE '. PLUGINS_TABLE .'
|
|||||||
pwg_query($query);
|
pwg_query($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$activity_details['result'] = 'error';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -179,6 +193,7 @@ UPDATE '. PLUGINS_TABLE .'
|
|||||||
if (empty($errors))
|
if (empty($errors))
|
||||||
{
|
{
|
||||||
$plugin_maintain->activate($crt_db_plugin['version'], $errors);
|
$plugin_maintain->activate($crt_db_plugin['version'], $errors);
|
||||||
|
$activity_details['version'] = $crt_db_plugin['version'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($errors))
|
if (empty($errors))
|
||||||
@@ -190,11 +205,16 @@ UPDATE '. PLUGINS_TABLE .'
|
|||||||
;';
|
;';
|
||||||
pwg_query($query);
|
pwg_query($query);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$activity_details['result'] = 'error';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'deactivate':
|
case 'deactivate':
|
||||||
if (!isset($crt_db_plugin) or $crt_db_plugin['state'] != 'active')
|
if (!isset($crt_db_plugin) or $crt_db_plugin['state'] != 'active')
|
||||||
{
|
{
|
||||||
|
$activity_details['result'] = 'error';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,13 +226,27 @@ UPDATE '. PLUGINS_TABLE .'
|
|||||||
pwg_query($query);
|
pwg_query($query);
|
||||||
|
|
||||||
$plugin_maintain->deactivate();
|
$plugin_maintain->deactivate();
|
||||||
|
|
||||||
|
if (isset($crt_db_plugin['version']))
|
||||||
|
{
|
||||||
|
$activity_details['version'] = $crt_db_plugin['version'];
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'uninstall':
|
case 'uninstall':
|
||||||
if (!isset($crt_db_plugin))
|
if (!isset($crt_db_plugin))
|
||||||
{
|
{
|
||||||
|
$activity_details['result'] = 'error';
|
||||||
|
$activity_details['error'] = 'plugin not installed';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($crt_db_plugin['version']))
|
||||||
|
{
|
||||||
|
$activity_details['version'] = $crt_db_plugin['version'];
|
||||||
|
}
|
||||||
|
|
||||||
if ($crt_db_plugin['state'] == 'active')
|
if ($crt_db_plugin['state'] == 'active')
|
||||||
{
|
{
|
||||||
$this->perform_action('deactivate', $plugin_id);
|
$this->perform_action('deactivate', $plugin_id);
|
||||||
@@ -236,17 +270,29 @@ DELETE FROM '. PLUGINS_TABLE .'
|
|||||||
case 'delete':
|
case 'delete':
|
||||||
if (!empty($crt_db_plugin))
|
if (!empty($crt_db_plugin))
|
||||||
{
|
{
|
||||||
|
if (isset($crt_db_plugin['version']))
|
||||||
|
{
|
||||||
|
$activity_details['db_version'] = $crt_db_plugin['version'];
|
||||||
|
}
|
||||||
|
|
||||||
$this->perform_action('uninstall', $plugin_id);
|
$this->perform_action('uninstall', $plugin_id);
|
||||||
}
|
}
|
||||||
if (!isset($this->fs_plugins[$plugin_id]))
|
if (!isset($this->fs_plugins[$plugin_id]))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$activity_details['fs_version'] = $this->fs_plugins[$plugin_id]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||||
deltree(PHPWG_PLUGINS_PATH . $plugin_id, PHPWG_PLUGINS_PATH . 'trash');
|
deltree(PHPWG_PLUGINS_PATH . $plugin_id, PHPWG_PLUGINS_PATH . 'trash');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_PLUGIN, $action, $activity_details);
|
||||||
|
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ class themes
|
|||||||
$theme_maintain = self::build_maintain_class($theme_id);
|
$theme_maintain = self::build_maintain_class($theme_id);
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
$activity_details = array('theme_id'=>$theme_id);
|
||||||
|
|
||||||
switch ($action)
|
switch ($action)
|
||||||
{
|
{
|
||||||
@@ -144,6 +145,8 @@ INSERT INTO '.THEMES_TABLE.'
|
|||||||
;';
|
;';
|
||||||
pwg_query($query);
|
pwg_query($query);
|
||||||
|
|
||||||
|
$activity_details['version'] = $this->fs_themes[$theme_id]['version'];
|
||||||
|
|
||||||
if ($this->fs_themes[$theme_id]['mobile'])
|
if ($this->fs_themes[$theme_id]['mobile'])
|
||||||
{
|
{
|
||||||
conf_update_param('mobile_theme', $theme_id);
|
conf_update_param('mobile_theme', $theme_id);
|
||||||
@@ -236,6 +239,9 @@ DELETE
|
|||||||
$this->set_default_theme($theme_id);
|
$this->set_default_theme($theme_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_THEME, $action, $activity_details);
|
||||||
|
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,7 +583,7 @@ SELECT
|
|||||||
* @param string - remote revision identifier (numeric)
|
* @param string - remote revision identifier (numeric)
|
||||||
* @param string - theme id or extension id
|
* @param string - theme id or extension id
|
||||||
*/
|
*/
|
||||||
function extract_theme_files($action, $revision, $dest)
|
function extract_theme_files($action, $revision, $dest, &$theme_id=null)
|
||||||
{
|
{
|
||||||
global $logger;
|
global $logger;
|
||||||
|
|
||||||
@@ -614,13 +620,13 @@ SELECT
|
|||||||
$root = dirname($main_filepath); // main.inc.php path in archive
|
$root = dirname($main_filepath); // main.inc.php path in archive
|
||||||
if ($action == 'upgrade')
|
if ($action == 'upgrade')
|
||||||
{
|
{
|
||||||
$extract_path = PHPWG_THEMES_PATH . $dest;
|
$theme_id = $dest;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$extract_path = PHPWG_THEMES_PATH . ($root == '.' ? 'extension_' . $dest : basename($root));
|
$theme_id = ($root == '.' ? 'extension_' . $dest : basename($root));
|
||||||
}
|
}
|
||||||
|
$extract_path = PHPWG_THEMES_PATH . $theme_id;
|
||||||
$logger->debug(__FUNCTION__.', $extract_path = '.$extract_path);
|
$logger->debug(__FUNCTION__.', $extract_path = '.$extract_path);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -460,6 +460,8 @@ class updates
|
|||||||
|
|
||||||
if ($check_current_version and !version_compare($upgrade_to, PHPWG_VERSION, '>'))
|
if ($check_current_version and !version_compare($upgrade_to, PHPWG_VERSION, '>'))
|
||||||
{
|
{
|
||||||
|
// TODO why redirect to a plugin page? maybe a remaining code from when
|
||||||
|
// the update system was provided as a plugin?
|
||||||
redirect(get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)));
|
redirect(get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,6 +554,8 @@ class updates
|
|||||||
|
|
||||||
deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');
|
deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');
|
||||||
invalidate_user_cache(true);
|
invalidate_user_cache(true);
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_CORE, 'update', array('from_version'=>PHPWG_VERSION, 'to_version'=>$upgrade_to));
|
||||||
|
|
||||||
if ($step == 2)
|
if ($step == 2)
|
||||||
{
|
{
|
||||||
// only delete compiled templates on minor update. Doing this on
|
// only delete compiled templates on minor update. Doing this on
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ fs_quick_check();
|
|||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
$action = isset($_GET['action']) ? $_GET['action'] : '';
|
$action = isset($_GET['action']) ? $_GET['action'] : '';
|
||||||
|
$register_activity = true;
|
||||||
|
|
||||||
switch ($action)
|
switch ($action)
|
||||||
{
|
{
|
||||||
@@ -24,6 +25,7 @@ switch ($action)
|
|||||||
case 'lock_gallery' :
|
case 'lock_gallery' :
|
||||||
{
|
{
|
||||||
conf_update_param('gallery_locked', 'true');
|
conf_update_param('gallery_locked', 'true');
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_CORE, 'maintenance', array('maintenance_action'=>$action));
|
||||||
redirect(get_root_url().'admin.php?page=maintenance');
|
redirect(get_root_url().'admin.php?page=maintenance');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -31,6 +33,7 @@ switch ($action)
|
|||||||
{
|
{
|
||||||
conf_update_param('gallery_locked', 'false');
|
conf_update_param('gallery_locked', 'false');
|
||||||
$_SESSION['page_infos'] = array(l10n('Gallery unlocked'));
|
$_SESSION['page_infos'] = array(l10n('Gallery unlocked'));
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_CORE, 'maintenance', array('maintenance_action'=>$action));
|
||||||
redirect(get_root_url().'admin.php?page=maintenance');
|
redirect(get_root_url().'admin.php?page=maintenance');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -243,10 +246,15 @@ DELETE
|
|||||||
|
|
||||||
default :
|
default :
|
||||||
{
|
{
|
||||||
|
$register_activity = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($register_activity)
|
||||||
|
{
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_CORE, 'maintenance', array('maintenance_action'=>$action));
|
||||||
|
}
|
||||||
|
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
// | template init |
|
// | template init |
|
||||||
|
|||||||
@@ -50,6 +50,19 @@ if (isset($_GET['installstatus']))
|
|||||||
|
|
||||||
$page['infos'][] = l10n('Plugin has been successfully copied');
|
$page['infos'][] = l10n('Plugin has been successfully copied');
|
||||||
$page['infos'][] = '<a href="'. $activate_url . '">' . l10n('Activate it now') . '</a>';
|
$page['infos'][] = '<a href="'. $activate_url . '">' . l10n('Activate it now') . '</a>';
|
||||||
|
|
||||||
|
if (isset($plugins->fs_plugins[$_GET['plugin_id']]))
|
||||||
|
{
|
||||||
|
pwg_activity(
|
||||||
|
'system',
|
||||||
|
ACTIVITY_SYSTEM_PLUGIN,
|
||||||
|
'install',
|
||||||
|
array(
|
||||||
|
'plugin_id' => $_GET['plugin_id'],
|
||||||
|
'version' => $plugins->fs_plugins[$_GET['plugin_id']]['version'],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'temp_path_error':
|
case 'temp_path_error':
|
||||||
|
|||||||
@@ -44,10 +44,11 @@ if (isset($_GET['revision']) and isset($_GET['extension']))
|
|||||||
$install_status = $themes->extract_theme_files(
|
$install_status = $themes->extract_theme_files(
|
||||||
'install',
|
'install',
|
||||||
$_GET['revision'],
|
$_GET['revision'],
|
||||||
$_GET['extension']
|
$_GET['extension'],
|
||||||
|
$theme_id
|
||||||
);
|
);
|
||||||
|
|
||||||
redirect($base_url.'&installstatus='.$install_status);
|
redirect($base_url.'&installstatus='.$install_status.'&theme_id='.$theme_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +62,19 @@ if (isset($_GET['installstatus']))
|
|||||||
{
|
{
|
||||||
case 'ok':
|
case 'ok':
|
||||||
$page['infos'][] = l10n('Theme has been successfully installed');
|
$page['infos'][] = l10n('Theme has been successfully installed');
|
||||||
|
|
||||||
|
if (isset($themes->fs_themes[$_GET['theme_id']]))
|
||||||
|
{
|
||||||
|
pwg_activity(
|
||||||
|
'system',
|
||||||
|
ACTIVITY_SYSTEM_THEME,
|
||||||
|
'install',
|
||||||
|
array(
|
||||||
|
'theme_id' => $_GET['theme_id'],
|
||||||
|
'version' => $themes->fs_themes[$_GET['theme_id']]['version'],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'temp_path_error':
|
case 'temp_path_error':
|
||||||
|
|||||||
@@ -101,7 +101,9 @@ SELECT
|
|||||||
performed_by,
|
performed_by,
|
||||||
COUNT(*) as counter
|
COUNT(*) as counter
|
||||||
FROM '.ACTIVITY_TABLE.'
|
FROM '.ACTIVITY_TABLE.'
|
||||||
group by performed_by;';
|
WHERE object != \'system\'
|
||||||
|
GROUP BY performed_by
|
||||||
|
;';
|
||||||
|
|
||||||
$nb_lines_for_user = query2array($query, 'performed_by', 'counter');
|
$nb_lines_for_user = query2array($query, 'performed_by', 'counter');
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ define('ACCESS_ADMINISTRATOR', 3);
|
|||||||
define('ACCESS_WEBMASTER', 4);
|
define('ACCESS_WEBMASTER', 4);
|
||||||
define('ACCESS_CLOSED', 5);
|
define('ACCESS_CLOSED', 5);
|
||||||
|
|
||||||
|
// System activities
|
||||||
|
define('ACTIVITY_SYSTEM_CORE', 1);
|
||||||
|
define('ACTIVITY_SYSTEM_PLUGIN', 2);
|
||||||
|
define('ACTIVITY_SYSTEM_THEME', 3);
|
||||||
|
|
||||||
// Sanity checks
|
// Sanity checks
|
||||||
define('PATTERN_ID', '/^\d+$/');
|
define('PATTERN_ID', '/^\d+$/');
|
||||||
|
|
||||||
|
|||||||
@@ -536,6 +536,13 @@ function pwg_activity($object, $object_id, $action, $details=array())
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_REQUEST['method']) and 'pwg.plugins.performAction' == $_REQUEST['method'] and $_REQUEST['action'] != $action)
|
||||||
|
{
|
||||||
|
// for example, if you "restore" a plugin, the internal sequence will perform deactivate/uninstall/install/activate.
|
||||||
|
// We only want to keep the last call to pwg_activity with the "restore" action.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$object_ids = $object_id;
|
$object_ids = $object_id;
|
||||||
if (!is_array($object_id))
|
if (!is_array($object_id))
|
||||||
{
|
{
|
||||||
@@ -556,6 +563,13 @@ function pwg_activity($object, $object_id, $action, $details=array())
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('autoupdate' == $action)
|
||||||
|
{
|
||||||
|
// autoupdate on a plugin can happen anywhere, the "script/method" is not meaningfull
|
||||||
|
unset($details['method']);
|
||||||
|
unset($details['script']);
|
||||||
|
}
|
||||||
|
|
||||||
$user_agent = null;
|
$user_agent = null;
|
||||||
if ('user' == $object and 'login' == $action and isset($_SERVER['HTTP_USER_AGENT']))
|
if ('user' == $object and 'login' == $action and isset($_SERVER['HTTP_USER_AGENT']))
|
||||||
{
|
{
|
||||||
@@ -588,7 +602,7 @@ function pwg_activity($object, $object_id, $action, $details=array())
|
|||||||
|
|
||||||
foreach ($object_ids as $loop_object_id)
|
foreach ($object_ids as $loop_object_id)
|
||||||
{
|
{
|
||||||
$performed_by = $user['id'];
|
$performed_by = $user['id'] ?? 0; // on a plugin autoupdate, $user is not yet loaded
|
||||||
|
|
||||||
if ('logout' == $action)
|
if ('logout' == $action)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -385,6 +385,9 @@ function autoupdate_plugin(&$plugin)
|
|||||||
safe_version_compare($plugin['version'], $fs_version, '<')
|
safe_version_compare($plugin['version'], $fs_version, '<')
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
$old_version = $plugin['version'];
|
||||||
|
$new_version = $fs_version;
|
||||||
|
|
||||||
$plugin['version'] = $fs_version;
|
$plugin['version'] = $fs_version;
|
||||||
|
|
||||||
$maintain_file = PHPWG_PLUGINS_PATH.$plugin['id'].'/maintain.class.php';
|
$maintain_file = PHPWG_PLUGINS_PATH.$plugin['id'].'/maintain.class.php';
|
||||||
@@ -407,8 +410,9 @@ function autoupdate_plugin(&$plugin)
|
|||||||
$plugin_maintain->update($plugin['version'], $fs_version, $page['errors']);
|
$plugin_maintain->update($plugin['version'], $fs_version, $page['errors']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update database (only on production)
|
// update database (only on production). We want to avoid registering an "auto" to "auto" update,
|
||||||
if ($plugin['version'] != 'auto')
|
// which happens for each "version=auto" plugin on each page load.
|
||||||
|
if ($new_version != $old_version)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
UPDATE '. PLUGINS_TABLE .'
|
UPDATE '. PLUGINS_TABLE .'
|
||||||
@@ -416,6 +420,8 @@ UPDATE '. PLUGINS_TABLE .'
|
|||||||
WHERE id = "'. $plugin['id'] .'"
|
WHERE id = "'. $plugin['id'] .'"
|
||||||
;';
|
;';
|
||||||
pwg_query($query);
|
pwg_query($query);
|
||||||
|
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_PLUGIN, 'autoupdate', array('plugin_id'=>$plugin['id'], 'from_version'=>$old_version, 'to_version'=>$new_version));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,6 +190,20 @@ function ws_extensions_update($params, $service)
|
|||||||
{
|
{
|
||||||
$upgrade_status = $extension->extract_theme_files('upgrade', $revision, $extension_id);
|
$upgrade_status = $extension->extract_theme_files('upgrade', $revision, $extension_id);
|
||||||
$extension_name = $extension->fs_themes[$extension_id]['name'];
|
$extension_name = $extension->fs_themes[$extension_id]['name'];
|
||||||
|
|
||||||
|
$activity_details = array('theme_id'=>$extension_id, 'from_version'=>$extension->fs_themes[$extension_id]['version']);
|
||||||
|
|
||||||
|
if ('ok' == $upgrade_status)
|
||||||
|
{
|
||||||
|
$extension->get_fs_themes(); // refresh list
|
||||||
|
$activity_details['to_version'] = $extension->fs_themes[$extension_id]['version'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$activity_details['result'] = 'error';
|
||||||
|
}
|
||||||
|
|
||||||
|
pwg_activity('system', ACTIVITY_SYSTEM_THEME, 'update', $activity_details);
|
||||||
}
|
}
|
||||||
else if ($type == 'languages')
|
else if ($type == 'languages')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -446,23 +446,24 @@ SELECT
|
|||||||
occured_on,
|
occured_on,
|
||||||
details,
|
details,
|
||||||
user_agent
|
user_agent
|
||||||
FROM '.ACTIVITY_TABLE;
|
FROM '.ACTIVITY_TABLE.'
|
||||||
|
WHERE object != \'system\'';
|
||||||
|
|
||||||
if (isset($param['uid']))
|
if (isset($param['uid']))
|
||||||
{
|
{
|
||||||
$query.= '
|
$query.= '
|
||||||
WHERE performed_by = '.$param['uid'];
|
AND performed_by = '.$param['uid'];
|
||||||
}
|
}
|
||||||
elseif ('none' == $conf['activity_display_connections'])
|
elseif ('none' == $conf['activity_display_connections'])
|
||||||
{
|
{
|
||||||
$query.= '
|
$query.= '
|
||||||
WHERE action NOT IN (\'login\', \'logout\')';
|
AND action NOT IN (\'login\', \'logout\')';
|
||||||
}
|
}
|
||||||
elseif ('admins_only' == $conf['activity_display_connections'])
|
elseif ('admins_only' == $conf['activity_display_connections'])
|
||||||
{
|
{
|
||||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||||
$query.= '
|
$query.= '
|
||||||
WHERE NOT (action IN (\'login\', \'logout\') AND object_id NOT IN ('.implode(',', get_admins()).'))';
|
AND NOT (action IN (\'login\', \'logout\') AND object_id NOT IN ('.implode(',', get_admins()).'))';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query.= '
|
$query.= '
|
||||||
|
|||||||
Reference in New Issue
Block a user