Created
September 5, 2011 11:04
-
-
Save co3k/1194705 to your computer and use it in GitHub Desktop.
バンドルプラグインリストのデータを読み込み、 OpenPNE の各メジャーバージョンの最新のマイナーバージョンにどのプラグインのどのバージョンがバンドルされているかをリストするやつ
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
<?php | |
// To run, you need the Symfony\Yaml and Symfony\ClassLoader. | |
// You can get these libraries from PEAR installer by the followings: | |
// $ pear channel-discover pear.symfony.com | |
// $ pear install symfony2/Yaml | |
require_once 'Symfony/Component/Yaml/Yaml.php'; | |
require_once 'Symfony/Component/Yaml/Parser.php'; | |
require_once 'Symfony/Component/Yaml/Inline.php'; | |
require_once 'Symfony/Component/Yaml/Dumper.php'; | |
require_once 'Symfony/Component/Yaml/Escaper.php'; | |
require_once 'Symfony/Component/Yaml/Unescaper.php'; | |
require_once 'Symfony/Component/Yaml/Exception/ExceptionInterface.php'; | |
require_once 'Symfony/Component/Yaml/Exception/DumpException.php'; | |
require_once 'Symfony/Component/Yaml/Exception/ParseException.php'; | |
use Symfony\Component\Yaml\Yaml; | |
function get_major_version($full_version) | |
{ | |
return preg_filter('/^([0-9]+\.[0-9]+)\.?.*$/', '$1', $full_version); | |
} | |
$pattern = '/Users/co3k/Documents/openpne/bundled-plugins-list/*.yml'; | |
$latest_minor = array(); | |
$bundled_version_table = array(); | |
$result = array(); | |
$it = new GlobIterator($pattern); | |
foreach ($it as $file) { | |
$op3_version = $file->getBasename('.'.$file->getExtension()); | |
// create bundled version list | |
$list = Yaml::parse((string)$file); | |
foreach ($list as $plugin_name => $plugin_info) { | |
$bundled_version_table[$plugin_name][$plugin_info['version']][] = $op3_version; | |
} | |
// calc latest minor versions of OpenPNE3 | |
if (false !== strpos($op3_version, '-dev')) { // skip development version | |
continue; | |
} | |
$major = get_major_version($op3_version); | |
if ($major * 10 % 2) { | |
continue; // skip unstable version | |
} | |
if (!isset($latest_minor[$major])) { | |
$latest_minor[$major] = $op3_version; | |
continue; | |
} | |
// compare with registered op3_version | |
if (version_compare($latest_minor[$major], $op3_version, '<')) { | |
$latest_minor[$major] = $op3_version; | |
} | |
} | |
sort($latest_minor); // covert this array to indexed | |
foreach ($bundled_version_table as $plugin_name => $plugin_versions) { | |
$result[$plugin_name] = array(); | |
foreach ($plugin_versions as $plugin_version => $op3_versions) { | |
$bundled_versions = array_intersect($op3_versions, $latest_minor); | |
if ($bundled_versions) { | |
sort($bundled_versions); // reset | |
$result[$plugin_name][$plugin_version] = $bundled_versions; | |
} | |
} | |
} | |
echo Yaml::dump($result); | |
/** | |
Result of 2011/09/05 20:03 JST | |
opOpenSocialPlugin: | |
0.8.2.1: [3.0.8.4] | |
0.9.9.2: [3.2.7.5] | |
0.9.12: [3.4.15] | |
1.2.6: [3.6beta13] | |
opDiaryPlugin: | |
0.8.1: [3.0.8.4] | |
1.0.0.2: [3.2.7.5] | |
1.2.0.2: [3.4.15] | |
1.3.2.1: [3.6beta13] | |
opMessagePlugin: | |
0.8.2.4: [3.0.8.4] | |
0.9.1.1: [3.2.7.5] | |
0.9.2.1: [3.4.15] | |
0.9.2: [3.6beta13] | |
opAshiatoPlugin: | |
0.8.0.1: [3.0.8.4] | |
0.9.0.1: [3.2.7.5, 3.4.15] | |
0.9.1.2: [3.6beta13] | |
opAuthMailAddressPlugin: | |
1.0.0: [3.0.8.4] | |
1.1.4.1: [3.2.7.5] | |
1.2.1: [3.4.15] | |
1.3.3: [3.6beta13] | |
opAuthMobileUIDPlugin: | |
1.0.0: [3.0.8.4, 3.2.7.5] | |
1.0.0.1: [3.4.15] | |
1.3.2: [3.6beta13] | |
opAuthOpenIDPlugin: | |
1.0.0: [3.0.8.4] | |
1.1.1: [3.2.7.5, 3.4.15] | |
1.3.0: [3.6beta13] | |
opCommunityTopicPlugin: | |
0.8.1: [3.0.8.4] | |
0.9.8.1: [3.2.7.5, 3.4.15] | |
1.0.1.1: [3.6beta13] | |
opIntroFriendPlugin: | |
0.8.0.1: [3.0.8.4] | |
0.9.2.1: [3.6beta13] | |
opWebAPIPlugin: | |
0.1.0: [3.0.8.4] | |
0.4.0: [3.2.7.5] | |
0.5.0: [3.4.15, 3.6beta13] | |
opBlogPlugin: | |
0.9.0: [3.2.7.5, 3.4.15] | |
1.0.1: [3.6beta13] | |
opAlbumPlugin: | |
0.9.3.1: [3.2.7.5] | |
0.9.4.1: [3.4.15, 3.6beta13] | |
opFavoritePlugin: | |
1.0.0.4: [3.6beta13] | |
opRankingPlugin: | |
1.0.0.1: [3.6beta13] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
とりあえず最新情報
opOpenSocialPlugin:
0.8.2.1: [3.0.8.5]
0.9.9.2: [3.2.7.6]
0.9.13: [3.4.16]
1.2.6: [3.6.0]
opDiaryPlugin:
0.8.1: [3.0.8.5]
1.0.0.2: [3.2.7.6]
1.2.0.2: [3.4.16]
1.4.0.1: [3.6.0]
opMessagePlugin:
0.8.2.4: [3.0.8.5]
0.9.1.1: [3.2.7.6]
0.9.2.1: [3.4.16]
0.9.2: [3.6.0]
opAshiatoPlugin:
0.8.0.1: [3.0.8.5]
0.9.0.1: [3.2.7.6, 3.4.16]
1.1.0: [3.6.0]
opAuthMailAddressPlugin:
1.0.0: [3.0.8.5]
1.1.4.1: [3.2.7.6]
1.2.1: [3.4.16]
1.3.4: [3.6.0]
opAuthMobileUIDPlugin:
1.0.0: [3.0.8.5, 3.2.7.6]
1.0.0.1: [3.4.16]
1.3.2: [3.6.0]
opAuthOpenIDPlugin:
1.0.0: [3.0.8.5]
1.1.1: [3.2.7.6, 3.4.16]
1.3.0: [3.6.0]
opCommunityTopicPlugin:
0.8.1: [3.0.8.5]
0.9.8.1: [3.2.7.6, 3.4.16]
1.0.2.2: [3.6.0]
opIntroFriendPlugin:
0.8.0.1: [3.0.8.5]
1.0.0: [3.6.0]
opWebAPIPlugin:
0.1.0: [3.0.8.5]
0.4.0: [3.2.7.6]
0.5.1: [3.4.16, 3.6.0]
opBlogPlugin:
0.9.0: [3.2.7.6, 3.4.16]
1.0.1: [3.6.0]
opAlbumPlugin:
0.9.3.1: [3.2.7.6]
0.9.4.1: [3.4.16, 3.6.0]
opFavoritePlugin:
1.0.1: [3.6.0]
opRankingPlugin:
1.0.1: [3.6.0]