New settings for XMB 1.9.11

From XMBdocs
Revision as of 13:40, 8 September 2020 by Miqrogroove (talk | contribs)

This is a detailed explanation of the differences of the Settings menu that changed between XMB 1.9.10 and XMB 1.9.11.

Board URL

The Board URL setting was removed in XMB 1.9.11.

This feature is no longer needed. If you relocate your board, then you must remember to change the $full_url setting in the config.php file. This change was made to help remind webmasters that they will be unable to login (and unable to access the Admin Panel) if the $full_url setting is not configured correctly.

Attach Remote Images

If enabled, XMB will retrieve all new images linked inside [img] tags and convert them into normal file attachments. This means all [img] links will benefit from having thumbnails, local copies, and size restrictions. If XMB fails to retrieve the linked file when this option is set to On, then the [img] tag will be changed to [bad img] and will not be parsed by BBCode. If your server blocks remote file retrieval for any reason, you may need to disable this option to make the [img] bbcode work again.

Attachment Minimum Storage Size

This setting applies only if you configure the Attachment Storage Path (see below). Modern computers usually store flat files in chunks of 4 kB or larger, meaning there is an average of 2 kB disk space wasted for every file. This is perfectly fine if your users upload relatively large files. On the other hand, if your board members commonly attach small documents or snippets of code to their posts, then disk storage could be considerably less efficient than database storage.

The default value of 9216 bytes, or 9 kB, is appropriate in most cases. Consider increasing this number if your server is known to be using a larger block size or cluster size in its file system.

Attachment Storage Path

Enables XMB to use your hard disk for direct file storage of attachments. This can be very advantageous because it will decrease the database size and traffic. Your hard disk is also much more efficient than the database when it comes to deleting files.

This field must be either blank, or contain the path to an existing directory on the hard disk. A relative path from the XMB root directory is okay, but a full path is preferred and likely to work better. XMB is designed so that you can move the directory and change this path setting at any time without changing any web links.

Attachment Subdirectory Scheme

XMB uses a set of nested subdirectories to sort the attachments saved to disk. This is necessary because many host masters impose a limit on the number of files allowed in any single directory. This directory scheme is date-based, using the file's upload date to decide which folder to store the file in.

By default, the scheme is ~Year/Month. For example, a file uploaded 5 January 2008 would be saved in the /2008/01/ subdirectory beneath your Attachment Storage Path (see above).

In case your board is extremely active with uploads, XMB also offers the ~Year/Month/Day scheme. This scheme should be used if your members upload more than around 1000 files per month.

XMB is designed so that you can change this scheme setting at any time without moving any files. Changes to this setting are automatically applied to new attachments only.

Attachment URL Format

This new option should be changed by advanced webmasters only. The default option now is to format all of your board's attachment links like "{$full_url}files.php?pid=$pid&aid=$aid". If you have inbound links to the old format that included viewthread.php, it is okay because we edited viewthread.php to issue the 301 Moved Permanently code. This 301 response will forward all browsers to the new address, and also inform search engines to replace the old address with the new one.

There are two URL Format options that require you to enable Apache ~MultiViews on your server. They look like "{$full_url}files/$pid/$aid/" and "{$full_url}files/$aid/$filename". These are considered "Pretty" URLs because they use more intuitive syntax. Remember, you must configure your web server separately from XMB to make this work.

There are two more URL Format options, and they require you to use Apache mod_rewrite on your server. They look like "{$full_url}$pid/$aid/" and "{$full_url}$aid/$filename". These formats are considered desireable because they are totally independent of the directory structure on the server. In other words, you can even host your attachments on another domain so long as the server's URL rewriting rules point internally to the XMB files.php script. The simplest way to configure mod_rewrite is usually to add a file named .htaccess to the XMB directory.

An extremely simple configuration for the latter mod_rewrite format might look like this:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule [\d]+/[^/]+$ /xmb/files.php [L]

URL rules can become complicated and they are very sensitive to syntax mistakes. This is not for the beginner to experiment with!

The primary benefit, and our motivation, for using a different filename is that you can move the script. If you want to use the 'www' subdomain to host your board, and the 'upload' subdomain specifically to host user-contributed files, you can typically accomplish this by moving the files.php script out of the XMB directory and into the directory that stores the files for the other domain. (Technically you could leave the file where it is, but good luck trying to get your server to rewrite URLs internally across domains. Also note these two directories may be independent of where the attachments are actually stored, which could be in a third directory.)

Our final tip for URL rewriting is to watch out for the file paths being used by XMB script includes. You will need to make the top of files.php look something like this to avoid those include errors:

define('X_SCRIPT', 'files.php');
define('ROOT', '/root/user/public_html/www/xmb/');
require ROOT.'header.php';

As you can see, XMB often uses this variable called ROOT, and it will need to be redefined if you move the files.php script.

Attachment Virtual URL

This is the option that ties your attachments to another path or domain if you relocate the files.php script. Think of this as a $full_url but for attachments. XMB will use this as the base address for all attachment links.

Maximum Files Per Post

XMB 1.9.11 enables multiple attachments per post. This option gives you a way to limit how many attachments can be added to each new post. We recommend a setting of between 1 and 20.

Maximum Image Size

This specifies the largest dimensions allowed when attaching an image to a post. It is a good idea not to set this above 5 Megapixels because larger uploads will consume an enormous amount of memory just to create thumbnails. We recommend using between 1000 and 2000 for both width and height settings. Newer versions of PHP tend to use higher memory limits by default, so settings of 3000 or higher may be possible. A reasonable setting for your server will depend on how often images are uploaded.

Maximum Thumbnail Size

XMB 1.9.11 will automatically generate thumbnails for all new image attachments that are larger than this size. For example, if you use the default Thumbnail Size of 200x200 and then someone uploads an image that is 400x100, then a thumbnail will be created that is 200x50 and linked to the original file for downloading. We recommend a setting for both width and height of between 100 and 500.