function s3fs_actions in S3 File System 7.3
Same name and namespace in other branches
- 7 s3fs.admin.inc \s3fs_actions()
- 7.2 s3fs.admin.inc \s3fs_actions()
Builds the Actions form.
1 string reference to 's3fs_actions'
- s3fs_menu in ./
s3fs.module - Implements hook_menu().
File
- ./
s3fs.admin.inc, line 457 - Administration form setup for S3 File System.
Code
function s3fs_actions() {
$form = array();
// Drupal's menu system doesn't let you set the page title for tabs.
// So we set it here.
drupal_set_title('S3 File System Actions');
$form['s3fs_refresh_cache'] = array(
'#type' => 'fieldset',
'#description' => t("The file metadata cache keeps track of every file that S3 File System writes to (and deletes from) the S3 bucket,\n so that queries for data about those files (checks for existence, filetype, etc.) don't have to hit S3.\n This speeds up many operations, most noticeably anything related to images and their derivatives."),
'#title' => t('File Metadata Cache'),
);
$refresh_description = t("This button queries S3 for the metadata of <i><b>all</b></i> the files in your site's bucket (unless you use the\n Root Folder option), and saves it to the database. This may take a while for buckets with many thousands of files. <br>\n It should only be necessary to use this button if you've just installed S3 File System and you need to cache all the\n pre-existing files in your bucket, or if you need to restore your metadata cache from scratch for some other reason.");
$form['s3fs_refresh_cache']['refresh'] = array(
'#type' => 'submit',
'#suffix' => '<div class="refresh">' . $refresh_description . '</div>',
'#value' => t('Refresh file metadata cache'),
'#attached' => array(
'css' => array(
// Push the button closer to its own description, and push the disable
// checkbox away from the description.
'#edit-refresh {margin-bottom: 0; margin-top: 1em;} div.refresh {margin-bottom: 1em;}' => array(
'type' => 'inline',
),
),
),
'#submit' => array(
'_s3fs_refresh_cache_submit',
),
);
$config = _s3fs_get_config();
$use_public = !empty($config['use_s3_for_public']);
$use_private = !empty($config['use_s3_for_private']);
if ($use_public || $use_private) {
$form['s3fs_copy_local'] = array(
'#type' => 'fieldset',
'#description' => t("Since you have S3 File System configured to take over for the public and/or private file systems, you\n may wish to copy any files which were previously uploaded to your site into your S3 bucket. <br>\n If you have a lot of files, or very large files, you'll want to use <i>drush s3fs-copy-local</i>\n instead of this form, as the limitations imposed by browsers may break very long copy operations."),
'#title' => t('Copy Local Files to S3'),
);
if ($use_public) {
$form['s3fs_copy_local']['public'] = array(
'#type' => 'submit',
'#prefix' => '<br>',
'#name' => 'public',
'#value' => t('Copy local public files to S3'),
'#submit' => array(
'_s3fs_copy_local_submit',
),
);
}
if ($use_private) {
$form['s3fs_copy_local']['private'] = array(
'#type' => 'submit',
'#prefix' => '<br>',
'#name' => 'private',
'#value' => t('Copy local private files to S3'),
'#submit' => array(
'_s3fs_copy_local_submit',
),
);
}
}
$no_rewrite = !empty($config['no_rewrite_cssjs']);
if ($no_rewrite) {
$form['s3fs_copy_system'] = array(
'#type' => 'fieldset',
'#description' => t("Since you have S3 File System configured to not render proxied CSS/JS file paths, you\n may want to copy system images to S3. These are images included with your site's modules, themes,\n and libraries.<br>If you are using CSS aggregation either through Drupal's default settings or\n a separate module such as AdvAgg, the aggregated files most likely will include <em>url</em>\n definitions that point to your site's file system, not S3.<br>This feature will copy system images\n to S3 with the correct directory structure. <strong>Please note, if new modules, themes, or\n libraries are added to your site, this option will need to be run again to update S3.</strong>"),
'#title' => t('Copy System Images to S3'),
);
$form['s3fs_copy_system']['system'] = array(
'#type' => 'submit',
'#prefix' => '<br>',
'#value' => t('Copy system images to S3'),
'#submit' => array(
'_s3fs_copy_system_images_submit',
),
);
}
return $form;
}