Now images are cached in 'files/qr_codes' dir. Let admins decide where to save files.

Consider Drupal tmp folder as alternative when no path is entered.

Comments

IncrediblyKenzi’s picture

Status: Active » Needs review
StatusFileSize
new3.93 KB

Here's a patch that allows the directory within files to be set. I've opted to omit the /tmp functionalitiy, since that somewhat changes the nature of the cache.

levelos’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

IncrediblyKenzi’s picture

StatusFileSize
new3.95 KB

Updated.. found a bug on line 94 after enabling the block.

IncrediblyKenzi’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 6.x-dev branch.

claudiu.cristea’s picture

Status: Fixed » Needs review

Too fast guys... I wanted to make some review on the code... :)

Why not letting the patch some days for testing and review?

IncrediblyKenzi’s picture

Happy to slow down. loubabe gave me a greenlight on it, so we went ahead with it.

claudiu.cristea’s picture

Status: Needs review » Needs work
+++ qr_codes.admin.inc	26 Oct 2010 18:53:37 -0000
@@ -21,7 +21,17 @@ function qr_codes_settings() {
+      '#default_value' => variable_get('qr_codes_cache_dir', 'qr_codes'),
+      '#element_validate' => array('_qr_codes_settings_cache_dir_validate'),
+      '#field_prefix' => file_directory_path() . '/',

If we decide to let custom cache directory... we do not have to force it to be under "files". /tmp or /home/myuser/cache should be acceptable too. Default value to variable_get() should be "files/qr_codes" in that case. "#field_prefix" should be removed. Check what is changing in other places...

+++ qr_codes.admin.inc	26 Oct 2010 18:53:37 -0000
@@ -94,6 +104,24 @@ function _qr_codes_submit($form, $form_s
+    if (preg_match('/[^a-zA-z0-9_-]/', $element['#value'])) {

Hmmm. IMO inconsistent RegExp. What about dot (".")? What about other filesystem special chars?

+++ qr_codes.admin.inc	26 Oct 2010 18:53:37 -0000
@@ -94,6 +104,24 @@ function _qr_codes_submit($form, $form_s
+  } else {

Should be:
}
else {

according to Drupal Coding Standards (see http://drupal.org/coding-standards#controlstruct)

Powered by Dreditor.