Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because we are moving the files from one place to another.
Issue priority Normal because no changes.

Problem/Motivation

It feels wrong that many of *.api.php (except system.api.php) is part of system module

Proposed resolution

move it inside lib/Drupal/Core or
core or
core/lib

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

This is a fine plan, although I think maybe it should just go in the top-level core directory, or maybe core/lib? I think it would be easier to find there.

We should also move the other *.api.php files in core/modules/system, like theme.api.php, etc. Only system.api.php is supposed to have stuff that is part of the System module itself... not that it actually does -- see #2299715: [meta] Move core hooks from system.api.php to core.api.php or other files, which still needs to be finished, and moves hooks from system.api.php to other files.

tadityar’s picture

Title: Consider to move core.api.php out of system module » Consider to move *.api.php out of system module
Issue summary: View changes

Update Issue title and summary

tadityar’s picture

Status: Active » Postponed

Postponed until several issues regarding core.api.php like [meta]#2299715 Move core hooks from system.api.php to core.api.php are fixed.

jhodgdon’s picture

Status: Postponed » Active

All of the other issues have been resolved.

This can now be done, and I think it's a good idea. The question is where to move the *.api.php files. They do not belong in the System module (except system.api.php). But where?

Possible locations that may make sense:
core
core/lib
core/includes
core/documentation [new directory]
core/docs [new directory]

Any votes?

jhodgdon’s picture

Title: Consider to move *.api.php out of system module » Move all *.api.php files except system.api.php out of system module directory

retitling

botris’s picture

I would vote for a dedicated (new) folder.
core/api [new directory] ?

jhodgdon’s picture

Issue tags: +Novice

I talked to @alexpott in IRC just now...

We think the best thing to do would be to move each file to near the code it is documenting.

Example:
database.api.php ==> core/lib/Drupal/Core/Database

This seems like it might be a good Novice issue... hopefully the patch will be small since it will just move a bunch of files. Use git mv and it should keep the patch tiny.

Oh and the core.api.php file can be moved to the top-level core directory.

lahoosascoots’s picture

Assigned: Unassigned » lahoosascoots

This is what I've got so far.

	renamed:    core/modules/system/core.api.php -> core/core.api.php
	renamed:    core/modules/system/database.api.php -> core/lib/Drupal/Core/Database/database.api.php
	renamed:    core/modules/system/entity.api.php -> core/lib/Drupal/Core/Entity/entity.api.php
	renamed:    core/modules/system/file.api.php -> core/lib/Drupal/Core/File/file.api.php
	renamed:    core/modules/system/form.api.php -> core/lib/Drupal/Core/Form/form.api.php
	renamed:    core/modules/system/language.api.php -> core/lib/Drupal/Core/Language/language.api.php
	renamed:    core/modules/system/menu.api.php -> core/lib/Drupal/Core/Menu/menu.api.php
	renamed:    core/modules/system/theme.api.php -> core/lib/Drupal/Core/Theme/theme.api.php

Everything look good?

What about module.api.php and token.api.php?

jhodgdon’s picture

Excellent! Those mostly look like good places for those files.

Let's see. The Token class is in core/lib/Drupal/Core/Utility, so we can put the token file there.

The module-related classes are in core/lib/Drupal/Core/Extension, so we can put the module file there.

And I think the theme.api.php file is mostly about the render system, so let's actually put that in core/lib/Drupal/Core/Render instead of Theme.

Thanks for the research; just need a patch!

lahoosascoots’s picture

Status: Active » Needs review
FileSize
361.74 KB

This should do it.

lahoosascoots’s picture

Status: Needs review » Needs work

Nevermind. That failed miserably for some reason.

lahoosascoots’s picture

All fixed. Not sure what banana I slipped on for that last one.

lahoosascoots’s picture

Status: Needs work » Needs review
jhodgdon’s picture

Hm. Can you make a patch using "git mv" commands? It should be a lot smaller, like just saying the files are moved, rather than containing the entire text of all the files.

lahoosascoots’s picture

I did use git mv and the above patch is what I ended up with.

Here are my steps:

  1. Create branch off of 8.0.x
  2. git mv each file
  3. Commit to new branch
  4. git diff 8.0.x..new_branch > patchname.patch

Did I miss something from my normal process to fix this?

jhodgdon’s picture

Hm. I don't usually use the branch/commit workflow; I use git diff --cached. So I just tested with one file:

a) git mv core/modules/system/core.api.php core/core.api.php
b) git diff --cached

This ended up with a very small patch that looks like this:

diff --git a/core/modules/system/core.api.php b/core/core.api.php
similarity index 100%
rename from core/modules/system/core.api.php
rename to core/core.api.php

Maybe you can try that?

lahoosascoots’s picture

lahoosascoots’s picture

jhodgdon’s picture

Assigned: lahoosascoots » alexpott

Thanks! Looks good to me. I checked all the directories and I think they are the right places for those files. Assigning to @alexpott for final review/commit, since I discussed it with him earlier.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 17: Move-Api-Files-From-System-Module-2401843-17.patch, failed testing.

Status: Needs work » Needs review
chananapeeyush’s picture

Issue summary: View changes

Patch applied locally and tests also returned no errors.So retesting the patch.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 0afbdd4 and pushed to 8.0.x. Thanks!

Docs are exempt from beta evaluation.

  • alexpott committed 0afbdd4 on 8.0.x
    Issue #2401843 by lahoosascoots, jhodgdon: Move all *.api.php files...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.