Browse Source

Fie transfer maintenance function

Kays48 12 years ago
parent
commit
3fddc86585

+ 6 - 4
Sources/Attachments.php

@@ -23,9 +23,11 @@ function automanage_attachments_check_directory()
 	global $boarddir, $modSettings, $context;
 
 	// Not pretty, but since we don't want folders created for every post. It'll do unless a better solution can be found.
-	if (empty($modSettings['automanage_attachments']))
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'admin')
+		$doit = true;
+	elseif (empty($modSettings['automanage_attachments']))
 		return;
-	elseif (!isset($_FILES) && !isset($doit))
+	elseif (!isset($_FILES))
 		return;
 	elseif (isset($_FILES))
 		foreach ($_FILES['attachment']['tmp_name'] as $dummy)
@@ -220,9 +222,9 @@ function automanage_attachments_by_space()
 	{
 		$modSettings['currentAttachmentUploadDir'] = array_search($updir, $modSettings['attachmentUploadDir']);
 		updateSettings(array(
-			'currentAttachmentUploadDir' => $modSettings['currentAttachmentUploadDir'],
 			'last_attachments_directory' => serialize($modSettings['last_attachments_directory']),
-		), true);
+			'currentAttachmentUploadDir' => $modSettings['currentAttachmentUploadDir'],
+		));
 		$modSettings['last_attachments_directory'] = unserialize($modSettings['last_attachments_directory']);
 
 		return true;

+ 268 - 14
Sources/ManageAttachments.php

@@ -50,7 +50,8 @@ function ManageAttachments()
 		'moveAvatars' => 'MoveAvatars',
 		'repair' => 'RepairAttachments',
 		'remove' => 'RemoveAttachment',
-		'removeall' => 'RemoveAllAttachments'
+		'removeall' => 'RemoveAllAttachments',
+		'transfer' => 'TransferAttachments',
 	);
 
 	call_integration_hook('integrate_manage_attachments', array(&$subActions));
@@ -687,6 +688,7 @@ function MaintainFiles()
 	);
 	list ($context['num_attachments']) = $smcFunc['db_fetch_row']($request);
 	$smcFunc['db_free_result']($request);
+	$context['num_attachments'] = comma_format($context['num_attachments'], 0);
 
 	// Also get the avatar amount....
 	$request = $smcFunc['db_query']('', '
@@ -699,26 +701,53 @@ function MaintainFiles()
 	);
 	list ($context['num_avatars']) = $smcFunc['db_fetch_row']($request);
 	$smcFunc['db_free_result']($request);
+	$context['num_avatars'] = comma_format($context['num_avatars'], 0);
 
 	// Check the size of all the directories.
 	$request = $smcFunc['db_query']('', '
 		SELECT SUM(size)
-		FROM {db_prefix}attachments',
+		FROM {db_prefix}attachments
+		WHERE attachment_type != {int:type}',
 		array(
+			'type' => 1,
 		)
 	);
 	list ($attachmentDirSize) = $smcFunc['db_fetch_row']($request);
 	$smcFunc['db_free_result']($request);
-
-	// Divide it into kilobytes.
 	$attachmentDirSize /= 1024;
+	$context['attachment_total_size'] = comma_format($attachmentDirSize, 2);
 
-	// If they specified a limit only....
-	if (!empty($modSettings['attachmentDirSizeLimit']))
-		$context['attachment_space'] = max(round($modSettings['attachmentDirSizeLimit'] - $attachmentDirSize, 2), 0);
-	$context['attachment_total_size'] = round($attachmentDirSize, 2);
+	$request = $smcFunc['db_query']('', '
+		SELECT COUNT(*), SUM(size)
+		FROM {db_prefix}attachments
+		WHERE id_folder = {int:folder_id}
+			AND attachment_type != {int:type}',
+		array(
+			'folder_id' => $modSettings['currentAttachmentUploadDir'],
+			'type' => 1,
+		)
+	);
+	list ($current_dir_files, $current_dir_size) = $smcFunc['db_fetch_row']($request);
+	$smcFunc['db_free_result']($request);
+	$current_dir_size /= 1024;
 
