Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-70086

Review rename_to_unused_name() to produce better short unique names

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.8.5, 3.9.2, 3.10, 4.0
    • General
    • None
    • MOODLE_310_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE

      This was discovered @ MDL-69975 by jpataleta when some reduction to make_unique_writable_directory() were being applied to reduce the length of those temporal / request local directories.

      The function rename_to_unused_name() also uses a "sub-optimal" algorithm to rename files / dirs to unique new names.

      It always uses a prefix (default to "temp") plus a 32 chars md5.

      This is about to check uses and consider if we could change that md5() to be, similarly to the linked issue, a uniqid(), that is only 13 chars. Of course, the change has to be done ensuring that the uniqueness is checked properly.

      That will save 19 chars that, sometimes, can be critical, specially under Windows environments where there is a max 260 chars limit by default in many systems (and only recent PHP versions are able to work over that limit in Windows).

      Surely, at the same time, we could review if there are similar functions using long names and try to reduce them together, haven't looked if there are more candidates. And, ideally, ensure that all those "random, short and unique" names are calculated the same way everywhere.

      Ciao

            Unassigned Unassigned
            stronk7 Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.