Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/console/DarkConsoleCore.php
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | $storage = array( | ||||
? $request->getUser()->getPHID() | ? $request->getUser()->getPHID() | ||||
: null, | : null, | ||||
); | ); | ||||
$cache = new PhabricatorKeyValueDatabaseCache(); | $cache = new PhabricatorKeyValueDatabaseCache(); | ||||
$cache = new PhutilKeyValueCacheProfiler($cache); | $cache = new PhutilKeyValueCacheProfiler($cache); | ||||
$cache->setProfiler(PhutilServiceProfiler::getInstance()); | $cache->setProfiler(PhutilServiceProfiler::getInstance()); | ||||
// This encoding may fail if there are, e.g., database queries which | |||||
// include binary data. It would be a little cleaner to try to strip these, | |||||
// but just do something non-broken here if we end up with unrepresentable | |||||
// data. | |||||
$json = @json_encode($storage); | |||||
if (!$json) { | |||||
$json = '{}'; | |||||
} | |||||
epriestley: This isn't precisely related, but was triggered during testing. | |||||
$cache->setKeys( | $cache->setKeys( | ||||
array( | array( | ||||
'darkconsole:'.$key => json_encode($storage), | 'darkconsole:'.$key => $json, | ||||
), | ), | ||||
$ttl = (60 * 60 * 6)); | $ttl = (60 * 60 * 6)); | ||||
return $key; | return $key; | ||||
} | } | ||||
public function getColor() { | public function getColor() { | ||||
foreach ($this->getPlugins() as $plugin) { | foreach ($this->getPlugins() as $plugin) { | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |
This isn't precisely related, but was triggered during testing.