1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 17:54:44 +02:00

Some minor doc tweaks, update $modules->getModuleInfo() method to support returning info for all modules, bump version to 3.0.41

This commit is contained in:
Ryan Cramer
2016-11-18 12:23:27 -05:00
parent a1219e38e9
commit d935e9b699
5 changed files with 40 additions and 10 deletions

View File

@@ -396,13 +396,11 @@ abstract class Fieldtype extends WireData implements Module {
* need to have some text formatting applied to them, like Markdown, SmartyPants, Textile, etc. As a result,
* Fieldtype modules don't need to implement this unless it's applicable.
*
* Fieldtype modules that implement this do not need to call this parent method, as it doesn't do anything.
*
* #pw-group-formatting
*
* @param Page $page
* @param Field $field
* @param string|int|object $value
* @param Page $page Page that the value lives on
* @param Field $field Field that represents the value
* @param string|int|object $value The value to format
* @return mixed
*
*/

View File

@@ -2456,7 +2456,8 @@ class Modules extends WireArray {
* $moduleInfo = $modules->getModuleInfoVerbose('MarkupAdminDataTable');
* ~~~~~
*
* @param string|Module|int $class May be class name, module instance, or module ID
* @param string|Module|int $class May be class name, module instance, or module ID.
* Specify "*" or "all" to retrieve module info for all modules.
* @param array $options Optional options to modify behavior of what gets returned
* - `verbose` (bool): Makes the info also include additional properties (they will be usually blank without this option specified).
* - `noCache` (bool): prevents use of cache to retrieve the module info.
@@ -2544,11 +2545,22 @@ class Modules extends WireArray {
if(!count($info)) $info = $this->getModuleInfoInternal($module);
}
} else if($module == 'PHP' || $module == 'ProcessWire') {
} else if($module == 'PHP' || $module == 'ProcessWire') {
// module is a system
$info = $this->getModuleInfoSystem($module);
$info = $this->getModuleInfoSystem($module);
return array_merge($infoTemplate, $info);
} else if($module === '*' || $module === 'all') {
if(empty($this->moduleInfoCache)) $this->loadModuleInfoCache();
$modulesInfo = $this->moduleInfoCache;
if($options['verbose']) {
if(empty($this->moduleInfoCacheVerbose)) $this->loadModuleInfoCacheVerbose();
foreach($this->moduleInfoCacheVerbose as $moduleID => $moduleInfoVerbose) {
$modulesInfo[$moduleID] = array_merge($modulesInfo[$moduleID], $moduleInfoVerbose);
}
}
return $modulesInfo;
} else {
// module is a class name or ID

View File

@@ -28,7 +28,7 @@ class ProcessWire extends Wire {
const versionMajor = 3;
const versionMinor = 0;
const versionRevision = 40;
const versionRevision = 41;
const versionSuffix = '';
const indexVersion = 300; // required version for index.php file (represented by PROCESSWIRE define)

View File

@@ -3,7 +3,7 @@
/**
* Class AdminThemeDefault
*
* @property string $colors
* @property string $colors Color set being used: "classic", "warm", "modern" or "futura"
*
*/

View File

@@ -15,6 +15,12 @@
class FieldtypeCache extends Fieldtype {
/**
* Get module information
*
* @return array
*
*/
public static function getModuleInfo() {
return array(
'title' => 'Cache',
@@ -99,6 +105,13 @@ class FieldtypeCache extends Fieldtype {
return parent::___savePageField($page, $field);
}
/**
* Get number of pages in the cache
*
* @param Field $field FieldtypeCache field to check
* @return int Number of cached pages
*
*/
public function getNumPagesCached(Field $field) {
$database = $this->wire('database');
$table = $database->escapeTable($field->getTable());
@@ -113,6 +126,13 @@ class FieldtypeCache extends Fieldtype {
return $num;
}
/**
* Regenerate the cache for the given Field
*
* @param Field $field Field of type FieldtypeCache
* @return int Number of pages that were cached
*
*/
protected function regenerateCache(Field $field) {
$numPages = 0;