Wouldn't it be cool if instead of forcing new Drupallers to learn the .info file syntax, the .info file just contained a PHP class with data about the module/theme? This patch does that. No changes in the behavior of Drupal should happen.

CommentFileSizeAuthor
drupalInfoFiles1.patch45.11 KBtetrahedron

Comments

webchick’s picture

Status: Active » Needs review

Erm. Not really? :)

#1: Both modules and themes use the .info file construct. Most themers are fluent in CSS/XHTML, not in PHP. So this raises the barrier to contribute themes significantly, and it's already plenty high enough.
#2: And, because .info files would now be parsed as PHP, a syntax error here means that a buggy module could render your site completely useless by merely visiting admin/build/modules. vs. now when it displays an error message, at worst.
#3: I don't see a class ContributedModule or ContributedTheme here. How are contributed modules supposed to create .info files? They're certainly not OptionalCoreModules. :\

And finally, it's also more typing. ;)

244 characters:

-name = Aggregator
-description = "Aggregates syndicated content (RSS, RDF, and Atom feeds)."
-package = Core - optional
-version = VERSION
-core = 7.x
-files[] = aggregator.module
-files[] = aggregator.admin.inc
-files[] = aggregator.pages.inc

293 characters:


+class Aggregator extends OptionalCoreModule {
+  protected $name = 'Aggregator';
+  protected $description = 'Aggregates syndicated content (RSS, RDF, and Atom feeds).';
+  protected $files = array(
+    'aggregator.module',
+    'aggregator.admin.inc',
+    'aggregator.pages.inc',
+  );
+}

So as an extremely lazy person, I object on those grounds as well. ;)

webchick’s picture

Btw, it's worth reading through #132018: Add .info files to themes (and improve/clean up the theme system) to get some background on the reasoning behind why we went to .info files rather than template.php files for themers, as well as to see why the idea of using PHP for these was shot down already.

For example, I totally forgot about:

Crell: we cannot use PHP, because info files need to be parseable without actually running code. This is necessary to avoid people pwning the drupal.org server through the packaging scripts.

So I think this is a won't fix. :\

Crell’s picture

Hm, I heard my name mentioned... :-)

I definitely recommend the thread webchick linked for background here. Using PHP code for info files has a number of issues. That said, I would still be open to dropping a proprietary file format in favor of something standardized like XML, if a good XML structure were put forward. (The main object to XML before was that parsing it in PHP 4 would be a huge PITA. For Drupal 7 and later that is a non-issue, and SimpleXML makes it, er, simple. :-) )

dries’s picture

I vote against this as well.

catch’s picture

Status: Needs review » Closed (won't fix)

Sounds like enough opposition to won't fix this. XML should probably go in another issue if that's an option.