Preventing Drupal Headaches: Establishing Flexible File Paths From The Start

  • Published on
    17-Oct-2014

  • View
    4.700

  • Download
    0

Embed Size (px)

DESCRIPTION

 

Transcript

<p>FLEXIBLE FILE PATHS FROM THE START</p> <p>Prevent Drupal Headaches</p> <p>Wednesday, January 15, 14</p> <p>training.acquia.com/events</p> <p>Wednesday, January 15, 14</p> <p>Who is this for? New to Drupal? Starting a new Drupal </p> <p>site! Inherited a new </p> <p>Drupal site and want to know more about configuration</p> <p>Wednesday, January 15, 14</p> <p>In this demo How file path patterns </p> <p>affect maintenance and migrations</p> <p> File upload management </p> <p> Future friendly path patterns</p> <p>Wednesday, January 15, 14</p> <p>Source of the pain? Drupal default file </p> <p>field upload pops ALL files into the same directory</p> <p> Often overlooked by developers</p> <p> Significant performance impact</p> <p> Easy to prevent! ...not easy to fix!</p> <p>Wednesday, January 15, 14</p> <p>Wednesday, January 15, 14</p> <p>https://drupal.org/node/2128055</p> <p>A future fix</p> <p>Wednesday, January 15, 14</p> <p>Not in this demo Check out these blog posts Adding images to your site Inline images in Drupal 7 Responsive or Adaptive images in Drupal 7 Inline and responsive images in Drupal 8</p> <p>Wednesday, January 15, 14</p> <p>A clean room Protips! Many potential conflicts with other modules </p> <p>that control file system. Use clean testing sites.</p> <p> See Create a Test Site | Drupal.org</p> <p>Wednesday, January 15, 14</p> <p>Out of the box file handling</p> <p>Getting to grip with the basics</p> <p>Wednesday, January 15, 14</p> <p>Basic settings Global settings Display options Upload destination</p> <p> Per content type settings Required? Help text Allowed extensions File directory Upload size Description field Progress indicator Number of values</p> <p>Wednesday, January 15, 14</p> <p>Limiting file types Security tip: Err on the side of less file </p> <p>extensions available to the least amount of users</p> <p>Wednesday, January 15, 14</p> <p>Description field setting</p> <p>Wednesday, January 15, 14</p> <p>The description</p> <p>Wednesday, January 15, 14</p> <p>CompareWithout description With description</p> <p>Wednesday, January 15, 14</p> <p>The display optionDisplay enabled Display disabled</p> <p>Wednesday, January 15, 14</p> <p>Manage field display</p> <p>Wednesday, January 15, 14</p> <p>Field report!</p> <p>Wednesday, January 15, 14</p> <p>Transliteration You NEED transliteration. Install it. Configuration &gt; Media &gt; File system</p> <p>Wednesday, January 15, 14</p> <p>Transliteration Configuration &gt; Search and metadata &gt; URL </p> <p>aliases &gt; URL aliases</p> <p>Wednesday, January 15, 14</p> <p>Fix existing file names</p> <p>Wednesday, January 15, 14</p> <p>How many is too many?</p> <p>Wednesday, January 15, 14</p> <p>The extreme limits FAT32: Maximum number of files: 268,435,437 Maximum file size: 4GB maximum number of files per directory: up to 65535, or less depending </p> <p>on file names NTFS: Maximum number of files: 4,294,967,295 Maximum file size: 16TB currently (16EB theoretically) Ext2: Maximum number of files: 10 Maximum file size: 2TB theoretical file per directory limit: 1.3 10 files Ext3: Maximum number of files: number of bytes in volume/2. Maximum file size: 16GB (1KB block) to 2TB (4KB block)http://stackoverflow.com/questions/466521/how-many-</p> <p>files-in-a-directory-is-too-manyWednesday, January 15, 14</p> <p>Whats wrong? Slow to load directory for maintenance and </p> <p>migration Performance hit loading files from that </p> <p>directory</p> <p> Set Max at 1000 or 100,000- well below your limit</p> <p>Wednesday, January 15, 14</p> <p>File path patterns</p> <p>Wednesday, January 15, 14</p> <p>Configure file paths Basic settings are </p> <p>limited arbitary text entitytype/filetype Example: </p> <p>article/pdfs</p> <p>Wednesday, January 15, 14</p> <p>A better idea! sites/default/files/YYYY/MM/DD For high volume uploads</p> <p>https://drupal.org/node/2128055Wednesday, January 15, 14</p> <p>Token for file directory! Set to date</p> <p>Wednesday, January 15, 14</p> <p>File (Field) Paths Set file name also Node tokens Transliteration</p> <p>Wednesday, January 15, 14</p> <p>Example file path patterns Parent directory by date Parent directory by content type Parent directory by a combination of content </p> <p>type and author</p> <p>Wednesday, January 15, 14</p> <p>Pathauto Requires Token Set patterns for paths instead of node/1</p> <p>Wednesday, January 15, 14</p> <p>Private and public files</p> <p>Wednesday, January 15, 14</p> <p>public:// &amp; private:// Public Anyone can </p> <p>download them Private Controlling access to </p> <p>the files</p> <p>Wednesday, January 15, 14</p> <p>Private Specify a directory </p> <p>outside of the doc root folder</p> <p>Example../private</p> <p> OR Sub-directory under the public directory </p> <p>Examplesites/default/files/private</p> <p>https://drupal.org/documentation/modules/file</p> <p>Wednesday, January 15, 14</p> <p>Private directory Create the private directory at same level as </p> <p>root folder Configuration &gt; Media &gt; File system Set file system path</p> <p> System creates .htaccess file</p> <p>Wednesday, January 15, 14</p> <p>Choose default option Configuration &gt; Media &gt; File system Choose default method</p> <p>Wednesday, January 15, 14</p> <p>Per field options Select private file</p> <p> The paths will be like /system/files/ebooks/pressrelease.pdf</p> <p>Wednesday, January 15, 14</p> <p>What happens? Field inherits access publishing settings of </p> <p>content</p> <p>Wednesday, January 15, 14</p> <p>Private file modules Private files download permission 1.7k using Field Permissions 36k using File entity (fieldable files) 29k using</p> <p>Wednesday, January 15, 14</p> <p>More complex file handling needed?</p> <p>Wednesday, January 15, 14</p> <p>A flexible solution Media + File entity + OEmbed + CKEditor</p> <p> Being used in Drupal Commons and Demo Framework</p> <p>Wednesday, January 15, 14</p> <p>Demo Framework A good example of media configuration http://drupal.org/project/df</p> <p>Wednesday, January 15, 14</p> <p>CKEditor Link</p> <p>https://drupal.org/project/ckeditor_link_filehttps://drupal.org/project/ckeditor_link</p> <p>Wednesday, January 15, 14</p> <p> http://drupal.org/project/multiupload_filefield_widget</p> <p> http://drupal.org/project/multiupload_imagefield_widget</p> <p> http://drupal.org/project/plupload </p> <p>Multi file uploads</p> <p>Wednesday, January 15, 14</p> <p>Future friendly</p> <p>Wednesday, January 15, 14</p> <p>Media module 2.x Adds an upload widget</p> <p>Wednesday, January 15, 14</p> <p>File entity File entity (fieldable files) Add fields to files, group, add display modes, </p> <p>use Token Working on getting this into D8</p> <p> Documentation at drupal.org/node/1591498</p> <p>Wednesday, January 15, 14</p> <p>Fieldable entity</p> <p>Wednesday, January 15, 14</p> <p>File browser File browser and uploader</p> <p>Wednesday, January 15, 14</p> <p>File settings (global) Configuration </p> <p>Media File settings</p> <p> Global file field settings</p> <p>Wednesday, January 15, 14</p> <p>Granular file permissions</p> <p>Wednesday, January 15, 14</p> <p>Display formatter</p> <p>Wednesday, January 15, 14</p> <p>Further extend Media module - Handing files from external </p> <p>sources and services such as YouTube, Vimeo and Flickr.</p> <p> File entity revisions module</p> <p>Wednesday, January 15, 14</p> <p>Plans to bring into D8 Find out more Drupal 8 media battle-plan</p> <p>groups.drupal.org/node/384813 drupal.org/community-initiatives/drupal-core/</p> <p>file-management</p> <p>Wednesday, January 15, 14</p> <p>Display formatting Additional display formatters</p> <p>Wednesday, January 15, 14</p> <p>Display formatting</p> <p>Wednesday, January 15, 14</p> <p>File view modes</p> <p>Wednesday, January 15, 14</p> <p>Fix it? HALP!</p> <p>Wednesday, January 15, 14</p> <p>Remediation Move files to new directories Recreate all the files using your new tokens If you embed inline files/images, youd </p> <p>have to write a script to find and replace.</p> <p> Public files are easier. Drupal handled files are easier. Example: Media is embedding a file ID. </p> <p>Wednesday, January 15, 14</p> <p>Migrate Module Use Migrate module to do an in-place </p> <p>migrate of your own site. </p> <p>drupal.org/project/migrateWednesday, January 15, 14</p> <p>Professional help Acquia Professional Services Migration services</p> <p>Wednesday, January 15, 14</p> <p>acquia.com/resources/webinars/preventing-drupal-headaches-content-type-checklist</p> <p>Wednesday, January 15, 14</p>