phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Can't access shadow attachments


 
Search this topic... | Search General Support... | Search Box
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Author Message
RefugeeBob
Board Member



Joined: 13 Mar 2011

Posts: 31



PostPosted: Thu Aug 08, 2013 5:52 pm 
Post subject: Can't access shadow attachments

I get a blank page when I attempt to access shadow attachments. Might that mean there aren't any, or should I see a message saying there aren't any if that's the case? It's probably been 2 or 3 years since I've tried to look at shadow attachments, but I found a lot of them when I did.

I can access all attachments easily through the attachment Control Panel.

Thanks.
Back to top
StarWolf3000
Board Member



Joined: 10 Jun 2010

Posts: 175
Location: Germany


flag
PostPosted: Sat Aug 10, 2013 2:18 am 
Post subject: Re: Can't access shadow attachments

Please describe "shadow attachments" more precisely. I just know what shadow topics are (just a link to the topic in the new forum) and what orphaned topics/posts/attachments are (they belong to deleted forums/topics/posts).
Back to top
RefugeeBob
Board Member



Joined: 13 Mar 2011

Posts: 31



PostPosted: Sat Aug 10, 2013 2:26 am 
Post subject: Re: Can't access shadow attachments

StarWolf3000 wrote:
Please describe "shadow attachments" more precisely. I just know what shadow topics are (just a link to the topic in the new forum) and what orphaned topics/posts/attachments are (they belong to deleted forums/topics/posts).


It's an admin part of the attachment mod. See below.

Shadow attachments are attachments that are not associated with any particular post. I'm not sure how that happens, but it does. There can be many of them.



shadow.jpg
 Description:
As seen in the ACP
 Filesize:  43.15 KB
 Viewed:  1311 Time(s)

shadow.jpg


Back to top
StarWolf3000
Board Member



Joined: 10 Jun 2010

Posts: 175
Location: Germany


flag
PostPosted: Sat Aug 10, 2013 2:36 am 
Post subject: Re: Can't access shadow attachments

So if you click on the link in the ACP you just get a blank page. Maybe there is a configuration problem with PHP and you don't get a possible error message. Do you have access to the log files of Apache (here especially to the error.log)?

