Created
October 1, 2013 22:54
-
-
Save silvasur/6786529 to your computer and use it in GitHub Desktop.
Fixes the metadata files of a Ratatöskr plugin repository.
This file contains hidden or 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
#!/usr/bin/env php | |
<?php | |
/* | |
This will repair the metadata of the packages in your repository. | |
Place it into the root directory of your reository and run it via the terminal (php fix.php). | |
If everything has worked, nothing will be printed. | |
You should delete this script after fixing the metadata. | |
*/ | |
$root = dirname(__FILE__); | |
require_once("$root/r7r_repo/pluginpackage.php"); | |
$pkgs = scandir("$root/packages"); | |
foreach($pkgs as $pkgname) { | |
if((!is_dir("$root/packages/$pkgname")) || (substr($pkgname, 0, 1) == ".")) { | |
continue; | |
} | |
try { | |
$pkg = PluginPackage::load(file_get_contents("$root/packages/$pkgname/versions/current")); | |
$meta = $pkg->extract_meta(); | |
file_put_contents("$root/packages/$pkgname/meta", serialize($meta)); | |
} catch(Exception $e) { | |
echo "Failed processing package <$pkgname>: " . $e->getMessage() . "\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment