Skip to content

Commit

Permalink
Everywhere should now be calling this with a hash, so we can get rid …
Browse files Browse the repository at this point in the history
…of this query. If $file_hash is empty, it is because it isn't set in the database.

Signed-off-by:Joshua Dickerson <joshua.a.dickerson@gmail.com>
  • Loading branch information
joshuaadickerson authored and norv committed May 14, 2013
1 parent f909d8d commit 93883f9
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions sources/Subs.php
Expand Up @@ -3311,25 +3311,6 @@ function getAttachmentFilename($file_hash, $attachment_id, $filename, $id_folder
{
global $modSettings, $smcFunc;

// Grab the file hash if it wasn't added.
// @todo: Locate all places that don't call a hash and fix that.
if ($file_hash === '')
{
$request = $smcFunc['db_query']('', '
SELECT file_hash
FROM {db_prefix}attachments
WHERE id_attach = {int:id_attach}',
array(
'id_attach' => (int) $attachment_id,
));

if ($smcFunc['db_num_rows']($request) === 0)
return false;

list ($file_hash) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
}

// In case of files from the old system, do a legacy call.
if (empty($file_hash))
{
Expand Down

0 comments on commit 93883f9

Please sign in to comment.