@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 `max_allowed_packet` and GD checks to new setup stuff

Summary: These are nonblocking warnings and can move to post-install.

Test Plan: Broke my environment and observed the warnings.

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: aran, asherkin

Maniphest Tasks: T2228

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

+81 -77
+4
src/__phutil_library_map__.php
··· 1205 1205 'PhabricatorSetupCheck' => 'applications/config/check/PhabricatorSetupCheck.php', 1206 1206 'PhabricatorSetupCheckAPC' => 'applications/config/check/PhabricatorSetupCheckAPC.php', 1207 1207 'PhabricatorSetupCheckExtraConfig' => 'applications/config/check/PhabricatorSetupCheckExtraConfig.php', 1208 + 'PhabricatorSetupCheckGD' => 'applications/config/check/PhabricatorSetupCheckGD.php', 1208 1209 'PhabricatorSetupCheckInvalidConfig' => 'applications/config/check/PhabricatorSetupCheckInvalidConfig.php', 1209 1210 'PhabricatorSetupCheckMail' => 'applications/config/check/PhabricatorSetupCheckMail.php', 1211 + 'PhabricatorSetupCheckMySQL' => 'applications/config/check/PhabricatorSetupCheckMySQL.php', 1210 1212 'PhabricatorSetupCheckStorage' => 'applications/config/check/PhabricatorSetupCheckStorage.php', 1211 1213 'PhabricatorSetupCheckTimezone' => 'applications/config/check/PhabricatorSetupCheckTimezone.php', 1212 1214 'PhabricatorSetupIssue' => 'applications/config/issue/PhabricatorSetupIssue.php', ··· 2555 2557 'PhabricatorSettingsPanelSearchPreferences' => 'PhabricatorSettingsPanel', 2556 2558 'PhabricatorSetupCheckAPC' => 'PhabricatorSetupCheck', 2557 2559 'PhabricatorSetupCheckExtraConfig' => 'PhabricatorSetupCheck', 2560 + 'PhabricatorSetupCheckGD' => 'PhabricatorSetupCheck', 2558 2561 'PhabricatorSetupCheckInvalidConfig' => 'PhabricatorSetupCheck', 2559 2562 'PhabricatorSetupCheckMail' => 'PhabricatorSetupCheck', 2563 + 'PhabricatorSetupCheckMySQL' => 'PhabricatorSetupCheck', 2560 2564 'PhabricatorSetupCheckStorage' => 'PhabricatorSetupCheck', 2561 2565 'PhabricatorSetupCheckTimezone' => 'PhabricatorSetupCheck', 2562 2566 'PhabricatorSetupIssueView' => 'AphrontView',
+48
src/applications/config/check/PhabricatorSetupCheckGD.php
··· 1 + <?php 2 + 3 + final class PhabricatorSetupCheckGD extends PhabricatorSetupCheck { 4 + 5 + protected function executeChecks() { 6 + if (!extension_loaded('gd')) { 7 + $message = pht( 8 + "The 'gd' extension is not installed. Without 'gd', support, ". 9 + "Phabricator will not be able to process or resize images ". 10 + "(for example, to generate thumbnails). Install or enable 'gd'."); 11 + 12 + $this->newIssue('extension.gd') 13 + ->setName(pht("Missing 'gd' Extension")) 14 + ->setMessage($message); 15 + } else { 16 + $image_type_map = array( 17 + 'imagecreatefrompng' => 'PNG', 18 + 'imagecreatefromgif' => 'GIF', 19 + 'imagecreatefromjpeg' => 'JPEG', 20 + ); 21 + 22 + $have = array(); 23 + foreach ($image_type_map as $function => $image_type) { 24 + if (function_exists($function)) { 25 + $have[] = $image_type; 26 + } 27 + } 28 + 29 + $missing = array_diff($image_type_map, $have); 30 + if ($missing) { 31 + $missing = implode(', ', $missing); 32 + $have = implode(', ', $have); 33 + 34 + $message = pht( 35 + "The 'gd' extension has support for only some image types. ". 36 + "Phabricator will be unable to process images of the missing ". 37 + "types until you build 'gd' with support for them. ". 38 + "Supported types: %s. Missing types: %s.", 39 + $have, 40 + $missing); 41 + 42 + $this->newIssue('extension.gd.support') 43 + ->setName(pht("Partial 'gd' Support")) 44 + ->setMessage($message); 45 + } 46 + } 47 + } 48 + }
+29
src/applications/config/check/PhabricatorSetupCheckMySQL.php
··· 1 + <?php 2 + 3 + final class PhabricatorSetupCheckMySQL extends PhabricatorSetupCheck { 4 + 5 + protected function executeChecks() { 6 + $conn_raw = id(new PhabricatorUser())->establishConnection('w'); 7 + 8 + $max_allowed_packet = queryfx_one( 9 + $conn_raw, 10 + 'SHOW VARIABLES LIKE %s', 11 + 'max_allowed_packet'); 12 + $max_allowed_packet = idx($max_allowed_packet, 'Value', PHP_INT_MAX); 13 + 14 + $recommended_minimum = 1024 * 1024; 15 + if ($max_allowed_packet < $recommended_minimum) { 16 + $message = pht( 17 + "MySQL is configured with a very small 'max_allowed_packet' (%d), ". 18 + "which may cause some large writes to fail. Strongly consider raising ". 19 + "this to at least %d in your MySQL configuration.", 20 + $max_allowed_packet, 21 + $recommended_minimum); 22 + 23 + $this->newIssue('mysql.max_allowed_packet') 24 + ->setName(pht('Small MySQL "max_allowed_packet"')) 25 + ->setMessage($message); 26 + } 27 + } 28 + 29 + }
-77
src/infrastructure/PhabricatorSetup.php
··· 361 361 self::write("[OKAY] Basic configuration OKAY\n"); 362 362 363 363 364 - $issue_gd_warning = false; 365 - self::writeHeader('GD LIBRARY'); 366 - if (extension_loaded('gd')) { 367 - self::write(" okay Extension 'gd' is loaded.\n"); 368 - $image_type_map = array( 369 - 'imagepng' => 'PNG', 370 - 'imagegif' => 'GIF', 371 - 'imagejpeg' => 'JPEG', 372 - ); 373 - foreach ($image_type_map as $function => $image_type) { 374 - if (function_exists($function)) { 375 - self::write(" okay Support for '{$image_type}' is available.\n"); 376 - } else { 377 - self::write(" warn Support for '{$image_type}' is not available!\n"); 378 - $issue_gd_warning = true; 379 - } 380 - } 381 - } else { 382 - self::write(" warn Extension 'gd' is not loaded.\n"); 383 - $issue_gd_warning = true; 384 - } 385 - 386 - if ($issue_gd_warning) { 387 - self::write( 388 - "[WARN] The 'gd' library is missing or lacks full support. ". 389 - "Phabricator will not be able to generate image thumbnails without ". 390 - "gd.\n"); 391 - } else { 392 - self::write("[OKAY] 'gd' loaded and has full image type support.\n"); 393 - } 394 - 395 - 396 364 self::writeHeader('FACEBOOK INTEGRATION'); 397 365 $fb_auth = PhabricatorEnv::getEnvConfig('facebook.auth-enabled'); 398 366 if (!$fb_auth) { ··· 432 400 $conn_pass = $conf->getPassword(); 433 401 $conn_host = $conf->getHost(); 434 402 435 - $timeout = ini_get('mysql.connect_timeout'); 436 - if ($timeout > 5) { 437 - self::writeNote( 438 - "Your MySQL connect timeout is very high ({$timeout} seconds). ". 439 - "Consider reducing it to 5 or below by setting ". 440 - "'mysql.connect_timeout' in your php.ini."); 441 - } 442 - 443 403 self::write(" okay Trying to connect to MySQL database ". 444 404 "{$conn_user}@{$conn_host}...\n"); 445 405 ··· 499 459 return; 500 460 } else { 501 461 self::write(" okay Databases have been initialized.\n"); 502 - } 503 - 504 - $index_min_length = queryfx_one( 505 - $conn_raw, 506 - 'SHOW VARIABLES LIKE %s', 507 - 'ft_min_word_len'); 508 - $index_min_length = idx($index_min_length, 'Value', 4); 509 - if ($index_min_length >= 4) { 510 - self::writeNote( 511 - "MySQL is configured with a 'ft_min_word_len' of 4 or greater, which ". 512 - "means you will not be able to search for 3-letter terms. Consider ". 513 - "setting this in your configuration:\n". 514 - "\n". 515 - " [mysqld]\n". 516 - " ft_min_word_len=3\n". 517 - "\n". 518 - "Then optionally run:\n". 519 - "\n". 520 - " REPAIR TABLE {$namespace}_search.search_documentfield QUICK;\n". 521 - "\n". 522 - "...to reindex existing documents."); 523 - } 524 - 525 - $max_allowed_packet = queryfx_one( 526 - $conn_raw, 527 - 'SHOW VARIABLES LIKE %s', 528 - 'max_allowed_packet'); 529 - $max_allowed_packet = idx($max_allowed_packet, 'Value', PHP_INT_MAX); 530 - 531 - $recommended_minimum = 1024 * 1024; 532 - if ($max_allowed_packet < $recommended_minimum) { 533 - self::writeNote( 534 - "MySQL is configured with a small 'max_allowed_packet' ". 535 - "('{$max_allowed_packet}'), which may cause some large writes to ". 536 - "fail. Consider raising this to at least {$recommended_minimum}."); 537 - } else { 538 - self::write(" okay max_allowed_packet = {$max_allowed_packet}.\n"); 539 462 } 540 463 541 464 self::write("[OKAY] Database and storage configuration OKAY\n");