mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Use a serialize()-based cache instead of a JSON-based cache for changesets
Summary: These are full of PhutilSafeHTML objects now, which are destroyed by JSON serialization. Test Plan: Dropped cache, then reloaded pages. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4942
This commit is contained in:
parent
262abd39bc
commit
4f42d85c1c
1 changed files with 9 additions and 3 deletions
|
@ -63,7 +63,7 @@ final class DifferentialChangesetParser {
|
|||
return $this->disableCache;
|
||||
}
|
||||
|
||||
const CACHE_VERSION = 10;
|
||||
const CACHE_VERSION = 11;
|
||||
const CACHE_MAX_SIZE = 8e6;
|
||||
|
||||
const ATTR_GENERATED = 'attr:generated';
|
||||
|
@ -270,7 +270,13 @@ final class DifferentialChangesetParser {
|
|||
return false;
|
||||
}
|
||||
|
||||
$data = json_decode($data['cache'], true);
|
||||
if ($data['cache'][0] == '{') {
|
||||
// This is likely an old-style JSON cache which we will not be able to
|
||||
// deserialize.
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = unserialize($data['cache']);
|
||||
if (!is_array($data) || !$data) {
|
||||
return false;
|
||||
}
|
||||
|
@ -340,7 +346,7 @@ final class DifferentialChangesetParser {
|
|||
break;
|
||||
}
|
||||
}
|
||||
$cache = json_encode($cache);
|
||||
$cache = serialize($cache);
|
||||
|
||||
// We don't want to waste too much space by a single changeset.
|
||||
if (strlen($cache) > self::CACHE_MAX_SIZE) {
|
||||
|
|
Loading…
Reference in a new issue