Ejemplo n.º 1
0
 // When checking out a whole bunch of remote branches, creating
 // archives, moving stuff around. The working copy will leave build artificants
 // behind. It will also contain lots of files that will be considered "untracked"
 // according to a different branch pointer.
 // Beware that if you run this locally, don't use your main wiki as this also
 // removes things like "LocalSettings.php".
 print "Clean workspace and checkout {$remoteBranchName}...\n";
 $execOut = kfGitCleanReset(array('checkout' => $remoteBranchName));
 // Get revision of this branch. Used so we can check that the checkout worked
 // (in the past the script failed once due to a .git/index.lock error, in which case
 // the checkout command was aborted, and all the archives were for the same revision).
 // This will not happen again because we're now verifying that the remote branch head
 // matches the HEAD of the working copy after the checkout.
 print "Verifiying checkout succeeded...\n";
 $currHead = trim(kfShellExec("git rev-parse --verify HEAD"));
 if (!GitInfo::isSHA1($currHead)) {
     print "> rev-parse failed for HEAD: {$currHead}\n";
     print "> Skipping {$remoteBranchName}...\n";
     continue;
 }
 if ($branchHead !== $currHead) {
     // Checkout likely failed
     print "> ERROR: Current HEAD does not match remote branch pointer. Skipping...\n";
     continue;
 }
 // Get AuthorDate of latest commit this branch (Author instead of Commit)
 $headTimestamp = kfShellExec("git show HEAD --format='%at' -s");
 print "Generating new archive...\n";
 $archiveFilePathEscaped = kfEscapeShellArg($archiveFilePath);
 // Toolserver's git doesn't support --format='tar.gz', using 'tar' and piping to gzip instead
 $execOut = kfShellExec("git archive HEAD --format='tar' | gzip > {$archiveFilePathEscaped}");
Ejemplo n.º 2
0
 /**
  * Returns the HTML to add to the page for the toolbar
  *
  * @param IContextSource $context
  * @return array
  */
 public static function getDebugInfo(IContextSource $context)
 {
     if (!self::$enabled) {
         return [];
     }
     global $wgVersion, $wgRequestTime;
     $request = $context->getRequest();
     // HHVM's reported memory usage from memory_get_peak_usage()
     // is not useful when passing false, but we continue passing
     // false for consistency of historical data in zend.
     // see: https://github.com/facebook/hhvm/issues/2257#issuecomment-39362246
     $realMemoryUsage = wfIsHHVM();
     $branch = GitInfo::currentBranch();
     if (GitInfo::isSHA1($branch)) {
         // If it's a detached HEAD, the SHA1 will already be
         // included in the MW version, so don't show it.
         $branch = false;
     }
     return ['mwVersion' => $wgVersion, 'phpEngine' => wfIsHHVM() ? 'HHVM' : 'PHP', 'phpVersion' => wfIsHHVM() ? HHVM_VERSION : PHP_VERSION, 'gitRevision' => GitInfo::headSHA1(), 'gitBranch' => $branch, 'gitViewUrl' => GitInfo::headViewUrl(), 'time' => microtime(true) - $wgRequestTime, 'log' => self::$log, 'debugLog' => self::$debug, 'queries' => self::$query, 'request' => ['method' => $request->getMethod(), 'url' => $request->getRequestURL(), 'headers' => $request->getAllHeaders(), 'params' => $request->getValues()], 'memory' => $context->getLanguage()->formatSize(memory_get_usage($realMemoryUsage)), 'memoryPeak' => $context->getLanguage()->formatSize(memory_get_peak_usage($realMemoryUsage)), 'includes' => self::getFilesIncluded($context)];
 }