vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Attachments as files (https://vborg.vbsupport.ru/showthread.php?t=35193)

Scott MacVicar 02-17-2002 10:00 PM

Well after alot of time leaving it in the beta hacks forums without any problems, I'm now moving it to the Full Releases, I'm satisfied that there isn't any bugs that need to be addressed. Thanks to Jawelin he pointed out most of the mistakes through alot of his testing.
I've attached it as an installer file here, as it needs to make changes to the database. Two new rows to settings and a new column in the attachment table.

Scott

Updated some more :)

Note the > is missing off the bottom of the file after the ?, add it before trying to install

NitroSimSev 02-18-2002 02:27 PM

Parse error: parse error in /www/nitrosim/forum/admin/attachment_install.php on line 345

Scott MacVicar 02-18-2002 02:42 PM

did you upload in ascii mode?

Cause line 345 in the end tag ?>

:)

NitroSimSev 02-18-2002 03:09 PM

Yup......Will re-upload it and try it again.

NitroSimSev 02-18-2002 03:12 PM

Same error....

COMMAND:> STOR attachment_install.php
STATUS:> Connecting data socket...
150 Opening ASCII mode data connection for attachment_install.php.
STATUS:> Send successful
STATUS:> Time: 0:00:01, Efficiency: 20.51 KBytes/s (21005 bytes/s)
226 Transfer complete.

NitroSimSev 02-18-2002 03:12 PM

what is line 345 and I will look at it.

Jawelin 02-18-2002 04:18 PM

:D Thanks for quoting. ;)

Just an 'old user' question: is the attached installer the same than in Beta section (where it's vanished) ?
Thnx

MrLister 02-18-2002 05:21 PM

To fix the problem above try removing any spaces and extra lines after ?>. haven't tried it yet, i'm not at my comp but that might work.

JJR512 02-18-2002 07:50 PM

Question: In the file modifications part of the installation, we are told to search for a particular bit in the file editpost.php. In my editpost.php file, the bit to search for occurs two times. The second is about eight lines below the first. Should I add the new code above BOTH instances, or just the first, or just the second?

JJR512 02-18-2002 08:15 PM

For the record, I put it above the FIRST instance only. I haven't tested that specific functionality yet, though.

Everything else worked fine. I didn't have any problems at all.

And I'm happy to report that in my database, the attachment table was reduced from 61.9MB to 88kB! Woohoo! :up: :)

Wolf42 02-19-2002 10:10 AM

I added (like the instruction told) the line twice ;)

Worked perfectly! Thanks PPN! :D

Scott MacVicar 02-19-2002 11:05 AM

do it twice, its the addition of the function which removes the attachment file.

NitroSimSev 02-19-2002 12:17 PM

Ok the issue was of all things the ? didnt have the > after it. Question regarding the functions.php editing portion. The first step says to "REPLACE from that point to the end of the function with". When I do this step it crashes the functions.php any ideas?

Scott MacVicar 02-19-2002 01:25 PM

define crashes?

you get a parse error?

if you want send me your functions.php to software@pp-network.com and I'll add that of the hack to your file and mail it back.

pdaGuy 02-19-2002 03:31 PM

I tried to test this on my local site, on a Windows PC and I get this error...
Quote:

Fatal error: Call to undefined function: cpheader() in c:\appserv\www\vbulletin\attachment_install.php on line 112
I get the same error on my live site too! Any ideas?

I also want to ask something else.
If everything goes well and I install this hack, will it be possible to upgrade to a new version of vBulletin in the future?
I mean, this hack edits the database! What will happen when vBulletin v3.x comes out??

Scott MacVicar 02-19-2002 03:54 PM

move the file into the admin folder, it needs to check authorisation to make sure your an admin.

Scott MacVicar 02-19-2002 03:56 PM

It will make upgrading to vB3 a problem as your attachments will be files but they will expect it to be in database, but I'll be rewriting the hack for v3 so there won't be a problem about upgrading. You upgrade as normal then apply the new version of the hack to make it work with 3.0

JJR512 02-19-2002 05:36 PM

The instructions do NOT say to add that line twice. I have "Attachments as Files v1.0". In the section for "Changes to
editpost.php (1)", it says,
Quote:

editpost.php

Step 1 of 1 FIND:


$DB_site->query("DELETE FROM attachment WHERE attachmentid=$postinfo[attachmentid]");


ABOVE that add

removeattachment($postinfo[attachmentid]);
And that's it.

OK, so I edited my file to put the new bit in twice, once in each spot.

Now some people have told me that they cannot see some of the attachments. I am not having that problem, even after clearing my browser cache, I can still see all attachments fine. I tried posting a new attachment, and I could also see that fine, too. So far, one other person has said he can also see it, while several people have told me they cannot see it. I don't understand this problem at all. How come some people can see attachments (whether post-hack or pre-hack), while some people cannot see any attachments?

Scott MacVicar 02-19-2002 06:24 PM

have you tried to view the same attachment?

It could be a problem with the type of attachment that it was, though I doubt this as the only part that has been changed is where the content is taken from for the attachment. If the place it takes it from is empty then they would experience a problem. If not does their usergroup have permissions to view attachments?

Sean 02-19-2002 08:33 PM

I posted my problem about not being able to download attachments..(only the admin could). Did you ever get that problem. Or was it fixed? I may just restore a backup, and re-install anyway..