The following code snippet is from /admin/admin_attachments.php and is responsible for the action for shadow mode:
Code:
if ($mode == 'shadow')
{
   @set_time_limit(0);
   
   // Shadow Attachments
   $template->set_filenames(array(
      'body' => 'admin/attach_shadow.tpl')
   );

   $shadow_attachments = array();
   $shadow_row = array();

   $template->assign_vars(array(
      'L_SHADOW_TITLE'   => $lang['Shadow_attachments'],
      'L_SHADOW_EXPLAIN'   => $lang['Shadow_attachments_explain'],
      'L_EXPLAIN_FILE'   => $lang['Shadow_attachments_file_explain'],
      'L_EXPLAIN_ROW'      => $lang['Shadow_attachments_row_explain'],
      'L_ATTACHMENT'      => $lang['Attachment'],
      'L_COMMENT'         => $lang['File_comment'],
      'L_DELETE'         => $lang['Delete'],
      'L_DELETE_MARKED'   => $lang['Delete_marked'],
      'L_MARK_ALL'      => $lang['Mark_all'],
      'L_UNMARK_ALL'      => $lang['Unmark_all'],
      
      'S_HIDDEN'         => $hidden,
      'S_ATTACH_ACTION'   => append_sid('admin_attachments.' . $phpEx . '?mode=shadow'))
   );

   $table_attachments = array();
   $assign_attachments = array();
   $file_attachments = array();

   // collect all attachments in attach-table
   $sql = 'SELECT attach_id, physical_filename, comment
      FROM ' . ATTACHMENTS_DESC_TABLE . '
      ORDER BY attach_id';

   if (!($result = $db->sql_query($sql)))
   {
      message_die(GENERAL_ERROR, 'Could not get attachment informations', '', __LINE__, __FILE__, $sql);
   }

   $i = 0;
   while ($row = $db->sql_fetchrow($result))
   {
      $table_attachments['attach_id'][$i] = (int) $row['attach_id'];
      $table_attachments['physical_filename'][$i] = basename($row['physical_filename']);
      $table_attachments['comment'][$i] = $row['comment'];
      $i++;
   }
   $db->sql_freeresult($result);

   $sql = 'SELECT attach_id
      FROM ' . ATTACHMENTS_TABLE . '
      GROUP BY attach_id';

   if (!($result = $db->sql_query($sql)))
   {
      message_die(GENERAL_ERROR, 'Could not get attachment informations', '', __LINE__, __FILE__, $sql);
   }

   while ($row = $db->sql_fetchrow($result))
   {
      $assign_attachments[] = intval($row['attach_id']);
   }
   $db->sql_freeresult($result);

   // collect all attachments on file-system
   $file_attachments = collect_attachments();

   $shadow_attachments = array();
   $shadow_row = array();   

   // Now determine the needed Informations
   
   // Go through all Files on the filespace and see if all are stored within the DB
   for ($i = 0; $i < sizeof($file_attachments); $i++)
   {
      if (sizeof($table_attachments['attach_id']) > 0)
      {
         if ($file_attachments[$i] != '')
         {
            if (!in_array(trim($file_attachments[$i]), $table_attachments['physical_filename']) )
            {   
               $shadow_attachments[] = trim($file_attachments[$i]);
               // Delete this file from the file_attachments to not have double assignments in next steps
               $file_attachments[$i] = '';
            }
         }
      }
      else
      {
         if ($file_attachments[$i] != '')
         {
            $shadow_attachments[] = trim($file_attachments[$i]);
            // Delete this file from the file_attachments to not have double assignments in next steps
            $file_attachments[$i] = '';
         }
      }
   }

   // Now look for Attachment ID's defined for posts or topics but not defined at the Attachments Description Table
   for ($i = 0; $i < sizeof($assign_attachments); $i++)
   {
      if (!in_array($assign_attachments[$i], $table_attachments['attach_id']))
      {
         $shadow_row['attach_id'][] = $assign_attachments[$i];
         $shadow_row['physical_filename'][] = $assign_attachments[$i];
         $shadow_row['comment'][] = $lang['Empty_file_entry'];
      }
   }
   
   // Go through the Database and get those Files not stored at the Filespace
   for ($i = 0; $i < sizeof($table_attachments['attach_id']); $i++)
   {
      if ($table_attachments['physical_filename'][$i] != '')
      {
         if ( !in_array(trim($table_attachments['physical_filename'][$i]), $file_attachments))
         {   
            $shadow_row['attach_id'][] = $table_attachments['attach_id'][$i];
            $shadow_row['physical_filename'][] = trim($table_attachments['physical_filename'][$i]);
            $shadow_row['comment'][] = $table_attachments['comment'][$i];

            // Delete this entry from the table_attachments, to not interfere with the next step
            $table_attachments['attach_id'][$i] = 0;
            $table_attachments['physical_filename'][$i] = '';
            $table_attachments['comment'][$i] = '';
         }
      }
   }

   // Now look at the missing posts and PM's
   for ($i = 0; $i < sizeof($table_attachments['attach_id']); $i++)
   {
      if ($table_attachments['attach_id'][$i])
      {
         if (!entry_exists($table_attachments['attach_id'][$i]))
         {
            $shadow_row['attach_id'][] = $table_attachments['attach_id'][$i];
            $shadow_row['physical_filename'][] = trim($table_attachments['physical_filename'][$i]);
            $shadow_row['comment'][] = $table_attachments['comment'][$i];
         }
      }
   }

   for ($i = 0; $i < sizeof($shadow_attachments); $i++)
   {
      $template->assign_block_vars('file_shadow_row', array(
         'ATTACH_ID'         => $shadow_attachments[$i],
         'ATTACH_FILENAME'   => $shadow_attachments[$i],
         'ATTACH_COMMENT'   => $lang['No_file_comment_available'],
         'U_ATTACHMENT'      => $upload_dir . '/' . basename($shadow_attachments[$i]))
      );
   }

   for ($i = 0; $i < sizeof($shadow_row['attach_id']); $i++)
   {
      $template->assign_block_vars('table_shadow_row', array(
         'ATTACH_ID'         => $shadow_row['attach_id'][$i],
         'ATTACH_FILENAME'   => basename($shadow_row['physical_filename'][$i]),
         'ATTACH_COMMENT'   => (trim($shadow_row['comment'][$i]) == '') ? $lang['No_file_comment_available'] : trim($shadow_row['comment'][$i]))
      );
   }
}
Back to top
Jim_UK
Board Member



Joined: 19 Nov 2008

Posts: 656
Location: North West UK


flag
PostPosted: Sat Aug 10, 2013 1:57 pm 
Post subject: Re: Can't access shadow attachments

I believe the shadow attachments are attachments that were part of a post but that the post had subsequently been removed leaving the attachment in the "files" folder taking up disc space when it would never be called again.
I left mine for so long without removing them that my machine just hangs if I now try to do so.

Jim
Back to top
RefugeeBob
Board Member



Joined: 13 Mar 2011

Posts: 31



PostPosted: Sat Aug 10, 2013 2:10 pm 
Post subject: Re: Can't access shadow attachments

Jim_UK wrote:
I believe the shadow attachments are attachments that were part of a post but that the post had subsequently been removed leaving the attachment in the "files" folder taking up disc space when it would never be called again.
I left mine for so long without removing them that my machine just hangs if I now try to do so.

Jim


That's what I think is happening with mine. I'm trying to clear some disc space, but it just hangs.

I searched the error logs but didn't find any references to "shadow".
Back to top
Display posts from previous:   
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 4 Hours
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0605 seconds using 18 queries. (SQL 0.0099 Parse 0.0105 Other 0.0400)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo