@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 81 lines 2.3 kB view raw
1<?php 2 3final class PhorgeCodeWarningSetupCheck extends PhabricatorSetupCheck { 4 5 public function getExecutionOrder() { 6 return 2000; 7 } 8 9 public function getDefaultGroup() { 10 return self::GROUP_OTHER; 11 } 12 13 protected function executeChecks() { 14 $warnings = (new PhorgeSystemDeprecationWarningListener())->getWarnings(); 15 if (!$warnings) { 16 return; 17 } 18 19 $link = phutil_tag( 20 'a', 21 array('href' => 'https://we.phorge.it/w/docs/report-warnings/'), 22 pht('%s\'s home page', PlatformSymbols::getPlatformServerName())); 23 24 $message = pht( 25 'There is some deprecated code found in the %s code-base.'. 26 "\n\n". 27 "This isn't a problem yet, but it means that %s might stop working if ". 28 'you upgrade PHP version.'. 29 "\n\n". 30 'This page records a sample of the cases since last server restart. '. 31 "\n\n". 32 'To solve this issue, either:'. 33 "\n\n". 34 '- Visit %s, file bug report with the information below, or'. 35 "\n". 36 '- Ignore this issue using the `Ignore` button below.'. 37 "\n\n", 38 PlatformSymbols::getPlatformServerName(), 39 PlatformSymbols::getPlatformServerName(), 40 $link); 41 $message = array($message); 42 43 $message[] = pht('PHP version: %s', phpversion()); 44 $message[] = "\n\n"; 45 46 $message[] = pht('Recorded items (sample):'); 47 $list = array(); 48 $warnings = array_reverse(isort($warnings, 'counter')); 49 foreach ($warnings as $key => $data) { 50 $summary = pht( 51 '%s, occurrences: %s', 52 $key, 53 $data['counter']); 54 55 $trace = phutil_tag('tt', array(), 56 array($data['message'] , "\n", $data['trace'])); 57 58 $list[] = phutil_tag( 59 'li', 60 array(), 61 phutil_tag( 62 'details', 63 array(), 64 array( 65 phutil_tag('summary', array(), $summary), 66 $trace, 67 ))); 68 } 69 $message[] = phutil_tag('ul', array(), $list); 70 71 72 $this->newIssue('deprecations') 73 ->setName(pht('Deprecated Code')) 74 ->setMessage($message) 75 ->setSummary(pht('There is some deprecated code found in the code-base.')) 76 ->addLink( 77 'https://we.phorge.it/w/docs/report-warnings/', 78 'More Details on the website'); 79 } 80 81}