← Back to team overview

mahara-contributors team mailing list archive

[Bug 1776364] A change has been merged

 

Reviewed:  https://reviews.mahara.org/8961
Committed: https://git.mahara.org/mahara/mahara/commit/ebc59442e8119263b56b1a1295a6295743de3a9d
Submitter: Robert Lyon (robertl@xxxxxxxxxxxxxxx)
Branch:    18.04_STABLE

commit ebc59442e8119263b56b1a1295a6295743de3a9d
Author: Kenneth Hendricks <kennethhendricks@xxxxxxxxxxxxxxx>
Date:   Tue Jun 12 12:27:42 2018 +1000

Bug 1776364: Add generateifpossible flag to get_local_path

This flag will set whether the function should
attempt to create the file if it doesn't exist.

E.g. image resizes.

This allows an external file system to call
get_local_path with this flag set to false to
skip the processing. This allows an external
file system to avoid an infinate loop when calling
get_local_path to check local file availibility.

Sponsored by Central Queensland University

behatnotneeded

Change-Id: Iaade0b06fcc2cd1755467231e0bafea6b90a99ec
(cherry picked from commit 63d04fd120c2d848e986542ee2368798373cefad)

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1776364

Title:
  External file system image infinite loop

Status in Mahara:
  Fix Committed
Status in Mahara 18.04 series:
  Fix Committed
Status in Mahara 18.10 series:
  Fix Committed

Bug description:
  When the objectfs plugin is being used as an external file system, an
  image is uploaded and that image is no longer locally available the
  following infinite loop occurs:

  mahara_1     | PHP message: PHP 34291. module_objectfs\object_file_system->is_file_readable_locally() /siteroot/htdocs/module/objectfs/classes/object_file_system.php:141
  mahara_1     | PHP message: PHP 34292. ArtefactTypeImage->get_local_path() /siteroot/htdocs/module/objectfs/classes/object_file_system.php:122
  mahara_1     | PHP message: PHP 34293. get_dataroot_image_path() /siteroot/htdocs/artefact/file/lib.php:2391
  mahara_1     | PHP message: PHP 34294. ArtefactTypeFile->ensure_local() /siteroot/htdocs/lib/file.php:542
  mahara_1     | PHP message: PHP 34295. module_objectfs\mahara_external_filesystem->ensure_local() /siteroot/htdocs/artefact/file/lib.php:1147
  mahara_1     | PHP message: PHP 34296. module_objectfs\mahara_external_filesystem->get_file_location_status() /siteroot/htdocs/module/objectfs/classes/mahara_external_filesystem.php:64
  mahara_1     | PHP message: PHP 34297. module_objectfs\object_file_system->get_object_location() /siteroot/htdocs/module/objectfs/classes/mahara_external_filesystem.php:87
  mahara_1     | PHP message: PHP 34298. module_objectfs\object_file_system->is_file_readable_locally() /siteroot/htdocs/module/objectfs/classes/object_file_system.php:141

  It's my opinion this is not an issue with the plugin itself, but the
  core hooks. It is expected that a FS plugin will call
  ArtefactTypeImage->get_local_path within its
  mahara_external_filesystem->ensure_local.

  
  Reproduction steps (reproduced with 1804):

  1. Fresh install mahara
  2. Install https://github.com/catalyst/mahara-module_objectfs and https://github.com/catalyst/mahara-module_aws
  3. Configure the plugin with test s3 crendentials. 
  4. Set: 
      Delete local objects = true
      Minimum size threshold = 0
      Minimum age = 0
      Consistancy delay = 0

  5. Put this line in config.php:

  $cfg->externalfilesystem = array(
     "includefilepath" => "module/objectfs/classes/s3_file_system.php",
     "class" => "module_objectfs\\s3_file_system"
  );

  6. Goto /artefact/file/index.php

  7. Upload an image

  8. php htdocs/module/objectfs/cli/run_pusher.php

  9. php htdocs/module/objectfs/cli/run_deleter.php // The file will now
  be in s3 only

  10. Refresh /artefact/file/index.php and view error

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1776364/+subscriptions


References