Created
June 8, 2016 08:25
-
-
Save derhasi/2bdd3f920e5dd1046845836ded3e3a5f to your computer and use it in GitHub Desktop.
Add Drupal Project key to every .info file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @var SplFileInfo $path | |
* @var SplFileInfo $file | |
*/ | |
foreach(new DirectoryIterator(__DIR__ . '/sites/all/modules/contrib') as $path) { | |
$projectname = $path->getFilename(); | |
echo $path->getPathname() . "\n"; | |
foreach (new DirectoryIterator($path->getPathname()) as $file) { | |
if ($file->isDir()) { | |
continue; | |
} | |
if ($file->getExtension() == 'info') { | |
if (file_put_contents($file->getPathname(), sprintf("\nproject = \"%s\"", $projectname), FILE_APPEND)) { | |
echo sprintf('Added project name "%s" to "%s"' . "\n", $projectname, $file->getPathname()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment