Example #1
0
 public function execute()
 {
     $cacheSize = 0;
     if ($this->hasOption('precache')) {
         $cacheSize = $this->getOption('precache');
         if (strtolower($cacheSize) !== "all") {
             if (preg_match('/^\\d+$/', $cacheSize)) {
                 $cacheSize = intval($cacheSize);
             } else {
                 $this->error("Invalid argument for --precache (must be a positive integer, 0 or 'all')", true);
             }
         }
     }
     $repo = $this->getArg(0);
     if ($repo == "all") {
         $repoList = CodeRepository::getRepoList();
         foreach ($repoList as $repoInfo) {
             $this->importRepo($repoInfo->getName(), null, $cacheSize);
         }
     } else {
         $startRev = null;
         if ($this->hasArg(1)) {
             $startRev = $this->getArg(1);
         }
         $this->importRepo($repo, $startRev, $cacheSize);
     }
 }
Example #2
0
 public function execute()
 {
     global $wgOut;
     $wgOut->addHTML($this->getForm());
     $repos = CodeRepository::getRepoList();
     if (!count($repos)) {
         return;
     }
     $text = '';
     foreach ($repos as $repo) {
         $name = $repo->getName();
         $text .= "* [[Special:RepoAdmin/{$name}|{$name}]]\n";
     }
     $wgOut->addWikiText($text);
 }
 static function reallyGetContent()
 {
     $repos = CodeRepository::getRepoList();
     if (!count($repos)) {
         return wfMsg('code-no-repo');
     }
     $text = '';
     foreach ($repos as $repo) {
         global $wgLang;
         $name = $repo->getName();
         $text .= "* '''[[Special:CodeBrowse/{$name}|{$name}]]''' (";
         $links[] = "[[Special:Code/{$name}|" . wfMsgHtml('code-log') . "]]";
         $links[] = "[[Special:Code/{$name}/comments|" . wfMsgHtml('code-notes') . "]]";
         $links[] = "[[Special:Code/{$name}/tag|" . wfMsgHtml('code-tags') . "]]";
         $links[] = "[[Special:Code/{$name}/author|" . wfMsgHtml('code-authors') . "]]";
         $text .= $wgLang->pipeList($links);
         $text .= ")\n";
     }
     return $text;
 }
Example #4
0
 public function execute()
 {
     global $wgOut;
     $repos = CodeRepository::getRepoList();
     if (!count($repos)) {
         global $wgUser;
         $wgOut->addWikiMsg('code-no-repo');
         if ($wgUser->isAllowed('repoadmin')) {
             $wgOut->addWikiMsg('code-create-repo');
         } else {
             $wgOut->addWikiMsg('code-need-repoadmin-rights');
             if (!count(User::getGroupsWithPermission('repoadmin'))) {
                 $wgOut->addWikiMsg('code-need-group-with-rights');
             }
         }
         return;
     }
     $text = '';
     foreach ($repos as $repo) {
         $text .= "* " . self::getNavItem($repo) . "\n";
     }
     $wgOut->addWikiText($text);
 }
Example #5
0
 /**
  * Like getRevIdString(), but if more than one repository is defined
  * on the wiki then it includes the repo name as a prefix to the revision ID
  * (separated with a period).
  * This ensures you get a unique reference, as the revision ID alone can be
  * confusing (e.g. in e-mails, page titles etc.).  If only one repository is
  * defined then this returns the same as getRevIdString() as there
  * is no ambiguity.
  *
  * @param $id string
  * @return string
  */
 public function getRevIdStringUnique($id)
 {
     $id = wfMsg('code-rev-id', $id);
     // If there is more than one repo, use the repo name as well.
     $repos = CodeRepository::getRepoList();
     if (count($repos) > 1) {
         $id = $this->getName() . "." . $id;
     }
     return $id;
 }