Resource icon

xF1 Add-on MetaMirror 1.6.1

No permission to download
Compatible XF Versions
  1. 1.2
  2. 1.3
  3. 1.4
  4. 1.5
This is currently a ONE-WAY conversion of image links from external to local, there is no undo. Make sure you understand this before you install this add-on

The ability for users to externally link images is very useful, but can lead to problems down the road if the image that they link to is deleted from the server, or if it's moved, or if the server goes offline, or if the linked image has limited bandwidth.

MetaMirror ensures this never happens by automatically finding external links, downloading the file to your local server, and altering the link to point to the local version.

For example:
upload.wikimedia.org_wikipedia_commons_6_63_Wikipedia_logo.png


is rehosted locally, the post modified as:
metabunk.org_data_MetaMirrorCache_upload.wikimedia.org_wikipedia_commons_6_63_Wikipedia_logo.png


Or (optionally) as an attachment.

View attachment 1234

This ensures the image lasts as long as your forum does. It can also speed things up, depending on your server configuration.

Install in the usual way. Caching is initially disabled to let you to test it and set ignore strings. Cron job is initially set to run every five minutes. You can change how many posts are processed per run.

A problems had been reported with using an SSL proxies like go-camo (which is used to suppresses mixed-content warnings), so I'd suggest removing that before running. Once all images are local, you will not need it anyway.

Detailed Installation Instructions:

Step 1: Upload and Install

Upload the contents of the the upload folder to your Xenforo installation location. So you should have library/Metamirror/...

Install the add-on via the addon-MetaMirror.xml file.

Step 2. Configuration

Go to Options -> MetaMirror Image Rehosting
Do not enable it yet

Add any ignore strings. This would be any different host you use for images, or a CDN, or just a site or dynamic image url you want to ignore.

Add Exclude forums - if you don't want a forum to be scanned, then add the forum ids here.
Do not enable it yet
Step 3: Testing


Go to Tools -> MetaMirror Tester (in the left sidebar menu)

[NOTE: The following is for linked images re-hosted as files. If you use the attachments system, then the "Rehosted URL" will point to a temporary file, and then to the attachment after you commit the changes]

Verify that the data rehosting path and the file reference path are correct.

Leave the "Commit Changes" and "Save Files" options unchecked, and click on "Proceed" to run a non-destructive test.

Assuming you have some images to rehost, you will get something like:

xenforo_com_community_attachments_simulated_test_only_admin_cp_metabunk_1_jpg_52508__.jpg

Verify this seems correct. Then Click on "Save Files", and re-run, you should get:

xenforo_com_community_attachments_simulated_test_only_admin_cp_metabunk_2_jpg_52509__.jpg

Notice the Rehosted URLs are now active links. Click on the link to make sure the image has been rehosted correctly, and is web accessible at that URL.

Then click on "Commit Changes" and Proceed, you should get:

xenforo_com_community_attachments_committing_changes_admin_cp_metabunk_jpg_52510__.jpg

The bytes downloaded are listed as zero, as you have already downloaded the file. Now just verify the that post has been modified (go to http://example.com/posts/[post number]

Check the image displays, and that it's actually using the local URL.

You should then try a few more times, look at the URLS, and ensure things are working.

If you want, you can temporarily increase the number of IMG posts scanned per run with "Override per-run", so you can see what a reasonable maximum is for your server. Or if you just want to convert a bunch of links manually.

If all seems well you, can enable MetaMIrror in the options, like this:
xenforo_com_community_attachments_upload_2013_9_6_16_47_46_png_56105__.png


Troubleshooting:

The most likely thing that can go wrong is the URL of the rehosted files will be incorrect. There are two things that might be going on here:

1) Check Options -> Basic Board Information -> Board URL
This should point to the urls of the folder that your data directory is in.

2) Check library/config.php
You might have something like:
$config['externalDataUrl'] = 'http://example.com/data';
That should work, but also might be corrupt.

If the Board URL seems correct, but your data is in a different place, then you could try manually overriding it in $config['externalDataUrl']

If things get REALLY messed up (unlikely, but if you rush in....), then you might be able to write a tool to revert things using internal_data/MetaMirror.log, which contains the post number, the original link and the modified link. A future release may include this "undo" functionality.

Please let me know if you have problems.

Author
AnimeHaxor
Size
25.9 KB
Extension
zip
Downloads
12
Views
1,462
First release
Last update

More resources from AnimeHaxor

729Threads
2,274Messages
61,639Members
lawandlraoufLatest member
Back