1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 10:15:28 +02:00

Various minor updates

This commit is contained in:
Ryan Cramer
2019-12-03 08:40:08 -05:00
parent fd89b7cebd
commit 346218a524
5 changed files with 30 additions and 9 deletions

View File

@@ -1315,6 +1315,12 @@ class PagesEditor extends Wire {
$database = $this->wire('database'); $database = $this->wire('database');
$ids = array(); $ids = array();
if($time === 'modified' || $time === 'created' || $time === 'published') {
// time argument was omitted and type supplied here instead
$type = $time;
$time = null;
}
// ensure $col property is created in this method and not copied directly from $type // ensure $col property is created in this method and not copied directly from $type
if($type === 'modified') { if($type === 'modified') {

View File

@@ -24,7 +24,7 @@ require_once(__DIR__ . '/boot.php');
* *
* @method init() * @method init()
* @method ready() * @method ready()
* @method finished() * @method finished(array $data)
* *
* *
*/ */
@@ -113,7 +113,7 @@ class ProcessWire extends Wire {
const statusDownload = 32; const statusDownload = 32;
/** /**
* Status when the request has been fully delivered * Status when the request has been fully delivered (but before a redirect)
* *
* All API variables available * All API variables available
* *
@@ -543,7 +543,7 @@ class ProcessWire extends Wire {
* This also triggers init/ready functions for modules, when applicable. * This also triggers init/ready functions for modules, when applicable.
* *
* @param int $status * @param int $status
* @param array $data Associtaive array of any extra data to pass along to include files as locally scoped vars (3.0.142+) * @param array $data Associative array of any extra data to pass along to include files as locally scoped vars (3.0.142+)
* *
*/ */
public function setStatus($status, array $data = array()) { public function setStatus($status, array $data = array()) {
@@ -567,6 +567,7 @@ class ProcessWire extends Wire {
} }
// set status to config // set status to config
$prevStatus = $this->status;
$this->status = $status; $this->status = $status;
$config->status = $status; $config->status = $status;
@@ -585,7 +586,9 @@ class ProcessWire extends Wire {
if($status == self::statusFinished) { if($status == self::statusFinished) {
// internal finished always runs after any included finished file // internal finished always runs after any included finished file
$this->finished(); $data['prevStatus'] = $prevStatus;
$data['maintenance'] = true;
$this->finished($data);
} else if($status == self::statusReady) { } else if($status == self::statusReady) {
// additional 'admin' or 'site' options for ready status // additional 'admin' or 'site' options for ready status
if(!empty($files['readyAdmin']) && $config->admin === true) { if(!empty($files['readyAdmin']) && $config->admin === true) {
@@ -694,16 +697,27 @@ class ProcessWire extends Wire {
/** /**
* Hookable ready for anyone that wants to hook when the request is finished * Hookable ready for anyone that wants to hook when the request is finished
* *
* @param array $data Additional data for hooks (3.0.147+ only):
* - `maintenance` (bool): Allow maintenance to run? (default=true)
* - `prevStatus` (int): Previous status before finished status (render, download or failed).
* - `redirectUrl` (string): Contains redirect URL only if request ending with redirect (not present otherwise).
* - `redirectType` (int): Contains redirect type 301 or 302, only if requestUrl property is also present.
*
* #pw-hooker * #pw-hooker
* *
*/ */
protected function ___finished() { protected function ___finished(array $data = array()) {
$config = $this->wire('config'); $config = $this->wire('config');
$session = $this->wire('session'); $session = $this->wire('session');
$cache = $this->wire('cache'); $cache = $this->wire('cache');
$profiler = $this->wire('profiler'); $profiler = $this->wire('profiler');
if($data) {} // data for hooks
// if a hook cancelled maintenance then exit early
if(isset($data['maintenance']) && $data['maintenance'] === false) return;
if($session) $session->maintenance(); if($session) $session->maintenance();
if($cache) $cache->maintenance(); if($cache) $cache->maintenance();
if($profiler) $profiler->maintenance(); if($profiler) $profiler->maintenance();

View File

@@ -440,7 +440,7 @@ class Session extends Wire implements \IteratorAggregate {
* *
*/ */
public function get($key, $_key = null) { public function get($key, $_key = null) {
if($key == 'CSRF') { if($key === 'CSRF') {
return $this->CSRF(); return $this->CSRF();
} else if(!is_null($_key)) { } else if(!is_null($_key)) {
// namespace // namespace
@@ -1151,7 +1151,8 @@ class Session extends Wire implements \IteratorAggregate {
if(!strpos($url, 'modal=')) $url .= (strpos($url, '?') !== false ? '&' : '?') . 'modal=1'; if(!strpos($url, 'modal=')) $url .= (strpos($url, '?') !== false ? '&' : '?') . 'modal=1';
} }
} }
$this->wire()->setStatus(ProcessWire::statusFinished); $statusData = array('redirectUrl' => $url, 'redirectType' => ($http301 ? 301 : 302));
$this->wire()->setStatus(ProcessWire::statusFinished, $statusData);
if($http301) header("HTTP/1.1 301 Moved Permanently"); if($http301) header("HTTP/1.1 301 Moved Permanently");
header("Location: $url"); header("Location: $url");
exit(0); exit(0);

View File

@@ -13896,7 +13896,7 @@ a.tooltip:hover {
} }
.ui-menu .ui-menu-item a i.fa { .ui-menu .ui-menu-item a i.fa {
margin-left: -2px; margin-left: -2px;
padding-left: 5px; /*padding-left: 5px;*/
color: #97aab4; color: #97aab4;
} }
.ui-menu .ui-menu-item a.uk-active, .ui-menu .ui-menu-item a.uk-active,

File diff suppressed because one or more lines are too long