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

Replace all dirname(__FILE__) with __DIR__

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.2, 3.0.2
    • Fix Version/s: 3.2
    • Component/s: Performance
    • Labels:

      Description

      Since PHP 5.3, a new magic constant _DIR_ has been introduced having the same value as dirname(_FILE_). If nothing, we would save one function call per each usage (thence putting all the mess on the stack etc) as discussed at http://stackoverflow.com/questions/2749416/is-there-any-difference-between-dir-and-dirname-file-in-php

      We should also replace all include instances that use the dirname(_DIR) pattern with __DIR_ . '../' pattern.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16