diff --git a/wire/core/Field.php b/wire/core/Field.php
index 6c43e848..016d1fc3 100644
--- a/wire/core/Field.php
+++ b/wire/core/Field.php
@@ -7,6 +7,8 @@
* and is managed by the 'Fields' class.
*
* #pw-summary Field represents a custom field that is used on a Page.
+ * #pw-var $field
+ * #pw-instantiate $field = $fields->get('field_name');
* #pw-body Field objects are managed by the `$fields` API variable.
* #pw-use-constants
*
@@ -31,10 +33,10 @@
* @property int|null $paginationLimit Used by paginated WireArray values to indicate limit to use during load. #pw-internal
*
* Common Inputfield properties that Field objects store:
- * @property int|bool|null $required
- * @property string|null $requiredIf
- * @property string|null $showIf
- * @property int|null $columnWidth
+ * @property int|bool|null $required Whether or not this field is required during input #pw-group-properties
+ * @property string|null $requiredIf A selector-style string that defines the conditions under which input is required #pw-group-properties
+ * @property string|null $showIf A selector-style string that defines the conditions under which the Inputfield is shown #pw-group-properties
+ * @property int|null $columnWidth The Inputfield column width (percent) 10-100. #pw-group-properties
*
* @method bool viewable(Page $page = null, User $user = null) Is the field viewable on the given $page by the given $user? #pw-group-access
* @method bool editable(Page $page = null, User $user = null) Is the field editable on the given $page by the given $user? #pw-group-access
@@ -1003,6 +1005,8 @@ class Field extends WireData implements Saveable, Exportable {
/**
* Set an override table name, or omit (or null) to restore default table name
*
+ * #pw-group-advanced
+ *
* @param null|string $table
*
*/
diff --git a/wire/core/HookEvent.php b/wire/core/HookEvent.php
index a4c4bf54..04c23cbb 100644
--- a/wire/core/HookEvent.php
+++ b/wire/core/HookEvent.php
@@ -9,6 +9,7 @@
* Instances of HookEvent are passed to Hook handlers when their requested method has been called.
*
* #pw-summary HookEvent is a type provided to hook functions with information about the event.
+ * #pw-var $event
* #pw-body =
* ~~~~~~
* // Example
diff --git a/wire/core/Modules.php b/wire/core/Modules.php
index 41da080f..d2504aa5 100644
--- a/wire/core/Modules.php
+++ b/wire/core/Modules.php
@@ -14,6 +14,17 @@
* https://processwire.com
*
* #pw-summary Loads and manages all modules in ProcessWire.
+ * #pw-body =
+ * The `$modules` API variable is most commonly used for getting individual modules to use their API.
+ * ~~~~~
+ * // Getting a module by name
+ * $m = $modules->get('MarkupPagerNav');
+ *
+ * // Getting a module by name (alternate)
+ * $m = $modules->MarkupPagerNav;
+ * ~~~~~
+ *
+ * #pw-body
*
* @todo Move all module information methods to a ModulesInfo class
* @todo Move all module loading methods to a ModulesLoad class
@@ -1156,7 +1167,7 @@ class Modules extends WireArray {
* Get the requested Module (with options)
*
* This is the same as `$modules->get()` except that you can specify additional options to modify default behavior.
- * These are the options you can speicfy in the `$options` array argument:
+ * These are the options you can specify in the `$options` array argument:
*
* - `noPermissionCheck` (bool): Specify true to disable module permission checks (and resulting exception).
* - `noInstall` (bool): Specify true to prevent a non-installed module from installing from this request.
@@ -4717,6 +4728,8 @@ class Modules extends WireArray {
/**
* Compile and return the given file for module, if allowed to do so
*
+ * #pw-internal
+ *
* @param Module|string $moduleName
* @param string $file Optionally specify the module filename as an optimization
* @param string|null $namespace Optionally specify namespace as an optimization
diff --git a/wire/core/ProcessWire.php b/wire/core/ProcessWire.php
index 94bb610c..bfa37303 100644
--- a/wire/core/ProcessWire.php
+++ b/wire/core/ProcessWire.php
@@ -45,7 +45,7 @@ class ProcessWire extends Wire {
* Reversion revision number
*
*/
- const versionRevision = 41;
+ const versionRevision = 42;
/**
* Version suffix string (when applicable)
diff --git a/wire/core/WireCache.php b/wire/core/WireCache.php
index c87ab615..53e95d96 100644
--- a/wire/core/WireCache.php
+++ b/wire/core/WireCache.php
@@ -375,6 +375,8 @@ class WireCache extends Wire {
$data = json_encode($data);
if($data === false) throw new WireException("Unable to encode array data for cache: $name");
}
+
+ if(is_null($data)) $data = '';
$sql =
'INSERT INTO caches (`name`, `data`, `expires`) VALUES(:name, :data, :expires) ' .
diff --git a/wire/core/WireDatabaseBackup.php b/wire/core/WireDatabaseBackup.php
index 51b8363a..6e5419e0 100644
--- a/wire/core/WireDatabaseBackup.php
+++ b/wire/core/WireDatabaseBackup.php
@@ -2,20 +2,18 @@
/**
* #pw-summary ProcessWire Database Backup and Restore
+ * #pw-summary-initialization It’s not typically necessary to call these initialization methods unless doing manual initialization.
+ * #pw-var $backup
+ * #pw-instantiate $backup = $database->backup();
+ * #pw-order-groups actions,reporting,initialization,advanced
* #pw-body =
* This class intentionally does not have any external dependencies (other than PDO)
* so that it can be included by outside tools for restoring/exporting, with the main
* example of that being the ProcessWire installer.
*
* The recommended way to access these backup methods is via the `$database` API variable
- * method `$database->backups()`, which returns a `WireDatabaseBackup` instance.
- *
- * ### Easy Initialization (recommended)
- * ~~~~~
- * $backup = $database->backups();
- * ~~~~~
- *
- * ### Manual Initialization (if you need it)
+ * method `$database->backups()`, which returns a `WireDatabaseBackup` instance, however
+ * you can also initialize the class manually if you prefer, like this:
* ~~~~~
* // determine where backups will go (should NOT be web accessible)
* $backupPath = $config->paths->assets . 'backups/';
@@ -32,25 +30,21 @@
* ~~~~~
* ### Backup the database
* ~~~~~
- * $options = array(); // optional
- * $file = $backup->backup($options);
+ * $file = $backup->backup();
* if($file) {
- * print_r($backup->notes());
+ * echo "Backed up to: $file";
* } else {
- * print_r($backup->errors());
+ * echo "Backup failed: " . implode("
", $backup->errors());
* }
* ~~~~~
- * Note: the `print_r()` function calls are just for demonstration and testing purposes. We are not suggesting
- * you actually do that except when testing.
*
* ### Restore a database
* ~~~~~
- * $options = array(); // optional
- * $success = $backup->restore($file, $options);
+ * $success = $backup->restore($file);
* if($success) {
- * print_r($backup->notes());
+ * echo "Restored database from file: $file";
* } else {
- * print_r($backup->errors());
+ * echo "Restore failed: " . implode("
", $backup->errors());
* }
* ~~~~~
* #pw-body
@@ -269,7 +263,9 @@ class WireDatabaseBackup {
* You should follow-up the construct call with one or both of the following:
*
* - $backups->setDatabase(PDO|WireDatabasePDO);
- * - $backups->setDatabaseConfig(array|object);
+ * - $backups->setDatabaseConfig(array|object);
+ *
+ * #pw-group-initialization
*
* @param string $path Path where database files are stored
* @throws \Exception
@@ -282,6 +278,8 @@ class WireDatabaseBackup {
/**
* Set the current ProcessWire instance
*
+ * #pw-internal
+ *
* @param ProcessWire $wire
*
*/
@@ -292,8 +290,16 @@ class WireDatabaseBackup {
/**
* Set the database configuration information
*
- * @param array|object $config Containing these properties: dbUser, dbHost, dbPort, dbName,
- * and optionally: dbPass, dbPath, dbCharset
+ * #pw-group-initialization
+ *
+ * @param array|Config|object $config Containing these properties:
+ * - dbUser
+ * - dbHost
+ * - dbPort
+ * - dbName
+ * - dbPass
+ * - dbPath (optional)
+ * - dbCharset (optional)
* @return $this
* @throws \Exception if missing required config settings
*
@@ -329,7 +335,9 @@ class WireDatabaseBackup {
}
/**
- * Set the database connection
+ * Set the PDO database connection
+ *
+ * #pw-group-initialization
*
* @param \PDO|WireDatabasePDO $database
* @throws \PDOException on invalid connection
@@ -346,6 +354,8 @@ class WireDatabaseBackup {
/**
* Get current database connection, initiating the connection if not yet active
*
+ * #pw-advanced
+ *
* @return null|\PDO|WireDatabasePDO
* @throws \Exception
*
@@ -377,6 +387,8 @@ class WireDatabaseBackup {
/**
* Add an error and return last error
*
+ * #pw-group-reporting
+ *
* @param string $str If omitted, no error is added
* @return string
*
@@ -389,6 +401,8 @@ class WireDatabaseBackup {
/**
* Return all error messages that occurred
*
+ * #pw-group-reporting
+ *
* @param bool $reset Specify true to clear out existing errors or omit just to return error messages
* @return array
*
@@ -401,6 +415,8 @@ class WireDatabaseBackup {
/**
* Record a note
+ *
+ * #pw-group-reporting
*
* @param $key
* @param $value
@@ -413,6 +429,8 @@ class WireDatabaseBackup {
/**
* Get all notes
+ *
+ * #pw-group-reporting
*
* @param bool $reset
* @return array
@@ -427,6 +445,8 @@ class WireDatabaseBackup {
/**
* Set path where database files are stored
*
+ * #pw-group-initialization
+ *
* @param string $path
* @return $this
* @throws \Exception if path has a problem
@@ -439,7 +459,15 @@ class WireDatabaseBackup {
$this->path = $path;
return $this;
}
-
+
+ /**
+ * Get path where database files are stored
+ *
+ * #pw-group-reporting
+ *
+ * @return string
+ *
+ */
public function getPath() {
return $this->path;
}
@@ -448,6 +476,8 @@ class WireDatabaseBackup {
* Return array of all backup files
*
* To get additional info on any of them, call getFileInfo($basename) method
+ *
+ * #pw-group-reporting
*
* @return array of strings (basenames)
*
@@ -467,8 +497,10 @@ class WireDatabaseBackup {
/**
* Get information about a backup file
+ *
+ * #pw-group-reporting
*
- * @param $filename
+ * @param string $filename
* @return array Returns associative array of information on success, empty array on failure
*
*/
@@ -534,6 +566,8 @@ class WireDatabaseBackup {
/**
* Get array of all table names
+ *
+ * #pw-group-reporting
*
* @param bool $count If true, returns array will be indexed by name and include count of records as value
* @param bool $cache Allow use of cache?
@@ -576,6 +610,8 @@ class WireDatabaseBackup {
/**
* Perform a database export/dump
*
+ * #pw-group-actions
+ *
* @param array $options Options to modify default behavior:
* - `filename` (string): filename for backup: default is to make a dated filename, but this can also be used (basename only, no path)
* - `description` (string): optional description of this backup
@@ -640,7 +676,16 @@ class WireDatabaseBackup {
return $success ? $file : false;
}
-
+
+ /**
+ * Set backup options
+ *
+ * #pw-internal
+ *
+ * @param array $options
+ * @return $this
+ *
+ */
public function setBackupOptions(array $options) {
$this->backupOptions = array_merge($this->backupOptions, $options);
return $this;
@@ -869,7 +914,13 @@ class WireDatabaseBackup {
/**
- * Import a database SQL file that was created by this class
+ * Restore/import a MySQL database dump file
+ *
+ * This method is designed to restore dump files created by the backup() method of this
+ * class, however it *may* also work with dump files created from other sources like
+ * mysqldump or PhpMyAdmin.
+ *
+ * #pw-group-actions
*
* @param string $filename Filename to restore, optionally including path (if no path, then path set to construct is assumed)
* @param array $options Options to modify default behavior:
@@ -909,7 +960,16 @@ class WireDatabaseBackup {
return $success;
}
-
+
+ /**
+ * Set restore options
+ *
+ * #pw-internal
+ *
+ * @param array $options
+ * @return $this
+ *
+ */
public function setRestoreOptions(array $options) {
$this->restoreOptions = array_merge($this->restoreOptions, $options);
return $this;
@@ -1049,6 +1109,8 @@ class WireDatabaseBackup {
*
* This method assumes both files follow the SQL dump format created by this class.
*
+ * #pw-advanced
+ *
* @param string $filename1 Original filename
* @param string $filename2 Filename that may have statements that will update/override those in filename1
* @param array $options
@@ -1143,6 +1205,8 @@ class WireDatabaseBackup {
/**
* Returns array of all create table statements, indexed by table name
*
+ * #pw-internal
+ *
* @param string $filename to extract all CREATE TABLE statements from
* @param array $options
* @return bool|array of CREATE TABLE statements, associative: indexed by table name
@@ -1165,7 +1229,9 @@ class WireDatabaseBackup {
}
/**
- * Returns array of all INSERT statements, indexed by table name
+ * Returns array of all INSERT statements in given filename, indexed by table name
+ *
+ * #pw-internal
*
* @param string $filename to extract all CREATE TABLE statements from
* @return array of arrays of INSERT statements. Base array is associative indexed by table name.
diff --git a/wire/core/WireHttp.php b/wire/core/WireHttp.php
index 9976aa83..dd6855a9 100644
--- a/wire/core/WireHttp.php
+++ b/wire/core/WireHttp.php
@@ -6,9 +6,11 @@
* Provides capability for sending POST/GET requests to URLs
*
* #pw-summary WireHttp enables you to send HTTP requests to URLs, download files, and more.
+ * #pw-var $http
+ * #pw-instantiate $http = new WireHttp();
* #pw-body =
* ~~~~~
- * $http = new WireHttp();
+ * // Get the contents of a URL
* $response = $http->get("http://domain.com/path/");
* if($response !== false) {
* echo "Successful response: " . $sanitizer->entities($response);
@@ -899,7 +901,7 @@ class WireHttp extends Wire {
* - `content-type`: {content-type} (replaced with actual content type)
* - `content-transfer-encoding`: binary
* - `content-length`: {filesize} (replaced with actual filesize)
- * - To remove a header completely, make its value NULL and it won't be sent.
+ * - To remove a header completely, make its value NULL and it won't be sent.
* @throws WireException
*
*/
diff --git a/wire/core/WireInput.php b/wire/core/WireInput.php
index 910d2300..63e0bd48 100644
--- a/wire/core/WireInput.php
+++ b/wire/core/WireInput.php
@@ -586,7 +586,16 @@ class WireInput extends Wire {
}
/**
- * Return the current request method (i.e. GET, POST) or blank if not known
+ * Return the current request method (i.e. GET, POST, etc.) or blank if not known
+ *
+ * Possible return values are:
+ * - GET
+ * - POST
+ * - HEAD
+ * - PUT
+ * - DELETE
+ * - OPTIONS
+ * - or blank if not known
*
* @return string
* @since 3.0.39
diff --git a/wire/core/WireMail.php b/wire/core/WireMail.php
index 05a76932..944d4b00 100644
--- a/wire/core/WireMail.php
+++ b/wire/core/WireMail.php
@@ -1,37 +1,54 @@
to('user@domain.com')->from('you@company.com')->subject('Message Subject')->body('Message Body')->send();
+ * #pw-summary A module type that handles sending of email in ProcessWire
+ * #pw-var $m
+ * #pw-body =
+ *
+ * Below are 3 different ways you can get a new instance of WireMail.
+ * When possible we recommend using option A or B below.
+ * ~~~~~
+ * $m = $mail->new(); // option A
+ * $m = wireMail(); // option B
+ * $m = new WireMail(); // option C
+ * ~~~~~
+ * Once you have an instance of WireMail (`$m`), you can use it to send email like in these examples below.
+ * ~~~~~
+ * // chained (fluent) method call usage
+ * $m->to('user@domain.com')
+ * ->from('you@company.com')
+ * ->subject('Message Subject')
+ * ->body('Message Body')
+ * ->send();
*
* // separate method call usage
- * $mail->to('user@domain.com'); // specify CSV string or array for multiple addresses
- * $mail->from('you@company.com');
- * $mail->subject('Message Subject');
- * $mail->body('Message Body');
- * $mail->send();
+ * $m->to('user@domain.com'); // specify CSV string or array for multiple addresses
+ * $m->from('you@company.com');
+ * $m->subject('Message Subject');
+ * $m->body('Message Body');
+ * $m->send();
*
- * // you can also set values without function calls:
- * $mail->to = 'user@domain.com';
- * $mail->from = 'you@company.com';
- * ...and so on.
+ * // optionally specify “from” or “to” names as 2nd argument
+ * $m->to('user@domain.com', 'John Smith');
+ * $m->from('you@company.com', 'Mary Jane');
*
* // other methods or properties you might set (or get)
- * $mail->bodyHTML('