Static Website Hosting
You can host your static website entirely on Amazon S3. Once you enable your bucket for static website hosting, all your content is accessible to web browsers via the Amazon S3 website endpoint for your bucket.
Endpoint: data.yplaza.net.s3-website-eu-west-1.amazonaws.com
Each bucket serves a website namespace (e.g. "www.example.com"). Requests for your host name (e.g. "example.com" or "www.example.com") can be routed to the contents in your bucket. You can also redirect requests to another host name (e.g. redirect "example.com" to "www.example.com"). See ourwalkthrough for how to set up an Amazon S3 static website with your host name.
$config['bdDataStorage'] = array(
array(
'type' => 's3',
'key' => '<paste your key here>',
'secret' => '<paste your secret here>',
'bucket' => '<enter bucket name here>',
// 'region' => 'us-east-1',
// 'url' => '',
// 'acl' => 'public',
),
);
Make sure you move the files back to its location too.Hi @xfrocks
After uninstalling this add-on, do I have to anything else rather than deleting code below from config.php?
PHP:$config['bdDataStorage'] = array( array( 'type' => 's3', 'key' => '<paste your key here>', 'secret' => '<paste your secret here>', 'bucket' => '<enter bucket name here>', // 'region' => 'us-east-1', // 'url' => '', // 'acl' => 'public', ), );
Which files are you referring to?Make sure you move the files back to its location too.
When you use the add-on, all files in /data is moved to somewhere else via FTP or Amazon S3. You need to move them back to /data on your server for them to function normally.Which files are you referring to?
Got it! Thanks a lot xfrocks!When you use the add-on, all files in /data is moved to somewhere else via FTP or Amazon S3. You need to move them back to /data on your server for them to function normally.
v1.4 compatible?
Yes, it works with 1.4.4.Is this plugin compatible with xenforo version 1.4.3?
I have replied to that post. Have you checked your config.php?
You are replying to the wrong add-on thread I think. Please confirm whether you have this add-on or [bd] Attachment Store add-on.I'm trying to move our attachments off S3 and back to the local data folder. I left the Attachment options alone so they point to s3 bucket. I ran the "Update Attachments Data Storage Options" in the rebuild cache. I selected Default as the mode. Does this option copy the files back to the data folder? Did I use the wrong mode? XenForo is looking for the attachment(s) in the local data folder but nothing was copied. Is it still a manual process? Any help would be appreciated.
if (!function_exists('ftp_connect')) {
throw new XenForo_Exception('Data Storage: FTP support for PHP cannot be found.');
}
try {
@unlink($file);
} catch (ErrorException $e) { }
/**
* Delete a local file if it still exists, ignoring typical errors. Only works on local files.
*
* @see unlink() Wrapped by this method.
*
* @param string $filename
* @param resource $context
* @return bool Indicates success.
*/
protected static function _unlinkLocal($filename, $context = null)
{
try {
if (isset($context)) {
return @unlink($filename, $context);
}
if (!file_exists($filename)) {
return false;
}
// In case opcache.enable_file_override is enabled; has to run while the file still exists
function_exists('opcache_invalidate') and opcache_invalidate($filename);
return @unlink($filename);
} catch (ErrorException $e) {
// HHVM ignores @ prefix and throws ErrorException instead
return false;
}
}
Nice find. I will see what I can do.The S3 stream wrapper currently checks for the availability of ftp_connect:
Code:if (!function_exists('ftp_connect')) { throw new XenForo_Exception('Data Storage: FTP support for PHP cannot be found.'); }
This doesn't really make sense, and was probably a copy-paste error. It causes problems on HHVM, as HHVM currently lacks ftp_connect.
Additionally, I noticed that the @ prefix is used in several places to ignore errors. Reliance on error suppression is discouraged, and some modern engines, like HHVM, ignore it altogether. Until XenForo handles errors in a modern way by throwing ErrorExceptions, you can account for both old and new engines:
Code:try { @unlink($file); } catch (ErrorException $e) { }
Here's a fancier solution that also handles Zend OPcache, which is more common than HHVM:
Code:/** * Delete a local file if it still exists, ignoring typical errors. Only works on local files. * * @see unlink() Wrapped by this method. * * @param string $filename * @param resource $context * @return bool Indicates success. */ protected static function _unlinkLocal($filename, $context = null) { try { if (isset($context)) { return @unlink($filename, $context); } if (!file_exists($filename)) { return false; } // In case opcache.enable_file_override is enabled; has to run while the file still exists function_exists('opcache_invalidate') and opcache_invalidate($filename); return @unlink($filename); } catch (ErrorException $e) { // HHVM ignores @ prefix and throws ErrorException instead return false; } }
We use essential cookies to make this site work, and optional cookies to enhance your experience.