} $count = 1; foreach (glob($langRepoPath . '/pot/*.pot') as $pot) { $fileinfo = pathinfo($pot); $module = $fileinfo['filename']; if ($fileinfo['filename'] != 'amp') { $moduleDirectory = $directory . "/" . $module; $langDirectory = $moduleDirectory . "/i18n"; } else { //framework is different $moduleDirectory = $directory . "/framework"; $langDirectory = $moduleDirectory . "/amp_conf/htdocs/admin/i18n"; } if (file_exists($moduleDirectory)) { freepbx::outn('Opening ' . $module . '...'); freepbx::refreshRepo($moduleDirectory); try { $repo = Git::open($moduleDirectory); freepbx::out("Done"); $ab = $repo->active_branch(); $repo->checkout("master"); } catch (Exception $e) { freepbx::out("Skipping"); continue; } if (!file_exists($langDirectory)) { freepbx::out('WARNING: Creating Missing i18n folder in ' . $module, 1); mkdir($langDirectory, 0777, true); } foreach (glob($langRepoPath . '/po/*', GLOB_ONLYDIR) as $langpath) { $lang = basename($langpath);
chdir($pwd); freepbx::out("Done"); } } } exit(0); } if (!isset($options['setup']) && isset($options['switch']) && !empty($options['switch'])) { foreach (glob($directory . "/*", GLOB_ONLYDIR) as $dir) { freepbx::switchBranch($dir, $options['switch']); } exit(0); } if (isset($options['refresh'])) { foreach (glob($directory . "/*", GLOB_ONLYDIR) as $dir) { freepbx::refreshRepo($dir); } exit(0); } if (isset($options['addmergedriver'])) { foreach (glob($directory . "/*", GLOB_ONLYDIR) as $dir) { freepbx::outn("Attempting to open " . $dir . "..."); //Attempt to open the module as a git repo, bail if it's not a repo try { $repo = Git::open($dir); freepbx::out("Done"); } catch (Exception $e) { freepbx::out("Skipping"); continue; } $gitatts = $repo->add_merge_driver();