@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Migrate local disk storage setup check

Summary:
Migrate to the new hotness. Also:

- Remove a string test, which is now impossible since the config will repair itself and raise a type error.
- Restore the header even in /config/ -- this check is kind of hacky and it feels a bit more natural now that it's above the menu.

Test Plan: Set my local disk path to something invalid, verified I got a setup error.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2228

Differential Revision: https://secure.phabricator.com/D4497

+40 -53
+2
src/__phutil_library_map__.php
··· 1207 1207 'PhabricatorSetupCheckExtraConfig' => 'applications/config/check/PhabricatorSetupCheckExtraConfig.php', 1208 1208 'PhabricatorSetupCheckInvalidConfig' => 'applications/config/check/PhabricatorSetupCheckInvalidConfig.php', 1209 1209 'PhabricatorSetupCheckMail' => 'applications/config/check/PhabricatorSetupCheckMail.php', 1210 + 'PhabricatorSetupCheckStorage' => 'applications/config/check/PhabricatorSetupCheckStorage.php', 1210 1211 'PhabricatorSetupCheckTimezone' => 'applications/config/check/PhabricatorSetupCheckTimezone.php', 1211 1212 'PhabricatorSetupIssue' => 'applications/config/issue/PhabricatorSetupIssue.php', 1212 1213 'PhabricatorSetupIssueView' => 'applications/config/view/PhabricatorSetupIssueView.php', ··· 2556 2557 'PhabricatorSetupCheckExtraConfig' => 'PhabricatorSetupCheck', 2557 2558 'PhabricatorSetupCheckInvalidConfig' => 'PhabricatorSetupCheck', 2558 2559 'PhabricatorSetupCheckMail' => 'PhabricatorSetupCheck', 2560 + 'PhabricatorSetupCheckStorage' => 'PhabricatorSetupCheck', 2559 2561 'PhabricatorSetupCheckTimezone' => 'PhabricatorSetupCheck', 2560 2562 'PhabricatorSetupIssueView' => 'AphrontView', 2561 2563 'PhabricatorSlowvoteChoice' => 'PhabricatorSlowvoteDAO',
+27
src/applications/config/check/PhabricatorSetupCheckStorage.php
··· 1 + <?php 2 + 3 + final class PhabricatorSetupCheckStorage extends PhabricatorSetupCheck { 4 + 5 + protected function executeChecks() { 6 + $local_key = 'storage.local-disk.path'; 7 + $local_path = PhabricatorEnv::getEnvConfig($local_key); 8 + 9 + if (!Filesystem::pathExists($local_path) || 10 + !is_readable($local_path) || 11 + !is_writable($local_path)) { 12 + 13 + $message = pht( 14 + 'Configured location for storing uploaded files on disk ("%s") does '. 15 + 'not exist, or is not readable or writable. Verify the directory '. 16 + 'exists and is readable and writable by the webserver.', 17 + $local_path); 18 + 19 + $this 20 + ->newIssue('config.storage.local-disk.path') 21 + ->setShortName(pht('Local Disk Storage')) 22 + ->setName(pht('Local Disk Storage Not Readable/Writable')) 23 + ->setMessage($message) 24 + ->addPhabricatorConfig('storage.local-disk.path'); 25 + } 26 + } 27 + }
-33
src/infrastructure/PhabricatorSetup.php
··· 412 412 self::write(" okay 'facebook.application-id' is set.\n"); 413 413 } 414 414 415 - if (!is_string($app_id)) { 416 - self::writeFailure(); 417 - self::write( 418 - "Setup failure! 'facebook.application-id' should be a string."); 419 - return; 420 - } else { 421 - self::write(" okay 'facebook.application-id' is string.\n"); 422 - } 423 - 424 415 if (!$app_secret) { 425 416 self::writeFailure(); 426 417 self::write( ··· 545 536 "fail. Consider raising this to at least {$recommended_minimum}."); 546 537 } else { 547 538 self::write(" okay max_allowed_packet = {$max_allowed_packet}.\n"); 548 - } 549 - 550 - $local_key = 'storage.local-disk.path'; 551 - $local_path = PhabricatorEnv::getEnvConfig($local_key); 552 - if ($local_path) { 553 - if (!Filesystem::pathExists($local_path) || 554 - !is_readable($local_path) || 555 - !is_writable($local_path)) { 556 - self::writeFailure(); 557 - self::write( 558 - "Setup failure! You have configured local disk storage but the ". 559 - "path you specified ('{$local_path}') does not exist or is not ". 560 - "readable or writable.\n"); 561 - if ($open_basedir) { 562 - self::write( 563 - "You have an 'open_basedir' setting -- make sure Phabricator is ". 564 - "allowed to open files in the local storage directory.\n"); 565 - } 566 - return; 567 - } else { 568 - self::write(" okay Local disk storage exists and is writable.\n"); 569 - } 570 - } else { 571 - self::write(" skip Not configured for local disk storage.\n"); 572 539 } 573 540 574 541 self::write("[OKAY] Database and storage configuration OKAY\n");
+11 -20
src/view/page/PhabricatorStandardPageView.php
··· 252 252 // Render the "you have unresolved setup issues..." warning. 253 253 $setup_warning = null; 254 254 if ($user && $user->getIsAdmin()) { 255 - $application = null; 256 - $controller = $this->getController(); 257 - if ($controller) { 258 - $application = $controller->getCurrentApplication(); 259 - } 260 - 261 - // Don't show the banner inside the config application itself. 262 - if (!($application instanceof PhabricatorApplicationConfig)) { 263 - $open = PhabricatorSetupCheck::getOpenSetupIssueCount(); 264 - if ($open) { 265 - $setup_warning = phutil_render_tag( 266 - 'div', 255 + $open = PhabricatorSetupCheck::getOpenSetupIssueCount(); 256 + if ($open) { 257 + $setup_warning = phutil_render_tag( 258 + 'div', 259 + array( 260 + 'class' => 'setup-warning-callout', 261 + ), 262 + phutil_render_tag( 263 + 'a', 267 264 array( 268 - 'class' => 'setup-warning-callout', 265 + 'href' => '/config/issue/', 269 266 ), 270 - phutil_render_tag( 271 - 'a', 272 - array( 273 - 'href' => '/config/issue/', 274 - ), 275 - pht('You have %d unresolved setup issue(s)...', $open))); 276 - } 267 + pht('You have %d unresolved setup issue(s)...', $open))); 277 268 } 278 269 } 279 270