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

Various minor adjustments

This commit is contained in:
Ryan Cramer
2018-02-23 10:36:15 -05:00
parent 053ef62970
commit 919c475631
4 changed files with 31 additions and 6 deletions

View File

@@ -497,7 +497,7 @@ class Pagefile extends WireData {
break;
case 'URL':
// nocache url
$value = $this->url() . '?nc=' . @filemtime($this->filename());
$value = $this->noCacheURL();
break;
case 'pagefiles':
$value = $this->pagefiles;
@@ -528,6 +528,18 @@ class Pagefile extends WireData {
return $value;
}
/**
* Hookable no-cache URL
*
* #pw-internal
*
* @return string
*
*/
protected function ___noCacheURL() {
return $this->url() . '?nc=' . @filemtime($this->filename());
}
/**
* Return the next sibling Pagefile in the parent Pagefiles, or NULL if at the end.
*

View File

@@ -90,6 +90,7 @@ class FieldtypeImage extends FieldtypeFile {
}
$variations = array();
foreach($img->getVariations() as $variation) {
/** @var Pageimage $variation */
$variations[$variation->name] = $variation->httpUrl();
}
$value[$k]['variations'] = $variations;

View File

@@ -599,9 +599,18 @@ class FieldtypePage extends FieldtypeMulti implements Module, ConfigurableModule
if(InputfieldPage::isValidPage($value, $field, $forPage)) {
$valid = true;
} else {
$valid = false;
$reason = $forPage->get("_isValidPage");
if($throwException) throw new WireException("Page $value is not valid for $field->name ($reason)");
$n = 0;
while(wireInstanceOf($forPage, 'RepeaterPage') && ++$n < 10) {
/** @var RepeaterPage $forPage */
$forPage = $forPage->getForPage();
}
if($n && InputfieldPage::isValidPage($value, $field, $forPage)) {
$valid = true;
} else {
$valid = false;
$reason = $forPage->get("_isValidPage");
if($throwException) throw new WireException("Page $value is not valid for $field->name ($reason)");
}
}
return $valid;

View File

@@ -86,7 +86,7 @@ class SessionHandlerDB extends WireSessionHandler implements Module, Configurabl
* Write the given $data for the given session ID
*
* @param string $id Session ID
* @param string Serialized data to write
* @param string $data Serialized data to write
* @return bool
*
*/
@@ -203,6 +203,9 @@ class SessionHandlerDB extends WireSessionHandler implements Module, Configurabl
/**
* Session configuration options
*
* @param array $data
* @return InputfieldWrapper
*
*/
public function getModuleConfigInputfields(array $data) {
@@ -254,6 +257,7 @@ class SessionHandlerDB extends WireSessionHandler implements Module, Configurabl
*
* @param string $key
* @param mixed $value
* @return void
*
*/
public function __set($key, $value) {
@@ -365,7 +369,6 @@ class SessionHandlerDB extends WireSessionHandler implements Module, Configurabl
$database = $this->wire('database');
$sql = "ALTER TABLE $table MODIFY data MEDIUMTEXT NOT NULL";
$query = $database->prepare($sql);
$success = false;
$query->execute();
$this->message("Updated sessions database for larger data storage", Notice::log);
}