[feature/merging-style-components] Renaming "delete" to "uninstall" for styles

Changing from "delete" to "uninstall" in acp_styles to avoid confusing users

PHPBB3-10632
This commit is contained in:
Vjacheslav Trushkin 2012-03-31 17:58:17 +03:00
parent 360312f599
commit 0540509f14
2 changed files with 37 additions and 34 deletions

View file

@ -45,7 +45,7 @@ class acp_styles
$this->mode = $mode; $this->mode = $mode;
$action = $request->variable('action', ''); $action = $request->variable('action', '');
$post_actions = array('install', 'activate', 'deactivate', 'delete'); $post_actions = array('install', 'activate', 'deactivate', 'uninstall');
foreach ($post_actions as $key) foreach ($post_actions as $key)
{ {
if (isset($_POST[$key])) if (isset($_POST[$key]))
@ -70,8 +70,8 @@ class acp_styles
case 'install': case 'install':
$this->action_install(); $this->action_install();
return; return;
case 'delete': case 'uninstall':
$this->action_delete(); $this->action_uninstall();
return; return;
case 'activate': case 'activate':
$this->action_activate(); $this->action_activate();
@ -187,47 +187,47 @@ class acp_styles
} }
/** /**
* Confirm styles deletion * Confirm styles removal
*/ */
function action_delete() function action_uninstall()
{ {
global $user, $config, $template, $request; global $user, $config, $template, $request;
// Get list of styles to delete // Get list of styles to uninstall
$ids = $this->request_vars('id', 0, true); $ids = $this->request_vars('id', 0, true);
// Check if confirmation box was submitted // Check if confirmation box was submitted
if (confirm_box(true)) if (confirm_box(true))
{ {
// Delete // Uninstall
$this->action_delete_confirmed($ids, $request->variable('confirm_delete_files', false)); $this->action_uninstall_confirmed($ids, $request->variable('confirm_delete_files', false));
return; return;
} }
// Confirm box // Confirm box
$s_hidden = build_hidden_fields(array( $s_hidden = build_hidden_fields(array(
'action' => 'delete', 'action' => 'uninstall',
'ids' => $ids 'ids' => $ids
)); ));
$template->assign_var('S_CONFIRM_DELETE', true); $template->assign_var('S_CONFIRM_DELETE', true);
confirm_box(false, $user->lang['CONFIRM_DELETE_STYLES'], $s_hidden, 'acp_styles.html'); confirm_box(false, $user->lang['CONFIRM_UNINSTALL_STYLES'], $s_hidden, 'acp_styles.html');
// Canceled - show styles list // Canceled - show styles list
$this->frontend(); $this->frontend();
} }
/** /**
* Delete styles(s) * Uninstall styles(s)
* *
* @param array $ids List of style IDs * @param array $ids List of style IDs
* @param bool $delete_files If true, script will attempt to remove files for selected styles * @param bool $delete_files If true, script will attempt to remove files for selected styles
*/ */
function action_delete_confirmed($ids, $delete_files) function action_uninstall_confirmed($ids, $delete_files)
{ {
global $db, $user, $cache, $config; global $db, $user, $cache, $config;
$default = $config['default_style']; $default = $config['default_style'];
$deleted = array(); $uninstalled = array();
$messages = array(); $messages = array();
// Check styles list // Check styles list
@ -239,9 +239,9 @@ class acp_styles
} }
if ($id == $default) if ($id == $default)
{ {
trigger_error($user->lang['DELETE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['UNINSTALL_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
$deleted[$id] = false; $uninstalled[$id] = false;
} }
// Order by reversed style_id, so parent styles would be removed after child styles // Order by reversed style_id, so parent styles would be removed after child styles
@ -255,19 +255,19 @@ class acp_styles
$rows = $db->sql_fetchrowset($result); $rows = $db->sql_fetchrowset($result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
// Delete each style // Uinstall each style
$deleted = array(); $uninstalled = array();
foreach ($rows as $style) foreach ($rows as $style)
{ {
$result = $this->delete_style($style, $delete_files); $result = $this->uninstall_style($style, $delete_files);
if (is_string($result)) if (is_string($result))
{ {
$messages[] = $result; $messages[] = $result;
continue; continue;
} }
$messages[] = sprintf($user->lang['STYLE_DELETED'], $style['style_name']); $messages[] = sprintf($user->lang['STYLE_UNINSTALLED'], $style['style_name']);
$deleted[] = $style['style_name']; $uninstalled[] = $style['style_name'];
// Attempt to delete files // Attempt to delete files
if ($delete_files) if ($delete_files)
@ -278,14 +278,14 @@ class acp_styles
if (empty($messages)) if (empty($messages))
{ {
// Nothing to delete? // Nothing to uninstall?
trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
// Log action // Log action
if (count($deleted)) if (count($uninstalled))
{ {
add_log('admin', 'LOG_STYLE_DELETE', implode(', ', $deleted)); add_log('admin', 'LOG_STYLE_DELETE', implode(', ', $uninstalled));
} }
// Clear cache // Clear cache
@ -591,8 +591,8 @@ class acp_styles
if (isset($this->style_counters) && $this->style_counters['total'] > 1) if (isset($this->style_counters) && $this->style_counters['total'] > 1)
{ {
$template->assign_block_vars('extra_actions', array( $template->assign_block_vars('extra_actions', array(
'ACTION_NAME' => 'delete', 'ACTION_NAME' => 'uninstall',
'L_ACTION' => $user->lang['DELETE'], 'L_ACTION' => $user->lang['STYLE_UNINSTALL'],
) )
); );
} }
@ -924,10 +924,10 @@ class acp_styles
'L_ACTION' => $user->lang['EXPORT'] 'L_ACTION' => $user->lang['EXPORT']
); */ ); */
// Delete // Uninstall
$actions[] = array( $actions[] = array(
'U_ACTION' => $this->u_action . '&action=delete&id=' . $style['style_id'], 'U_ACTION' => $this->u_action . '&action=uninstall&id=' . $style['style_id'],
'L_ACTION' => $user->lang['DELETE'] 'L_ACTION' => $user->lang['STYLE_UNINSTALL']
); );
// Preview // Preview
@ -1156,12 +1156,12 @@ class acp_styles
} }
/** /**
* Delete style * Uninstall style
* *
* @param array $style Style data * @param array $style Style data
* @returns true on success, error message on error * @returns true on success, error message on error
*/ */
function delete_style($style) function uninstall_style($style)
{ {
global $db, $user; global $db, $user;
@ -1179,7 +1179,7 @@ class acp_styles
if ($conflict !== false) if ($conflict !== false)
{ {
return sprintf($user->lang['STYLE_DELETE_DEPENDENT'], $style['style_name']); return sprintf($user->lang['STYLE_UNINSTALL_DEPENDENT'], $style['style_name']);
} }
// Change default style for users // Change default style for users
@ -1188,7 +1188,7 @@ class acp_styles
WHERE user_style = ' . $id; WHERE user_style = ' . $id;
$db->sql_query($sql); $db->sql_query($sql);
// Delete style // Uninstall style
$sql = 'DELETE FROM ' . STYLES_TABLE . ' $sql = 'DELETE FROM ' . STYLES_TABLE . '
WHERE style_id = ' . $id; WHERE style_id = ' . $id;
$db->sql_query($sql); $db->sql_query($sql);

View file

@ -55,6 +55,7 @@ $lang = array_merge($lang, array(
'CANNOT_BE_INSTALLED' => 'Cannot be installed', 'CANNOT_BE_INSTALLED' => 'Cannot be installed',
'CONFIRM_TEMPLATE_CLEAR_CACHE' => 'Are you sure you wish to clear all cached versions of your template files?', 'CONFIRM_TEMPLATE_CLEAR_CACHE' => 'Are you sure you wish to clear all cached versions of your template files?',
'CONFIRM_DELETE_STYLES' => 'Are you sure you wish to delete selected styles?', 'CONFIRM_DELETE_STYLES' => 'Are you sure you wish to delete selected styles?',
'CONFIRM_UNINSTALL_STYLES' => 'Are you sure you wish to uninstall selected styles?',
'COPYRIGHT' => 'Copyright', 'COPYRIGHT' => 'Copyright',
'CREATE_STYLE' => 'Create new style', 'CREATE_STYLE' => 'Create new style',
'CREATE_TEMPLATE' => 'Create new template set', 'CREATE_TEMPLATE' => 'Create new template set',
@ -62,7 +63,6 @@ $lang = array_merge($lang, array(
'CURRENT_IMAGE' => 'Current image', 'CURRENT_IMAGE' => 'Current image',
'DEACTIVATE_DEFAULT' => 'You cannot deactivate the default style.', 'DEACTIVATE_DEFAULT' => 'You cannot deactivate the default style.',
'DELETE_DEFAULT' => 'You cannot delete the default style.',
'DELETE_FROM_FS' => 'Delete from filesystem', 'DELETE_FROM_FS' => 'Delete from filesystem',
'DELETE_STYLE' => 'Delete style', 'DELETE_STYLE' => 'Delete style',
'DELETE_STYLE_EXPLAIN' => 'Here you can remove the selected style. Take care in deleting styles, there is no undo capability.', 'DELETE_STYLE_EXPLAIN' => 'Here you can remove the selected style. Take care in deleting styles, there is no undo capability.',
@ -291,7 +291,6 @@ $lang = array_merge($lang, array(
'STYLE_DEFAULT' => 'Make default style', 'STYLE_DEFAULT' => 'Make default style',
'STYLE_DEFAULT_CHANGE' => 'Change default style', 'STYLE_DEFAULT_CHANGE' => 'Change default style',
'STYLE_DEFAULT_CHANGE_INACTIVE' => 'You must activate style before making it default style.', 'STYLE_DEFAULT_CHANGE_INACTIVE' => 'You must activate style before making it default style.',
'STYLE_DELETE_DEPENDENT' => 'Style "%s" cannot be deleted because it has one or more child styles.',
'STYLE_DELETED' => 'Style "%s" deleted successfully.', 'STYLE_DELETED' => 'Style "%s" deleted successfully.',
'STYLE_DETAILS_UPDATED' => 'Style edited successfully.', 'STYLE_DETAILS_UPDATED' => 'Style edited successfully.',
'STYLE_ERR_ARCHIVE' => 'Please select an archive method.', 'STYLE_ERR_ARCHIVE' => 'Please select an archive method.',
@ -316,6 +315,9 @@ $lang = array_merge($lang, array(
'STYLE_PARENT' => 'Parent style:', 'STYLE_PARENT' => 'Parent style:',
'STYLE_TEMPLATE' => 'Template', 'STYLE_TEMPLATE' => 'Template',
'STYLE_THEME' => 'Theme', 'STYLE_THEME' => 'Theme',
'STYLE_UNINSTALL' => 'Uninstall',
'STYLE_UNINSTALL_DEPENDENT' => 'Style "%s" cannot be uninstalled because it has one or more child styles.',
'STYLE_UNINSTALLED' => 'Style "%s" uninstalled successfully.',
'STYLE_USED_BY' => 'Used by (including robots)', 'STYLE_USED_BY' => 'Used by (including robots)',
'TEMPLATE_ADDED' => 'Template set added.', 'TEMPLATE_ADDED' => 'Template set added.',
@ -364,6 +366,7 @@ $lang = array_merge($lang, array(
'THEME_UPDATED' => 'Theme updated successfully.', 'THEME_UPDATED' => 'Theme updated successfully.',
'UNDERLINE' => 'Underline', 'UNDERLINE' => 'Underline',
'UNINSTALL_DEFAULT' => 'You cannot uninstall the default style.',
'UNSET' => 'Undefined', 'UNSET' => 'Undefined',
)); ));