Scott MacVicar 02-19-2002 08:55 PM

There is no code which is changed which would stop people from downloading attachments, did you make sure the usergroup had permission to view attachments?

JJR512 02-19-2002 09:07 PM

Prior to installing this hack, all usergroups were able to download/view attachments. There wasn't a problem before this hack, only after it.

As I mentioned, there is so far only one other person, besides me, that can view attachments. There is another person in the same usergroup as that guy that has said he cannot. I don't think it's a usergroup-based problem.

I can view all the attachments that other people are not able to.

Sean 02-19-2002 09:16 PM

Same thing here.

I have checked and rechecked the user groups. tried numerous things. I am going to revert to an old attachments database, and reload all changed databases and re-install. I'll let you know what happens.

JJR512 02-19-2002 09:26 PM

Update: As an unlogged-in visitor, I cannot view attachments.

JJR512 02-20-2002 12:04 AM

You can see my attachment test thread, and the replies from all the people that can't see it and the two people (now two instead of one, besides me) that can see it: http://forums.jjr512.com/showthread....threadid=29545

Sean 02-20-2002 02:24 AM

FYI: Doesn't work for me either.. :D Really weird if ya ask me.. hmmm

Aaow AnD wHiTe 02-20-2002 11:17 AM

Thanx PPN :)

We would like to know if it would be possible to make something like an... attachments backup hack.

With this hack, you could save all your attachments as binaries without removing them from the database. It would be really usefull for us ^^

Thanx again ^^

Sean 02-20-2002 12:07 PM

I'm re-installing now. Last time (and this time), I found this:


VISABLE was not included in the string you wanted us to find.
Code:

if (!$attachmentinfo=$DB_site->query_first("SELECT filename,filedata,dateline,visible
                                                        FROM attachment
                                                        WHERE attachmentid='$attachmentid'")){

Instead of:

Code:

if (!$attachmentinfo=$DB_site->query_first("SELECT filename,filedata,dateline FROM attachment WHERE attachmentid='$attachmentid'")){
Do I replace what I found? Because when I look for the above line, it is not found..

Scott MacVicar 02-20-2002 03:31 PM

Sean, this is for vB 2.2.2, the visible part was added as it was missing in 2.2.1

I'll do some testing then, I'll do some testin on my own boards where I implemented this hack.
I know for a fact that the attachments are there as I can view them via shell and ftp. So there must be an error in the top 30 lines or so.

Is everyone running 2.2.2?

Scott MacVicar 02-20-2002 03:41 PM

Ok, I've worked out the problem now :)

sorry about all the problems.

Look for

PHP Code:

if (!$attachmentinfo=$DB_site->query_first("SELECT filename,hash,dateline,visible FROM attachment WHERE attachmentid='$attachmentid'")){ 

Please ensure that visible is there in that list, this is super super important as if it isn't then only moderators and admins will be able to view it as they have permission to moderate attachments.

NitroSimSev 02-20-2002 03:43 PM

Im running 2.2.2 but have not tried it since you sent me the functions.php

Sean 02-20-2002 06:39 PM

Well, we have found the problem. Thanks PPN! This hack rocks! :D

Scott MacVicar 02-20-2002 07:38 PM

i'll just apologise some more, it was an oversight as I done this hack on 2.2.1 but the visible thing was a bug and was fixed in 2.2.2 and when i upgraded from 2.2.1 to 2.2.2 i just added visible on the end of the list and added that code so thats how I never noticed it.

Anyway i'll look into making an attachment backer upper. The simpliest way I guess would be to simply zip them all and I have some code to do that but you would need to have zlib installed so I can use the gzip functions.

JJR512 02-20-2002 08:57 PM

Yep, it seems to be working fine now. :up:

Scott MacVicar 02-20-2002 09:22 PM

goood :D

it is a stable release then lol

Attachment backer upper was scary though, the zip was quite hefty. I've added an option to either save it or download it.

JJR512 02-21-2002 01:08 AM

Prior to installing this hack, using phpMyAdmin, I had it do a dump of just the attachments table, doing structure and data. It's past the point where it matters now, but that was good enough for a backup, right? Or does your backup addition do something else...

Scott MacVicar 02-21-2002 06:21 AM

Yeah thats a backup, all the data and the structure.
You'll need to do it with this along with the files, though the attachment table should only be a couple of kb instead of mb.

Jawelin 02-21-2002 07:41 AM

Quote:

Originally posted by JJR512
Prior to installing this hack, using phpMyAdmin, I had it do a dump of just the attachments table, doing structure and data. It's past the point where it matters now, but that was good enough for a backup, right? Or does your backup addition do something else...
I dumped only the attachment table just before applying the hack, using mysqldump for instance.
After the export to files, as you'll see, that table will remain the same as before.
After having successfully applied and verified all the hack, you can empty the filedata column of that table with a simple UPDATE by phpMyAdmin, then reOPTIMIZE the table and freeup a lot lot of space... :up:
Bye

Scott MacVicar 02-21-2002 03:06 PM

I'm glad this is workin now and thanks for all your help Jawelin :)

Jawelin 02-21-2002 03:48 PM

Do you thank me ? :)
Great work, simply!

P.S.: now you have to modify your sig.... ;)


All times are GMT. The time now is 04:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01630 seconds
  • Memory Usage 1,819KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete