Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/feed/storage/story/PhabricatorFeedStoryData.php b/src/applications/feed/storage/story/PhabricatorFeedStoryData.php
index 0050a9ffd7..36519fe56a 100644
--- a/src/applications/feed/storage/story/PhabricatorFeedStoryData.php
+++ b/src/applications/feed/storage/story/PhabricatorFeedStoryData.php
@@ -1,50 +1,70 @@
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorFeedStoryData extends PhabricatorFeedDAO {
protected $phid;
protected $storyType;
protected $storyData;
protected $authorPHID;
protected $chronologicalKey;
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_SERIALIZATION => array(
'storyData' => self::SERIALIZATION_JSON,
),
) + parent::getConfiguration();
}
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_STRY);
}
public function getEpoch() {
- return $this->chronologicalKey >> 32;
+ if (PHP_INT_SIZE < 8) {
+ // We're on a 32-bit machine.
+ if (function_exists('bcadd')) {
+ // Try to use the 'bc' extension.
+ return bcdiv($this->chronologicalKey, bcpow(2,32));
+ } else {
+ // Do the math in MySQL. TODO: If we formalize a bc dependency, get
+ // rid of this.
+ // See: PhabricatorFeedStoryPublisher::generateChronologicalKey()
+ $conn_r = id($this->establishConnection('r'));
+ $result = queryfx_one(
+ $conn_r,
+ // Insert the chronologicalKey as a string since longs don't seem to
+ // be supported by qsprintf and ints get maxed on 32 bit machines.
+ 'SELECT (%s >> 32) as N',
+ $this->chronologicalKey);
+ return $result['N'];
+ }
+ } else {
+ return $this->chronologicalKey >> 32;
+ }
}
public function getValue($key, $default = null) {
return idx($this->storyData, $key, $default);
}
}
diff --git a/src/applications/feed/storage/story/__init__.php b/src/applications/feed/storage/story/__init__.php
index 831e139d30..8e4defec91 100644
--- a/src/applications/feed/storage/story/__init__.php
+++ b/src/applications/feed/storage/story/__init__.php
@@ -1,16 +1,17 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/feed/storage/base');
phutil_require_module('phabricator', 'applications/phid/constants');
phutil_require_module('phabricator', 'applications/phid/storage/phid');
+phutil_require_module('phabricator', 'storage/queryfx');
phutil_require_module('phutil', 'utils');
phutil_require_source('PhabricatorFeedStoryData.php');

File Metadata

Mime Type
text/x-diff
Expires
Sat, Sep 20, 8:09 AM (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
241542
Default Alt Text
(3 KB)

Event Timeline