mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-08 22:01:03 +01:00
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
This commit is contained in:
parent
14c6df0605
commit
e6b7ad2e00
4 changed files with 81 additions and 77 deletions
|
@ -1205,8 +1205,10 @@ phutil_register_library_map(array(
|
|||
'PhabricatorSetupCheck' => 'applications/config/check/PhabricatorSetupCheck.php',
|
||||
'PhabricatorSetupCheckAPC' => 'applications/config/check/PhabricatorSetupCheckAPC.php',
|
||||
'PhabricatorSetupCheckExtraConfig' => 'applications/config/check/PhabricatorSetupCheckExtraConfig.php',
|
||||
'PhabricatorSetupCheckGD' => 'applications/config/check/PhabricatorSetupCheckGD.php',
|
||||
'PhabricatorSetupCheckInvalidConfig' => 'applications/config/check/PhabricatorSetupCheckInvalidConfig.php',
|
||||
'PhabricatorSetupCheckMail' => 'applications/config/check/PhabricatorSetupCheckMail.php',
|
||||
'PhabricatorSetupCheckMySQL' => 'applications/config/check/PhabricatorSetupCheckMySQL.php',
|
||||
'PhabricatorSetupCheckStorage' => 'applications/config/check/PhabricatorSetupCheckStorage.php',
|
||||
'PhabricatorSetupCheckTimezone' => 'applications/config/check/PhabricatorSetupCheckTimezone.php',
|
||||
'PhabricatorSetupIssue' => 'applications/config/issue/PhabricatorSetupIssue.php',
|
||||
|
@ -2555,8 +2557,10 @@ phutil_register_library_map(array(
|
|||
'PhabricatorSettingsPanelSearchPreferences' => 'PhabricatorSettingsPanel',
|
||||
'PhabricatorSetupCheckAPC' => 'PhabricatorSetupCheck',
|
||||
'PhabricatorSetupCheckExtraConfig' => 'PhabricatorSetupCheck',
|
||||
'PhabricatorSetupCheckGD' => 'PhabricatorSetupCheck',
|
||||
'PhabricatorSetupCheckInvalidConfig' => 'PhabricatorSetupCheck',
|
||||
'PhabricatorSetupCheckMail' => 'PhabricatorSetupCheck',
|
||||
'PhabricatorSetupCheckMySQL' => 'PhabricatorSetupCheck',
|
||||
'PhabricatorSetupCheckStorage' => 'PhabricatorSetupCheck',
|
||||
'PhabricatorSetupCheckTimezone' => 'PhabricatorSetupCheck',
|
||||
'PhabricatorSetupIssueView' => 'AphrontView',
|
||||
|
|
48
src/applications/config/check/PhabricatorSetupCheckGD.php
Normal file
48
src/applications/config/check/PhabricatorSetupCheckGD.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorSetupCheckGD extends PhabricatorSetupCheck {
|
||||
|
||||
protected function executeChecks() {
|
||||
if (!extension_loaded('gd')) {
|
||||
$message = pht(
|
||||
"The 'gd' extension is not installed. Without 'gd', support, ".
|
||||
"Phabricator will not be able to process or resize images ".
|
||||
"(for example, to generate thumbnails). Install or enable 'gd'.");
|
||||
|
||||
$this->newIssue('extension.gd')
|
||||
->setName(pht("Missing 'gd' Extension"))
|
||||
->setMessage($message);
|
||||
} else {
|
||||
$image_type_map = array(
|
||||
'imagecreatefrompng' => 'PNG',
|
||||
'imagecreatefromgif' => 'GIF',
|
||||
'imagecreatefromjpeg' => 'JPEG',
|
||||
);
|
||||
|
||||
$have = array();
|
||||
foreach ($image_type_map as $function => $image_type) {
|
||||
if (function_exists($function)) {
|
||||
$have[] = $image_type;
|
||||
}
|
||||
}
|
||||
|
||||
$missing = array_diff($image_type_map, $have);
|
||||
if ($missing) {
|
||||
$missing = implode(', ', $missing);
|
||||
$have = implode(', ', $have);
|
||||
|
||||
$message = pht(
|
||||
"The 'gd' extension has support for only some image types. ".
|
||||
"Phabricator will be unable to process images of the missing ".
|
||||
"types until you build 'gd' with support for them. ".
|
||||
"Supported types: %s. Missing types: %s.",
|
||||
$have,
|
||||
$missing);
|
||||
|
||||
$this->newIssue('extension.gd.support')
|
||||
->setName(pht("Partial 'gd' Support"))
|
||||
->setMessage($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
src/applications/config/check/PhabricatorSetupCheckMySQL.php
Normal file
29
src/applications/config/check/PhabricatorSetupCheckMySQL.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorSetupCheckMySQL extends PhabricatorSetupCheck {
|
||||
|
||||
protected function executeChecks() {
|
||||
$conn_raw = id(new PhabricatorUser())->establishConnection('w');
|
||||
|
||||
$max_allowed_packet = queryfx_one(
|
||||
$conn_raw,
|
||||
'SHOW VARIABLES LIKE %s',
|
||||
'max_allowed_packet');
|
||||
$max_allowed_packet = idx($max_allowed_packet, 'Value', PHP_INT_MAX);
|
||||
|
||||
$recommended_minimum = 1024 * 1024;
|
||||
if ($max_allowed_packet < $recommended_minimum) {
|
||||
$message = pht(
|
||||
"MySQL is configured with a very small 'max_allowed_packet' (%d), ".
|
||||
"which may cause some large writes to fail. Strongly consider raising ".
|
||||
"this to at least %d in your MySQL configuration.",
|
||||
$max_allowed_packet,
|
||||
$recommended_minimum);
|
||||
|
||||
$this->newIssue('mysql.max_allowed_packet')
|
||||
->setName(pht('Small MySQL "max_allowed_packet"'))
|
||||
->setMessage($message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -361,38 +361,6 @@ final class PhabricatorSetup {
|
|||
self::write("[OKAY] Basic configuration OKAY\n");
|
||||
|
||||
|
||||
$issue_gd_warning = false;
|
||||
self::writeHeader('GD LIBRARY');
|
||||
if (extension_loaded('gd')) {
|
||||
self::write(" okay Extension 'gd' is loaded.\n");
|
||||
$image_type_map = array(
|
||||
'imagepng' => 'PNG',
|
||||
'imagegif' => 'GIF',
|
||||
'imagejpeg' => 'JPEG',
|
||||
);
|
||||
foreach ($image_type_map as $function => $image_type) {
|
||||
if (function_exists($function)) {
|
||||
self::write(" okay Support for '{$image_type}' is available.\n");
|
||||
} else {
|
||||
self::write(" warn Support for '{$image_type}' is not available!\n");
|
||||
$issue_gd_warning = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self::write(" warn Extension 'gd' is not loaded.\n");
|
||||
$issue_gd_warning = true;
|
||||
}
|
||||
|
||||
if ($issue_gd_warning) {
|
||||
self::write(
|
||||
"[WARN] The 'gd' library is missing or lacks full support. ".
|
||||
"Phabricator will not be able to generate image thumbnails without ".
|
||||
"gd.\n");
|
||||
} else {
|
||||
self::write("[OKAY] 'gd' loaded and has full image type support.\n");
|
||||
}
|
||||
|
||||
|
||||
self::writeHeader('FACEBOOK INTEGRATION');
|
||||
$fb_auth = PhabricatorEnv::getEnvConfig('facebook.auth-enabled');
|
||||
if (!$fb_auth) {
|
||||
|
@ -432,14 +400,6 @@ final class PhabricatorSetup {
|
|||
$conn_pass = $conf->getPassword();
|
||||
$conn_host = $conf->getHost();
|
||||
|
||||
$timeout = ini_get('mysql.connect_timeout');
|
||||
if ($timeout > 5) {
|
||||
self::writeNote(
|
||||
"Your MySQL connect timeout is very high ({$timeout} seconds). ".
|
||||
"Consider reducing it to 5 or below by setting ".
|
||||
"'mysql.connect_timeout' in your php.ini.");
|
||||
}
|
||||
|
||||
self::write(" okay Trying to connect to MySQL database ".
|
||||
"{$conn_user}@{$conn_host}...\n");
|
||||
|
||||
|
@ -501,43 +461,6 @@ final class PhabricatorSetup {
|
|||
self::write(" okay Databases have been initialized.\n");
|
||||
}
|
||||
|
||||
$index_min_length = queryfx_one(
|
||||
$conn_raw,
|
||||
'SHOW VARIABLES LIKE %s',
|
||||
'ft_min_word_len');
|
||||
$index_min_length = idx($index_min_length, 'Value', 4);
|
||||
if ($index_min_length >= 4) {
|
||||
self::writeNote(
|
||||
"MySQL is configured with a 'ft_min_word_len' of 4 or greater, which ".
|
||||
"means you will not be able to search for 3-letter terms. Consider ".
|
||||
"setting this in your configuration:\n".
|
||||
"\n".
|
||||
" [mysqld]\n".
|
||||
" ft_min_word_len=3\n".
|
||||
"\n".
|
||||
"Then optionally run:\n".
|
||||
"\n".
|
||||
" REPAIR TABLE {$namespace}_search.search_documentfield QUICK;\n".
|
||||
"\n".
|
||||
"...to reindex existing documents.");
|
||||
}
|
||||
|
||||
$max_allowed_packet = queryfx_one(
|
||||
$conn_raw,
|
||||
'SHOW VARIABLES LIKE %s',
|
||||
'max_allowed_packet');
|
||||
$max_allowed_packet = idx($max_allowed_packet, 'Value', PHP_INT_MAX);
|
||||
|
||||
$recommended_minimum = 1024 * 1024;
|
||||
if ($max_allowed_packet < $recommended_minimum) {
|
||||
self::writeNote(
|
||||
"MySQL is configured with a small 'max_allowed_packet' ".
|
||||
"('{$max_allowed_packet}'), which may cause some large writes to ".
|
||||
"fail. Consider raising this to at least {$recommended_minimum}.");
|
||||
} else {
|
||||
self::write(" okay max_allowed_packet = {$max_allowed_packet}.\n");
|
||||
}
|
||||
|
||||
self::write("[OKAY] Database and storage configuration OKAY\n");
|
||||
|
||||
self::writeHeader('SUCCESS!');
|
||||
|
|
Loading…
Reference in a new issue