1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-21 14:02:59 +02:00

Fix issue processwire/processwire-issues#320 - MarkupCache, path() method, and WireArray::debugInfo()

This commit is contained in:
Ryan Cramer
2017-07-28 07:10:00 -04:00
parent 52b8389215
commit 71896f463e
2 changed files with 10 additions and 3 deletions

View File

@@ -2322,7 +2322,7 @@ class WireArray extends Wire implements \IteratorAggregate, \ArrayAccess, \Count
$info['items'] = array(); $info['items'] = array();
foreach($this->data as $key => $value) { foreach($this->data as $key => $value) {
if(is_object($value)) { if(is_object($value)) {
if(method_exists($value, 'path')) { if($value instanceof Page) {
$value = '/' . ltrim($value->path(), '/'); $value = '/' . ltrim($value->path(), '/');
} else if($value instanceof WireData) { } else if($value instanceof WireData) {
$_value = $value; $_value = $value;

View File

@@ -49,6 +49,8 @@ class MarkupCache extends Wire implements Module, ConfigurableModule {
/** /**
* Instance of CacheFile * Instance of CacheFile
* *
* @var CacheFile
*
*/ */
protected $cache = null; protected $cache = null;
@@ -75,7 +77,7 @@ class MarkupCache extends Wire implements Module, ConfigurableModule {
* Generate the module's path, static so it can be used by the static getModuleConfigInputfields function * Generate the module's path, static so it can be used by the static getModuleConfigInputfields function
* *
*/ */
protected function path() { public function path() {
return $this->wire('config')->paths->cache . 'MarkupCache' . '/'; return $this->wire('config')->paths->cache . 'MarkupCache' . '/';
} }
@@ -93,7 +95,8 @@ class MarkupCache extends Wire implements Module, ConfigurableModule {
* *
* @param string $uniqueName A unique string or number to identify this cache, i.e. 'citiesList' * @param string $uniqueName A unique string or number to identify this cache, i.e. 'citiesList'
* @param int $seconds The number of seconds the cache should live. * @param int $seconds The number of seconds the cache should live.
* @return Returns the cache data, or FALSE if it has expired and needs to be re-created. * @return string|bool Returns the cache data, or FALSE if it has expired and needs to be re-created.
* @throws WireException
* *
*/ */
public function get($uniqueName, $seconds = 3600) { public function get($uniqueName, $seconds = 3600) {
@@ -110,6 +113,7 @@ class MarkupCache extends Wire implements Module, ConfigurableModule {
* *
* @param string $data Data to cache * @param string $data Data to cache
* @return int Number of bytes written to cache, or FALSE on failure. * @return int Number of bytes written to cache, or FALSE on failure.
* @throws WireException
* *
*/ */
public function save($data) { public function save($data) {
@@ -165,6 +169,9 @@ class MarkupCache extends Wire implements Module, ConfigurableModule {
/** /**
* Provide cache clearing capability in the module's configuration * Provide cache clearing capability in the module's configuration
* *
* @param array $data
* @return InputfieldWrapper
*
*/ */
public function getModuleConfigInputfields(array $data) { public function getModuleConfigInputfields(array $data) {