@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.

Add a setup warning for major clock skew issues

Summary: See IRC. A user had a database set to 8 hours ahead of their web host. Try to catch and warn about these issues.

Test Plan: Artificially adjusted skew, saw setup warning.

Reviewers: avivey, chad

Reviewed By: chad

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

+25 -1
+25 -1
src/applications/config/check/PhabricatorMySQLSetupCheck.php
··· 319 319 ->addMySQLConfig('innodb_buffer_pool_size'); 320 320 } 321 321 322 + $conn_w = id(new PhabricatorUser())->establishConnection('w'); 323 + 322 324 $ok = PhabricatorStorageManagementAPI::isCharacterSetAvailableOnConnection( 323 325 'utf8mb4', 324 - id(new PhabricatorUser())->establishConnection('w')); 326 + $conn_w); 325 327 if (!$ok) { 326 328 $summary = pht( 327 329 'You are using an old version of MySQL, and should upgrade.'); ··· 337 339 ->setName(pht('Old MySQL Version')) 338 340 ->setSummary($summary) 339 341 ->setMessage($message); 342 + } 343 + 344 + $info = queryfx_one( 345 + $conn_w, 346 + 'SELECT UNIX_TIMESTAMP() epoch'); 347 + 348 + $epoch = (int)$info['epoch']; 349 + $local = PhabricatorTime::getNow(); 350 + $delta = (int)abs($local - $epoch); 351 + if ($delta > 60) { 352 + $this->newIssue('mysql.clock') 353 + ->setName(pht('Major Web/Database Clock Skew')) 354 + ->setSummary( 355 + pht( 356 + 'This host is set to a very different time than the database.')) 357 + ->setMessage( 358 + pht( 359 + 'The database host and this host ("%s") disagree on the current '. 360 + 'time by more than 60 seconds (absolute skew is %s seconds). '. 361 + 'Check that the current time is set correctly everywhere.', 362 + php_uname('n'), 363 + new PhutilNumber($delta))); 340 364 } 341 365 342 366 }