-	$context['attach_multiple_dirs'] = !empty($modSettings['currentAttachmentUploadDir']);
+	if (!empty($modSettings['attachmentDirSizeLimit']))
+		$context['attachment_space'] = comma_format(max($modSettings['attachmentDirSizeLimit'] - $current_dir_size, 0), 2);
+	$context['attachment_current_size'] = comma_format($current_dir_size, 2);
+
+	if (!empty($modSettings['attachmentDirFileLimit']))
+		$context['attachment_files'] = comma_format(max($modSettings['attachmentDirFileLimit'] - $current_dir_files, 0), 0);
+	$context['attachment_current_files'] = comma_format($current_dir_files, 0);
+	
+	$context['attach_multiple_dirs'] = count($attach_dirs) > 1 ? true : false;
+	$context['attach_dirs'] = $attach_dirs;
+	$context['base_dirs'] = !empty($modSettings['attachment_basedirectories']) ? unserialize($modSettings['attachment_basedirectories']) : array();
+	$context['checked'] = isset($_SESSION['checked']) ? $_SESSION['checked'] : true;
+	if (!empty($_SESSION['results']))
+	{
+		$context['results'] = $_SESSION['results'];
+		unset($_SESSION['results']);
+	}
 }
 
 /**
@@ -1881,6 +1910,7 @@ function ManageAttachmentPaths()
 		$new_dirs = array();
 		foreach ($_POST['dirs'] as $id => $path)
 		{
+			$error = '';
 			$id = (int) $id;
 			if ($id < 1)
 				continue;
@@ -1984,11 +2014,11 @@ function ManageAttachmentPaths()
 							unlink($path . '/.htaccess');
 							unlink($path . '/index.php');
 							if (!@rmdir($path))
-								$errors[] = $path . ': ' . $txt['attach_dir_no_delete'];
+								$error = $path . ': ' . $txt['attach_dir_no_delete'];
 						}
 
 						// Remove it from the base directory list.
-						if (empty($errors) && !empty($modSettings['attachment_basedirectories']))
+						if (empty($error) && !empty($modSettings['attachment_basedirectories']))
 						{
 							unset($modSettings['attachment_basedirectories'][$id]);
 							updateSettings(array('attachment_basedirectories' => serialize($modSettings['attachment_basedirectories'])));
@@ -1996,10 +2026,12 @@ function ManageAttachmentPaths()
 						}
 					}
 					else
-						$errors[] = $path . ': ' . $txt['attach_dir_no_remove'];
+						$error = $path . ': ' . $txt['attach_dir_no_remove'];
 
-					if (empty($errors))
+					if (empty($error))
 						continue;
+					else
+						$errors[] = $error;
 				}
 			}
 
@@ -2044,7 +2076,7 @@ function ManageAttachmentPaths()
 					$bid = 0;
 				}
 
-				If ($bid >= 0)
+				if ($bid >= 0 && isset($modSettings['basedirectory_for_attachments']))
 				{
 					$modSettings['last_attachments_directory'][$bid] = (int) $num;
 					updateSettings(array(
@@ -2053,6 +2085,13 @@ function ManageAttachmentPaths()
 						'use_subdirectories_for_attachments' => $use_subdirectories_for_attachments,
 					));
 				}
+				elseif ($bid == 0)
+				{
+					$modSettings['last_attachments_directory'][$bid] = (int) $num;
+					updateSettings(array(
+						'last_attachments_directory' => serialize($modSettings['last_attachments_directory']),
+					));
+				}
 			}
 		}
 
@@ -2529,4 +2568,219 @@ function attachDirStatus($dir, $expected_files)
 		return array('ok', false, $num_files);
 }
 
+function TransferAttachments()
+{
+	global $modSettings, $context, $smcFunc, $sourcedir, $txt, $boarddir;
+	
+	checkSession();
+	
+	$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
+	if (!empty($modSettings['attachment_basedirectories']))
+		$modSettings['attachment_basedirectories'] = unserialize($modSettings['attachment_basedirectories']);
+	else
+		$modSettings['basedirectory_for_attachments'] = array();
+
+	$_POST['from'] = (int) $_POST['from'];
+	$_POST['auto'] = !empty($_POST['auto']) ? (int) $_POST['auto'] : 0;
+	$_POST['to'] = (int) $_POST['to'];
+	$start = !empty($_POST['empty_it']) ? 0 : $modSettings['attachmentDirFileLimit'];
+	$_SESSION['checked'] = !empty($_POST['empty_it']) ? true : false;
+	$limit = 500;
+	$results = '';
+	$dir_files = 0;
+	$current_progress = 0;
+	$total_moved = 0;
+	$total_not_moved = 0;
+	
+	if (empty($_POST['from']) || (empty($_POST['auto']) && empty($_POST['to'])))
+		$results .= $txt['attachment_transfer_no_dir'] . '<br />';
+
+	if ($_POST['from'] == $_POST['to'])
+		$results .= $txt['attachment_transfer_same_dir'] . '<br />';
+
+	if (empty($results))
+	{
+		// Get the total file count for the progess bar.
+		$request = $smcFunc['db_query']('', '
+			SELECT COUNT(*)
+			FROM {db_prefix}attachments
+			WHERE id_folder = {int:folder_id}
+				AND attachment_type != {int:attachment_type}',
+			array(
+				'folder_id' => $_POST['from'],
+				'attachment_type' => 1,
+			)
+		);
+		list ($total_progress) = $smcFunc['db_fetch_row']($request);
+		$smcFunc['db_free_result']($request);
+		$total_progress -= $start;
+
+		if ($total_progress < 1)
+			$results .= $txt['attachment_transfer_no_find'] . '<br />';
+	}
+
+	if (empty($results))
+	{
+		// Where are they going?
+		if (!empty($_POST['auto']))
+		{
+			require_once($sourcedir . '/Attachments.php');
+
+			$modSettings['automanage_attachments'] = 1;
+			$modSettings['use_subdirectories_for_attachments'] = $_POST['auto'] == -1 ? 0 : 1;
+			$modSettings['basedirectory_for_attachments'] = $_POST['auto'] > 0 ? $modSettings['attachmentUploadDir'][$_POST['auto']] : $modSettings['basedirectory_for_attachments'];
+
+			automanage_attachments_check_directory();
+			$new_dir = $modSettings['currentAttachmentUploadDir'];
+		}
+		else
+			$new_dir = $_POST['to'];
+
+		$modSettings['currentAttachmentUploadDir'] = $new_dir;
+
+		$break = false;
+		while ($break == false)
+		{
+			@set_time_limit(300);
+			if (function_exists('apache_reset_timeout'))
+				@apache_reset_timeout();
+
+			// If limts are set, get the file count and size for the destination folder
+			if ($dir_files <= 0 && (!empty($modSettings['attachmentDirSizeLimit']) || !empty($modSettings['attachmentDirFileLimit'])))
+			{
+				$request = $smcFunc['db_query']('', '
+					SELECT COUNT(*), SUM(size)
+					FROM {db_prefix}attachments
+					WHERE id_folder = {int:folder_id}
+						AND attachment_type != {int:attachment_type}',
+					array(
+						'folder_id' => $new_dir,
+						'attachment_type' => 1,
+					)
+				);
+				list ($dir_files, $dir_size) = $smcFunc['db_fetch_row']($request);
+				$smcFunc['db_free_result']($request);
+			}
+
+			// Find some attachments to move
+			$request = $smcFunc['db_query']('', '
+				SELECT id_attach, filename, id_folder, file_hash, size
+				FROM {db_prefix}attachments
+				WHERE id_folder = {int:folder}
+					AND attachment_type != {int:attachment_type}
+				LIMIT {int:start}, {int:limit}',
+				array(
+					'folder' => $_POST['from'],
+					'attachment_type' => 1,
+					'start' => $start,
+					'limit' => $limit,
+				)
+			);
+
+			if ($smcFunc['db_num_rows']($request) === 0)
+			{
+				if (empty($current_progress))
+					$results .= $txt['attachment_transfer_no_find'] . '<br />';
+				break;
+			}
+
+			if ($smcFunc['db_num_rows']($request) < $limit)
+				$break = true;
+
+			// Move them
+			$moved = array();
+			while ($row = $smcFunc['db_fetch_assoc']($request))
+			{
+				$source = getAttachmentFilename($row['filename'], $row['id_attach'], $row['id_folder'], false, $row['file_hash']);
+				$dest = $modSettings['attachmentUploadDir'][$new_dir] . '/' . basename($source);
+
+				if (@rename($source, $dest))
+				{
+					$total_moved++;
+					$current_progress++;
+					$moved[] = $row['id_attach'];
+
+					// Size and file count check
+					if (!empty($modSettings['attachmentDirSizeLimit']) || !empty($modSettings['attachmentDirFileLimit']))
+					{
+						$dir_files++;
+						$dir_size += !empty($row['size']) ? $row['size'] : filesize($source);
+
+						// If we've reached a limit. Do something.
+						if (!empty($modSettings['attachmentDirSizeLimit']) && $dir_size > $modSettings['attachmentDirSizeLimit'] * 1024 || (!empty($modSettings['attachmentDirFileLimit']) && $dir_files >  $modSettings['attachmentDirFileLimit'] - 1))
+						{
+							if (!empty($_POST['auto']))
+							{
+								// Since we're in auto mode. Create a new folder and reset the counters.
+								automanage_attachments_by_space();
+								
+								$results .= sprintf($txt['attachments_transfered'], $total_moved, $modSettings['attachmentUploadDir'][$new_dir]) . '<br />';
+								if (!empty($total_not_moved))
+									$results .= sprintf($txt['attachments_not_transfered'], $total_not_moved) . '<br />';
+								
+								$dir_files = -1;
+								$total_moved = 0;
+								$total_not_moved = 0;
+
+								$break = false;
+								break;
+							}
+							else
+							{
+								// Hmm, time to bail out then...
+								$results .= $txt['attachment_transfer_no_room'] . '<br />';
+								$break = true;
+								break;
+							}
+						}
+					}
+				}
+				else
+					$total_not_moved++;
+			}
+			$smcFunc['db_free_result']($request);
+
+			// Update the database
+			$smcFunc['db_query']('', '
+				UPDATE {db_prefix}attachments
+				SET id_folder = {int:new}
+				WHERE id_attach IN ({array_int:attachments})',
+				array(
+					'attachments' => $moved,
+					'new' => $new_dir,
+				)
+			);
+
+			$moved = array();
+			$new_dir = $modSettings['currentAttachmentUploadDir'];
+
+			// Create the progress bar.
+			if (!$break)
+			{
+				$percent_done = min(round($current_progress / $total_progress * 100, 0), 100);
+				$prog_bar = '
+					<div class="progress_bar">
+						<div class="full_bar">' . $percent_done . '%</div>
+						<div class="green_percent" style="width: ' . $percent_done . '%;">&nbsp;</div>
+					</div>';
+				// Write it to a file so it can be displayed
+				$fp = fopen($boarddir . '/progress.php', "w");        
+				fwrite($fp, $prog_bar);  
+				fclose($fp);  
+				usleep(500000);
+			}
+		}
+
+		$results .= sprintf($txt['attachments_transfered'], $total_moved, $modSettings['attachmentUploadDir'][$new_dir]) . '<br />';
+		if (!empty($total_not_moved))
+			$results .= sprintf($txt['attachments_not_transfered'], $total_not_moved) . '<br />';
+	}
+
+	$_SESSION['results'] = $results;
+	if (file_exists($boarddir . '/progress.php'))
+		unlink($boarddir . '/progress.php');
+
+	redirectexit('action=admin;area=manageattachments;sa=maintenance#transfer');
+}
+
 ?>

+ 90 - 3
Themes/default/ManageAttachments.template.php

@@ -61,7 +61,7 @@ function template_browse()
 
 function template_maintenance()
 {
-	global $context, $settings, $options, $scripturl, $txt;
+	global $context, $settings, $options, $scripturl, $txt, $modSettings;
 
 	echo '
 	<div id="manage_attachments">
@@ -74,8 +74,12 @@ function template_maintenance()
 				<dl class="settings">
 					<dt><strong>', $txt['attachment_total'], ':</strong></dt><dd>', $context['num_attachments'], '</dd>
 					<dt><strong>', $txt['attachment_manager_total_avatars'], ':</strong></dt><dd>', $context['num_avatars'], '</dd>
-					<dt><strong>', $txt['attachmentdir_size' . ($context['attach_multiple_dirs'] ? '_current' : '')], ':</strong></dt><dd>', $context['attachment_total_size'], ' ', $txt['kilobyte'], '</dd>
-					<dt><strong>', $txt['attachment_space' . ($context['attach_multiple_dirs'] ? '_current' : '')], ':</strong></dt><dd>', isset($context['attachment_space']) ? $context['attachment_space'] . ' ' . $txt['kilobyte'] : $txt['attachmentdir_size_not_set'], '</dd>
+					<dt><strong>', $txt['attachmentdir_size'], ':</strong></dt><dd>', $context['attachment_total_size'], ' ', $txt['kilobyte'], '</dd>
+					<dt><strong>', $txt['attach_current_dir'], ':</strong></dt><dd>', $modSettings['attachmentUploadDir'][$modSettings['currentAttachmentUploadDir']], '</dd>
+					<dt><strong>', $txt['attachmentdir_size_current'], ':</strong></dt><dd>', $context['attachment_current_size'], ' ', $txt['kilobyte'], '</dd>
+					<dt><strong>', $txt['attachment_space'], ':</strong></dt><dd>', isset($context['attachment_space']) ? $context['attachment_space'] . ' ' . $txt['kilobyte'] : $txt['attachmentdir_size_not_set'], '</dd>
+					<dt><strong>', $txt['attachmentdir_files_current'], ':</strong></dt><dd>', $context['attachment_current_files'], '</dd>
+					<dt><strong>', $txt['attachment_files'], ':</strong></dt><dd>', isset($context['attachment_files']) ? $context['attachment_files'] : $txt['attachmentdir_files_not_set'], '</dd>
 				</dl>
 			</div>
 			<span class="botslice"><span></span></span>
@@ -136,6 +140,89 @@ function template_maintenance()
 		</div>
 	</div>
 	<br class="clear" />';
+	
+	echo '
+			<div id="transfer" class="cat_bar">
+				<h3 class="catbg">', $txt['attachment_transfer'], '</h3>
+			</div>';
+
+	if (!empty($context['results']))
+		echo '
+			<div class="noticebox">', $context['results'], '</div>';
+
+	echo '
+			<div class="windowbg">
+				<div class="content">
+					<form action="', $scripturl, '?action=admin;area=manageattachments;sa=transfer" method="post" accept-charset="', $context['character_set'], '">
+						<p>', $txt['attachment_transfer_desc'], '</p>
+						<hr class="hrcolor" />
+						<dl class="settings">
+							<dt>', $txt['attachment_transfer_from'], '</dt>
+							<dd><select name="from">
+								<option value="0">', $txt['attachment_transfer_select'], '</option>';
+
+	foreach ($context['attach_dirs'] as $id => $dir)
+		echo '
+								<option value="', $id, '">', $dir, '</option>';
+	echo '
+							</select></dd>
+							<dt>', $txt['attachment_transfer_auto'], '</dt>
+							<dd><select name="auto">
+								<option value="0">', $txt['attachment_transfer_auto_select'], '</option>
+								<option value="-1">', $txt['attachment_transfer_forum_root'], '</option>';
+
+	if (!empty($context['base_dirs']))
+		foreach ($context['base_dirs'] as $id => $dir)
+			echo '
+								<option value="', $id, '">', $dir, '</option>';
+	else
+			echo '
+								<option value="0" disabled="disabled">', $txt['attachment_transfer_no_base'], '</option>';
+
+	echo '
+							</select></dd>
+							<dt>', $txt['attachment_transfer_to'], '</dt>
+							<dd><select name="to">
+								<option value="0">', $txt['attachment_transfer_select'], '</option>';
+
+	foreach($context['attach_dirs'] as $id => $dir)
+		echo '
+								<option value="', $id, '">', $dir, '</option>';
+	echo '
+							</select></dd>';
+
+	if (!empty($modSettings['attachmentDirFileLimit']))
+		echo '
+							<dt>', $txt['attachment_transfer_empty'], '</dt>
+							<dd><input type="checkbox" name="empty_it"', $context['checked'] ? ' checked="checked"' : '', ' /></dd>';
+	echo '
+						</dl>
+						<hr />
+						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
+						<input type="submit" onclick="start_progress()" name="transfer" value="', $txt['attachment_transfer_now'], '" class="button_submit" />
+						<div id="progress_msg"></div>
+						<div id="show_progress" class="padding"></div>
+						<br class="clear_right" />
+					</form>
+					<script type="text/javascript"><!-- // --><![CDATA[
+						function start_progress() {
+							setTimeout(\'show_msg()\', 1000);
+						}
+
+						function show_msg() {
+							$(\'#progress_msg\').html(\'<div><img src="', $settings['actual_images_url'], '/loading.gif" alt="loading.gif" width="35" height="35" />&nbsp; ', $txt['attachment_transfer_progress'] , '<\/div>\');
+							show_progress();
+						}
+
+						function show_progress() {
+							$(\'#show_progress\').load("progress.php");
+							setTimeout(\'show_progress()\', 1500);
+						}
+
+					// ]]></script>
+				</div>
+			</div>
+			<br class="clear" />';
 }
 
 function template_attachment_repair()

+ 30 - 7
Themes/default/languages/Admin.english.php

@@ -1,5 +1,5 @@
 <?php
-// Version: 2.0; Admin
+// Version: 2.1; Admin
 
 global $settings, $scripturl;
 
@@ -88,11 +88,14 @@ $txt['attachment_check_now'] = 'Run check now';
 $txt['attachment_pruning'] = 'Attachment Pruning';
 $txt['attachment_pruning_message'] = 'Message to add to post';
 $txt['attachment_pruning_warning'] = 'Are you sure you want to delete these attachments?\\nThis cannot be undone!';
-$txt['attachment_total'] = 'Total Attachments';
-$txt['attachmentdir_size'] = 'Total Size of Attachment Directory';
-$txt['attachmentdir_size_current'] = 'Total Size of Current Attachment Directory';
-$txt['attachment_space'] = 'Total Space Available in Attachment Directory';
-$txt['attachment_space_current'] = 'Total Space Available in Current Attachment Directory';
+
+$txt['attachment_total'] = 'Total attachments';
+$txt['attachmentdir_size'] = 'Total size of all attachment directories';
+$txt['attachmentdir_size_current'] = 'Total size of current attachment directory';
+$txt['attachmentdir_files_current'] = 'Total files in current attachment directory';
+$txt['attachment_space'] = 'Total space available';
+$txt['attachment_files'] = 'Total files remaining';
+
 $txt['attachment_options'] = 'File Attachment Options';
 $txt['attachment_log'] = 'Attachment Log';
 $txt['attachment_remove_old'] = 'Remove attachments older than';
@@ -100,6 +103,7 @@ $txt['attachment_remove_size'] = 'Remove attachments larger than';
 $txt['attachment_name'] = 'Attachment Name';
 $txt['attachment_file_size'] = 'File Size';
 $txt['attachmentdir_size_not_set'] = 'No maximum directory size is currently set';
+$txt['attachmentdir_files_not_set'] = 'No directory file limit is currently set';
 $txt['attachment_delete_admin'] = '[attachment deleted by admin]';
 $txt['live'] = 'Live from Simple Machines...';
 $txt['remove_all'] = 'Clear Log';
@@ -331,7 +335,7 @@ $txt['attachment_manager_thumbs'] = 'Thumbnails';
 $txt['attachment_manager_last_active'] = 'Last Active';
 $txt['attachment_manager_member'] = 'Member';
 $txt['attachment_manager_avatars_older'] = 'Remove avatars from members not active for more than';
-$txt['attachment_manager_total_avatars'] = 'Total Avatars';
+$txt['attachment_manager_total_avatars'] = 'Total avatars';
 
 $txt['attachment_manager_avatars_no_entries'] = 'There are currently no avatars.';
 $txt['attachment_manager_attachments_no_entries'] = 'There are currently no attachments.';
@@ -432,6 +436,25 @@ $txt['basedirectory_for_attachments_current'] = 'Current base directory';
 $txt['basedirectory_for_attachments_warning'] = '<div class="smalltext">Please note that the directory is wrong. <br />(<a href="' . $scripturl . '?action=admin;area=manageattachments;sa=attachpaths">Attempt to correct</a>)</div>';
 $txt['attach_current_dir_warning'] = '<div class="smalltext">There seems to be a problem with this directory. <br />(<a href="' . $scripturl . '?action=admin;area=manageattachments;sa=attachpaths">Attempt to correct</a>)</div>';
 
+$txt['attachment_transfer'] = 'Transfer Attachments';
+$txt['attachment_transfer_desc'] = 'Transfer files betwen directories.';
+$txt['attachment_transfer_select'] = 'Select directory';
+$txt['attachment_transfer_now'] = 'Transfer';
+$txt['attachment_transfer_from'] = 'Transfer files from';
+$txt['attachment_transfer_auto'] = 'Automatically by space or file count';
+$txt['attachment_transfer_auto_select'] = 'Select base directory';
+$txt['attachment_transfer_to'] = 'Or to a specific directory.';
+$txt['attachment_transfer_empty'] = 'Empty the source directory';
+$txt['attachment_transfer_no_base'] = 'No base directories available.';
+$txt['attachment_transfer_forum_root'] = 'Forum root directory.';
+$txt['attachment_transfer_no_room'] = 'Directory size or file count limit reached.';
+$txt['attachment_transfer_no_find'] = 'No files were found to transfer.';
+$txt['attachments_transfered'] = '%1$d files were transfered to %2$s';
+$txt['attachment_not_transfered'] = '%1$d files were not transfered.';
+$txt['attachment_transfer_no_dir'] = 'Either the source directory or one of the target options were not selected.';
+$txt['attachment_transfer_same_dir'] = 'You cannot select the same directory as both the source and target.';
+$txt['attachment_transfer_progress'] = 'Please wait. Transfer in progess.';
+
 $txt['mods_cat_avatars'] = 'Avatars';
 $txt['avatar_directory'] = 'Avatars directory';
 $txt['avatar_url'] = 'Avatars URL';