Skip to content

Commit 30eba5d

Browse files
committed
update all cache calls to use the new interface
1 parent 0060d89 commit 30eba5d

1 file changed

Lines changed: 17 additions & 19 deletions

File tree

data-sources/datasource.remote.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public function exposeData(&$data)
7070
{
7171

7272
}
73-
74-
/**
73+
74+
/**
7575
* This method is called when their is an http error
7676
* or when content type is unsupported
7777
*
@@ -81,7 +81,7 @@ public function exposeData(&$data)
8181
*/
8282
public function httpError(&$info)
8383
{
84-
84+
8585
}
8686

8787
/*-------------------------------------------------------------------------
@@ -239,7 +239,7 @@ public static function buildCacheID($settings)
239239
*/
240240
public static function buildCacheInformation(XMLElement $wrapper, Cacheable $cache, $cache_id)
241241
{
242-
$cachedData = $cache->check($cache_id);
242+
$cachedData = $cache->read($cache_id);
243243

244244
if (is_array($cachedData) && !empty($cachedData) && (time() < $cachedData['expiry'])) {
245245
$a = Widget::Anchor(__('Clear now'), SYMPHONY_URL . getCurrentPage() . 'clear_cache/');
@@ -269,7 +269,7 @@ public static function buildEditor(XMLElement $wrapper, array &$errors = array()
269269

270270
// If `clear_cache` is set, clear it..
271271
if (isset($cache_id) && in_array('clear_cache', Administration::instance()->Page->getContext())) {
272-
$cache->forceExpiry($cache_id);
272+
$cache->delete($cache_id);
273273
Administration::instance()->Page->pageAlert(
274274
__('Data source cache cleared at %s.', array(Widget::Time()->generate()))
275275
. '<a href="' . SYMPHONY_URL . '/blueprints/datasources/" accesskey="a">'
@@ -652,7 +652,7 @@ public function execute(array &$param_pool = null)
652652
// Check for an existing Cache for this Datasource
653653
$cache_id = self::buildCacheID($this);
654654
$cache = Symphony::ExtensionManager()->getCacheProvider('remotedatasource');
655-
$cachedData = $cache->check($cache_id);
655+
$cachedData = $cache->read($cache_id);
656656
$writeToCache = null;
657657
$isCacheValid = true;
658658
$creation = DateTimeObj::get('c');
@@ -691,7 +691,6 @@ public function execute(array &$param_pool = null)
691691
$writeToCache = false;
692692

693693
$result->setAttribute('valid', 'false');
694-
695694
$this->httpError($info);
696695

697696
// 28 is CURLE_OPERATION_TIMEOUTED
@@ -712,9 +711,9 @@ public function execute(array &$param_pool = null)
712711
}
713712

714713
return $result;
715-
} else if (strlen($data) > 0) {
716714

717-
// Handle where there is `$data`
715+
// Handle where there is `$data`
716+
} else if (strlen($data) > 0) {
718717

719718
// If it's JSON, convert it to XML
720719
if ($this->dsParamFORMAT == 'json') {
@@ -738,12 +737,11 @@ public function execute(array &$param_pool = null)
738737
);
739738
}
740739
} elseif ($this->dsParamFORMAT == 'txt') {
741-
$txtElement = new XMLElement('entry');
742-
$txtElement->setValue(General::wrapInCDATA($data));
743-
$data = $txtElement->generate();
744-
$txtElement = null;
745-
}
746-
else if (!General::validateXML($data, $errors, false, new XsltProcess)) {
740+
$txtElement = new XMLElement('entry');
741+
$txtElement->setValue(General::wrapInCDATA($data));
742+
$data = $txtElement->generate();
743+
$txtElement = null;
744+
} else if (!General::validateXML($data, $errors, false, new XsltProcess)) {
747745
// If the XML doesn't validate..
748746
$writeToCache = false;
749747
}
@@ -759,7 +757,7 @@ public function execute(array &$param_pool = null)
759757
if (strlen(trim($e['message'])) == 0) {
760758
continue;
761759
}
762-
760+
763761
$error->appendChild(new XMLElement('item', General::sanitize($e['message'])));
764762
}
765763

@@ -768,19 +766,19 @@ public function execute(array &$param_pool = null)
768766
return $result;
769767
}
770768
} elseif (strlen($data) == 0) {
771-
769+
772770
// If `$data` is empty, set the `force_empty_result` to true.
773771
$this->_force_empty_result = true;
774772
}
775773
} else {
776-
774+
777775
// Failed to acquire a lock
778776
$result->appendChild(
779777
new XMLElement('error', __('The %s class failed to acquire a lock.', array('<code>Mutex</code>')))
780778
);
781779
}
782780
} else {
783-
781+
784782
// The cache is good, use it!
785783
$data = trim($cachedData['data']);
786784
$creation = DateTimeObj::get('c', $cachedData['creation']);

0 commit comments

Comments
 (0)