A scheduled task.
|Copyright:||2013 onwards Martin Dougiamas http://dougiamas.com|
|License:||http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later|
|File Size:||271 lines (12 kb)|
|Included or required:||0 times|
|Includes or requires:||0 files|
|Get a descriptive name for this task (shown to admins).|
|Do the job.|
Throw exceptions on errors (the job will be retried).
|compute_correlations($mincorrelation = 2) X-Ref|
|Calculates and stores the correlated tags of all tags.|
The correlations are stored in the 'tag_correlation' table.
Two tags are correlated if they appear together a lot. Ex.: Users tagged with "computers"
will probably also be tagged with "algorithms".
The rationale for the 'tag_correlation' table is performance. It works as a cache
for a potentially heavy load query done at the 'tag_instance' table. So, the
'tag_correlation' table stores redundant information derived from the 'tag_instance' table.
param: int $mincorrelation Only tags with more than $mincorrelation correlations will be identified.
|Clean up the tag tables, making sure all tagged object still exists.|
This method is called from cron.
This should normally not be necessary, but in case related tags are not deleted
when the tagged record is removed, this should be done once in a while, perhaps
on an occasional cron run. On a site with lots of tags, this could become an
expensive function to call.
|process_computed_correlation(stdClass $tagcorrelation) X-Ref|
|This function processes a tag correlation and makes changes in the database as required.|
The tag correlation object needs have both a tagid property and a correlatedtags property that is an array.
param: stdClass $tagcorrelation
return: int/bool The id of the tag correlation that was just processed or false.
|This function will delete numerous tag instances efficiently.|
This removes tag instances only. It doesn't check to see if it is the last use of a tag.
param: array $instances An array of tag instance objects with the addition of the tagname and tagrawname