public static function downloadData($plugin_id, $vendor_name, $user = "******") { // Get main files from Github $composer = Github::getContent($vendor_name, 'composer.json', $user); $featherbb = Github::getContent($vendor_name, 'featherbb.json', $user); $readme = Github::getContent($vendor_name, 'README.md', $user); if ($composer === false || $featherbb === false || $readme === false) { return false; } $composerDecoded = json_decode($composer); $featherDecoded = json_decode($featherbb); $plugin = ORM::for_table('market_plugins')->find_one($plugin_id); if ($plugin !== false) { $plugin->homepage = 'https://github.com/featherbb/' . $vendor_name; $plugin->status = 2; $plugin->vendor_name = $vendor_name; // $plugin->author = $featherDecoded->author->name; $plugin->last_version = $featherDecoded->version; $plugin->description = $composerDecoded->description; $plugin->keywords = serialize($composerDecoded->keywords); $plugin->readme = $readme; $plugin->save(); } return $plugin; }
public static function downloadData($theme_id, $vendor_name) { $theme = ORM::for_table('market_themes')->find_one($theme_id); if ($theme === false) { return false; } // Get main files from Github $userGit = explode('/', str_ireplace(array('http://', 'https://'), '', $theme->homepage)); $readme = Github::getContent($userGit[2], 'README.md', $userGit[1]); $featherbb = Github::getContent($userGit[2], 'featherbb.json', $userGit[1]); if ($featherbb === false || $readme === false) { return false; } $featherDecoded = json_decode($featherbb); $theme->status = 2; $theme->vendor_name = $vendor_name; $theme->last_version = $featherDecoded->version; $theme->last_update = time(); $theme->keywords = serialize($featherDecoded->keywords); $theme->readme = $readme; $theme->save(); return $theme; }