Resource icon

MetaMirror 1.6.1

No permission to download
The ability to disable on a per user basis would be nice. Some people do not wish to upload their photos for copyright reasons.
 
Getting this error... might want to truncate file names.

Code:
ErrorException: rename(/home/politics/public_html/data/MetaMirrorCache/meta_5200219e656f2,/home/politics/public_html/data/MetaMirrorCache/aph.cdn.photos.upi.com_collection_upi_f09ab8f19e85dffc1f043628b801188c_Pope_Benedict_XVI_celebrates_Christmas_mass_at_St_Peters_Basilica_in_Vatican_City_on_December_24_2011_to_mark_the_nativity_of_Jesus_Christ_Pope_Benedict_XVI_hailed_Christs_humility_urging_the_faithful_to_look_beyond_the_Christmas_glitter_and_enl_13.jpg): File name too long - library/MetaMirror/CronEntry.php:816
Generated By: Unknown Account, A moment ago
 
Blimey. Looks like a 255 byte limit for most file sytems. The original file name Pope-Benedict-XVI-celebrates-Christmas-mass-at-St-Peters-Basilica-in-Vatican-City-on-December-24-2011-to-mark-the-nativity-of-Jesus-Christ-Pope-Benedict-XVI-hailed-Christs-humility-urging-the-faithful-to-look-beyond-the-Christmas-glitter-and-enl.jpg is 249 bytes, and the extra stuff pushes it over. That's an unusually long name. Probably rare.

I'll detect and truncate long names.
 
Turns out XenForo's attachment system won't let you upload over 100 byte filenames as the filename column in xf_attachment_data is varchar(100), so I'm truncating everything down to 100 byte filenames with md5 for uniqueness
 
Mick West updated MetaMirror with a new update entry:

Truncate long filenames

As the Xenforo attachment system cannot handle filenames longer than 100 bytes, all file names are truncated to 100 bytes.

If they were over 100 bytes, the last 32 bytes are replaced by the md5 of entire string, for uniqueness.

If you have been using this previously with attachments, then you should use the testing tool to flush the flags, as many files with long names may not have been rehosted.

Instant rehosting seems to work fine, so you can just let the cron job handle the old files,...

Read the rest of this update entry...
 
Any more thought on making it Resource Manager compatible?

I tried in a post there to see if the instant part worked on save but it doesn't.
 
Any more thought on making it Resource Manager compatible?

I tried in a post there to see if the instant part worked on save but it doesn't.

Not really, I don't use the resource manager, and I don't really want to pay $60 and install it for something I'm not going to use. I'm afraid I wrote this mostly for my own use, and to learn XF.

Could describe more how external files are used in the RM? This post here is under the RM, but looks like a forum post - does it work here, but not in the "Overview" tab? Or are these a different type of post? Or is there something else.
 
Mick,
Many thanks for the recent updates :)

I seem to be getting an error in the Server logs though since yesterday (must have been since 1.4.1)...

ErrorException: Undefined index: scheme - library/MetaMirror/CronEntry.php:41

#0 /community/library/MetaMirror/CronEntry.php(41): XenForo_Application::handlePhpError(' http://ih.cons...')
#1 /community/library/MetaMirror/CronEntry.php(724): loadImage()
#2 /community/library/MetaMirror/CronEntry.php(1047): MetaMirror_CronEntry::updateSingleContent(Array)
#3 /community/library/MetaMirror/CronEntry.php(544): MetaMirror_CronEntry::runForContentType()
#4 /community/library/MetaMirror/ControllerAdmin/MetaMirror.php(80): MetaMirror_CronEntry::runMetaMirror(Array)
#5 /community/library/XenForo/FrontController.php(337): MetaMirror_ControllerAdmin_MetaMirror->actionRun()
#6 /community/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#7 /community/admin.php(13): XenForo_FrontController->run()
#8 {main}

Cheers
Paul
 
I get this on XenForo 1.2 when installing it:

Please enter a valid callback method (MetaMirror_Listeners_DataWriter::LoadClassDataWriter).
 
People post images in resources. Seems to function similar to threads
I get this on XenForo 1.2 when installing it:

Please enter a valid callback method (MetaMirror_Listeners_DataWriter::LoadClassDataWriter).
Did you upload the files to the correct locations?
 
Mick,
Many thanks for the recent updates :)

I seem to be getting an error in the Server logs though since yesterday (must have been since 1.4.1)...

ErrorException: Undefined index: scheme - library/MetaMirror/CronEntry.php:41



Cheers
Paul

looks like it's parsing an image url with no http:// or https:// I can add a patch for that, but I'm a little unsure how you even get such a thing - it would have to parse to a host and a path, but no scheme . And idea what post it might be, and the corrupt image URL? I'd like to test it.
 
looks like it's parsing an image url with no http:// or https:// I can add a patch for that, but I'm a little unsure how you even get such a thing - it would have to parse to a host and a path, but no scheme . And idea what post it might be, and the corrupt image URL? I'd like to test it.

Aha, seems like it's maybe a issue with PHP versions, newer versions parse //example.com/file.jpg into host and path (and no scheme), whereas my older PHP was just giving a path, hence rejecting it as corrupt

The fix is to change line 633 in MetaMirror/CronEntry.php from:
PHP:
            if($do_ignore || !isset($url_info['host']) || !isset($url_info['path']))

to

PHP:
            if($do_ignore || !isset($url_info['host']) || !isset($url_info['path']) || !isset($url_info['scheme']))

I could try prepending a http: but that should be impossible in normal use, and would be a more significant code change. So safer to just do this.
 
looks like it's parsing an image url with no http:// or https:// I can add a patch for that, but I'm a little unsure how you even get such a thing - it would have to parse to a host and a path, but no scheme . And idea what post it might be, and the corrupt image URL? I'd like to test it.

I really don't have a clue exactly what's causing it unfortunately - have done a dry run of 5k posts and nothing obviously comes up as an obvious problem, however I get 8 server errors all the same as above from this one run. Strange as you say.

I'll implement the fix as you have above and see if the issue goes away....

I'm using Php 5.2.6 by the way...

Cheers
Paul
 
Just to follow up, Test run again, no errors reported in the log after the change above.....

Cheers
Paul
 
Just to follow up, Test run again, no errors reported in the log after the change above.....

Cheers
Paul

Cool, although I would only have expected it after 5.4.7, when the bug was fixed. However It was obviously some corrupt URL of some kind. if you are interesting in seeing what it was, you can add a log line in the code block, like:
PHP:
            if($do_ignore || !isset($url_info['host']) || !isset($url_info['path']) || !isset($url_info['scheme']))
            {
                if (!$do_ignore) XenForo_Helper_File::log('MetaMirror','CORRUPT URL: '.$original_url,true);

Then look in /internal_data/MetaMirror.log, at the end
 
I'm still having this problem on Xenforo 1.2
Can you give a bit more info as to your setup? What is your forum path, and what is the value of
$config['externalDataUrl'] =

And what exactly goes wrong (what is the URL, and what should it be?)

Do you have the latest 1.4.2 Metamirror?
 
Back
Top Bottom