Help:Maintenance script "rebuildConceptCache.php"

Jump to: navigation, search
Allows to rebuild (create, update, and delete) concept caches
Further Information
Provided by: Semantic MediaWiki
Added: 1.9.2
Removed: still in use
Location (path): ./extensions/Semantic­MediaWiki/maintenance/
Class docu: Rebuild­Concept­Cache
Table of Contents

The "rebuildConceptCache.php" maintenance script manages the Concept caching functionality provided by Semantic MediaWiki. The help page on Concept caching provides detailed additional information on how to use this maintenance script.

Important Notes

  • This maintenance script deprecated the former "SMW_conceptCache.php" script starting with Semantic MediaWiki 1.9.2 while options and usage at that time remain the same.
NoteNote:  It is strongly encouraged to make the transition to this new script to take advantage of the new features added since and because the old one will will be removed with the release of Semantic MediaWiki 3.0 in late 2017.
  • If SMW is not installed in its standard path then the "MW_INSTALL_PATH" environment variable must be set. See README in the maintenance directory.


php rebuildConceptCache.php [--status|--create|--delete] [--concept|--hard|--update|--old|-s|-e] [--verbose|--no-cache|--debug|--report-runtime|--with-maintenance-log]
NoteNote: This only shows the script specific parameters.


Generic parameters

Parameter Description
--help (-h) Display this help message
--quiet (-q) Whether to supress non-error output
--conf: Location of "LocalSettings.php", if not default
--wiki For specifying the wiki ID
--globals Output globals at the end of processing for debugging
--memory-limit Set a specific memory limit for the script, "max" for no limit or "default" to avoid changing it
--server: The protocol and server name to use in URLs, e.g. This is sometimes necessary because server name detection may fail in command line scripts.

Script dependant parameters

Parameter Description
--dbuser The DB user to use for this script
--dbpass The password to use for this script

Script specific parameters


Parameter Description
--status Show the cache status of the selected concepts.
--create Rebuild caches for the selected concepts.
--delete Remove all caches for the selected concepts.
NoteNote: If no further options are given, all concepts in the wiki are processed.


Parameter Description
--concept "Concept name" Process only this one concept.
--hard Process only concepts that are not allowed to be computed online according to the current wiki settings.
--update Process only concepts that already have some cache, i.e. do not create any new caches. For the opposite (only concepts without caches), use --old with a very high number.
--old <min> Process only concepts with caches older than <min> minutes or with no caches at all.
-s <startid> Process only concepts with page id of at least <startid>
-e <endid> Process only concepts with page id of at most <endid>

NoteNote:  Selection options can be combined to process only concepts that meet all the requirements at once. If --concept is given, then -s and -e are ignored.


Parameter Description
--verbose Give additional output. No effect if --quiet is given.
--no-cache Sets the $wgMainCacheType to none while running the script. Available since Semantic MediaWiki
--debug Sets global variables to support debug ouput while running. Available since Semantic MediaWiki
--report-runtime Will return memory usage and runtime of the respective script execution. Available since Semantic MediaWiki
--with-maintenance-log Adds a log entry to "Special:Logs" on the wiki and reports the script's runtime. Available since Semantic MediaWiki

NoteNote:  If you are using this parameter make sure that MediaWiki's configuration parameter $wgMaxNameChars is set to a value not lower than "25".5 Otherwise an exception will be issued informing about the minimum value for this setting ("32" or higher is recommended).6


The following command rebuilds existing concepts without prompting progress information.
php rebuildConceptCache.php --create --quiet
The following command rebuilds concept "English news" if it is older than one hour.
php rebuildConceptCache.php --create --old 60 --concept English_news
The following command verbosely rebuilds existing concepts and provides memory usage information after it has been completed.
php rebuildConceptCache.php --create --report-runtime
Example output:
Memory used: 5043456 (b: 17058680, a: 22102136) with a runtime of 0.12 sec
a) memory used after execution and b) memory used before the execution

This documentation page applies to all SMW versions from 1.9.2 to the most current version.

Help:rebuildConceptCache.php en 1.9.2


  1. ^  Semantic MediaWiki: GitHub issue gh:smw:749
  2. ^  Semantic MediaWiki: GitHub issue gh:smw:766
  3. ^  Semantic MediaWiki: GitHub pull request #829
  4. ^  Semantic MediaWiki: GitHub pull request gh:smw:1361
  5. ^  Semantic MediaWiki: GitHub issue gh:smw:1983
  6. ^  Semantic MediaWiki: GitHub pull request gh:smw:1985