Skip to content
GitLab
    • Explore Projects Groups Topics Snippets
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • fusiondirectory fusiondirectory
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 39
    • Issues 39
    • List
    • Boards
    • Service Desk
    • Milestones
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • fusiondirectoryfusiondirectory
  • fusiondirectoryfusiondirectory
  • Issues
  • #6048
Something went wrong while setting issue due date.
Closed
Open
Issue created 5 years ago by bmortier@bmortierMaintainer
  • New related issue

  • New related issue

Switch to PSR-4 autoloader

Open

Switch to PSR-4 autoloader

FusionDirectory currently use an old-school autoloader, which relies on «fusiondirectory --update-cache» being run.

Modern PHP (especially stuff using Composer) tend to use autoloaders following this norm: https://www.php-fig.org/psr/psr-4/

Actual behavior

fusiondirectory --update-cache parse all our PHP files and stores the class paths in a cache file. We register __fusiondirectory_autoload as an autoloader, which uses this cache file to find the classes. We had to add an exception for smarty classes as smarty has its own autoloader.

Expected behavior

Use a PSR-4 autoloader in a autoload.php file.

Step by step description of new behaviour

This would require a huge reorganization of the code:

  1. Use namespaces
  2. Use subnamespaces for directories
  3. One file for each class, ending in .php (no more .inc)

Benefits

  1. No more need for --update-cache
  2. Interoperable with other autoloaders
  3. Makes it possible to use tools like phpstan, or libraries based on composer (most of them are nowadays)

Possible Drawbacks

  1. Heavy use of namespaces
  2. Break of any code relying on current FD organization
  3. Redo packaging
  4. Rewrite stuff like --install-plugins

Applicable Issues

Tasks

0

No tasks are currently assigned. Use tasks to break down this issue into smaller parts.

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


  • bmortier changed milestone to %FusionDirectory 1.5 5 years ago

    changed milestone to %FusionDirectory 1.5

    By Côme Chilliet on 2019-10-31T10:19:31 (imported from GitLab)

  • bmortier added PJ1802-0188 label 5 years ago

    added PJ1802-0188 label

  • bmortier added enhancement label 5 years ago

    added enhancement label

  • bmortier added interns label 5 years ago

    added interns label

  • bmortier added 2h of time spent at 2020-06-30 4 years ago

    added 2h of time spent at 2020-06-30

    By Côme Chilliet on 2020-06-30T15:04:21 (imported from GitLab)

  • bmortier mentioned in issue #6114 4 years ago

    mentioned in issue #6114

    By Côme Chilliet on 2020-09-03T13:46:33 (imported from GitLab)

  • bmortier mentioned in issue #6171 3 years ago

    mentioned in issue #6171

    By Côme Chilliet on 2021-06-22T08:49:42 (imported from GitLab)

  • bmortier mentioned in issue #6175 3 years ago

    mentioned in issue #6175

    By Côme Chilliet on 2021-07-12T14:51:19 (imported from GitLab)

  • bmortier marked this issue as related to #6171 3 years ago

    marked this issue as related to #6171

    By bmortier on 2021-07-29T18:40:55 (imported from GitLab)

  • bmortier
    bmortier @bmortier · 3 years ago
    Author Maintainer

    Note from https://gitlab.fusiondirectory.org/fusiondirectory/fd/-/issues/6175#note_108991 :

    get_class/get_parent_class return the namespaced name of classes, this broke serializeAttribute which I fixed, but for #6048 we will need to be extra careful with all the code based on get_class/get_parent_class for simplePlugin.

    By Côme Chilliet on 2021-08-31T09:49:02 (imported from GitLab)

  • bmortier assigned to @tdockx and unassigned @cchilliet 3 years ago

    assigned to @tdockx and unassigned @cchilliet

    By bmortier on 2022-02-21T21:44:22 (imported from GitLab)

  • bmortier changed milestone to %FusionDirectory 1.6 11 months ago

    changed milestone to %FusionDirectory 1.6

  • bmortier assigned to @tdockx and unassigned @bmortier 11 months ago

    assigned to @tdockx and unassigned @bmortier

Please register or sign in to reply
Assignee
dockx thibault's avatar
dockx thibault
Assign to
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
0
0 Participants
Reference:

Menu

Explore Projects Groups Topics Snippets