Go to the documentation of this file.
48 var $parents = array(); # Array of [ID => array()]
49 var $next = array(); # Array of article/category IDs
50 var $targets = array(); # Array of DBKEY category names
51 var $name2id = array();
52 var $mode; # "AND" or "OR"
57 var $dbr; # Read-DB slave
62 function __construct() {
72 function seed( $article_ids, $categories, $mode = 'AND
' ) {
73 $this->articles = $article_ids;
74 $this->next = $article_ids;
77 # Set the list of target categories; convert them to DBKEY form first
78 $this->targets = array();
79 foreach ( $categories as $c ) {
80 $ct = Title::makeTitleSafe( NS_CATEGORY, $c );
83 $this->targets[$c] = $c;
94 $this->dbr = wfGetDB( DB_SLAVE );
95 while ( count( $this->next ) > 0 ) {
96 $this->scan_next_layer();
99 # Now check if this applies to the individual articles
102 foreach ( $this->articles as $article ) {
103 $conds = $this->targets;
104 if ( $this->check( $article, $conds ) ) {
105 # Matches the conditions
119 function check( $id, &$conds, $path = array() ) {
120 // Check for loops and stop!
121 if ( in_array( $id, $path ) ) {
127 # Shortcut (runtime paranoia): No conditions=all matched
128 if ( count( $conds ) == 0 ) {
132 if ( !isset( $this->parents[$id] ) ) {
136 # iterate through the parents
137 foreach ( $this->parents[$id] as $p ) {
140 # Is this a condition?
141 if ( isset( $conds[$pname] ) ) {
142 # This key is in the category list!
143 if ( $this->mode == 'OR
' ) {
144 # One found, that's enough!
148 # Assuming "AND" as default
149 unset( $conds[$pname] );
150 if ( count( $conds ) == 0 ) {
151 # All conditions met, done
157 # Not done yet, try sub-parents
158 if ( !isset( $this->name2id[$pname] ) ) {
162 $done = $this->
check( $this->name2id[$pname], $conds,
$path );
163 if ( $done || count( $conds ) == 0 ) {
164 # Subparents have done it!
174 function scan_next_layer() {
177 # Find all parents of the article currently in $this->next
179 $res = $this->dbr->select(
182 array(
'cl_from' => $this->next ),
189 if ( !isset( $this->parents[$o->cl_from] ) ) {
190 $this->parents[$o->cl_from] =
array();
192 $this->parents[$o->cl_from][$k] = $o;
194 # Ignore those we already have
195 if ( in_array( $k, $this->deadend ) ) {
199 if ( isset( $this->name2id[$k] ) ) {
207 $this->next =
array();
209 # Find the IDs of all category pages in $layer, if they exist
210 if ( count( $layer ) > 0 ) {
211 $res = $this->dbr->select(
213 array(
'page_id',
'page_title' ),
219 $name = $o->page_title;
220 $this->name2id[
$name] = $id;
222 unset( $layer[
$name] );
227 foreach ( $layer
as $v ) {
228 $this->deadend[$v] = $v;
in this case you re responsible for computing and outputting the entire conflict i the difference between revisions and your text headers and sections and Diff overridable Default is either copyrightwarning or copyrightwarning2 overridable Default is editpage tos summary such as anonymity and the real check
globals txt Globals are evil The original MediaWiki code relied on globals for processing context far too often MediaWiki development since then has been a story of slowly moving context out of global variables and into objects Storing processing context in object member variables allows those objects to be reused in a much more flexible way Consider the elegance of
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
wfProfileIn( $functionname)
Begin profiling of a function.
The "Categoryfinder" class takes a list of articles, creates an internal representation of all their ...
seed( $article_ids, $categories, $mode='AND')
Initializes the instance.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an article
wfProfileOut( $functionname='missing')
Stop profiling of a function.
scan_next_layer()
Scans a "parent layer" of the articles/categories in $this->next.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
Allows to change the fields on the form that will be generated $name
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global then executing the whole list after the page is displayed We don t do anything smart like collating updates to the same table or such because the list is almost always going to have just one item on if that