93 # Set the list of target categories; convert them to DBKEY form first
95 foreach ( $categories as $c ) {
99 $this->targets[
$c] =
$c;
114 while ( count( $this->next ) && $dig ) {
118 if ( $this->maxdepth !== -1 ) {
124 # Now check if this applies to the individual articles
127 foreach ( $this->articles as
$article ) {
129 if ( $this->
check( $article, $conds ) ) {
130 # Matches the conditions
152 private function check( $id, &$conds, $path = [] ) {
160 # Shortcut (runtime paranoia): No conditions=all matched
161 if ( count( $conds ) == 0 ) {
165 if ( !
isset( $this->parents[$id] ) ) {
169 # iterate through the parents
170 foreach ( $this->parents[$id] as $p ) {
173 # Is this a condition?
174 if (
isset( $conds[$pname] ) ) {
175 # This key is in the category list!
176 if ( $this->mode ==
'OR' ) {
177 # One found, that's enough!
181 # Assuming "AND" as default
182 unset( $conds[$pname] );
183 if ( count( $conds ) == 0 ) {
184 # All conditions met, done
190 # Not done yet, try sub-parents
191 if ( !
isset( $this->name2id[$pname] ) ) {
195 $done = $this->
check( $this->name2id[$pname], $conds, $path );
196 if ( $done || count( $conds ) == 0 ) {
197 # Subparents have done it!
208 # Find all parents of the article currently in $this->next
210 $res = $this->dbr->select(
212 [
'cl_to',
'cl_from' ],
213 [
'cl_from' => $this->next ],
216 foreach (
$res as $o ) {
220 if ( !
isset( $this->parents[$o->cl_from] ) ) {
221 $this->parents[$o->cl_from] = [];
223 $this->parents[$o->cl_from][
$k] =
$o;
225 # Ignore those we already have
226 if (
in_array( $k, $this->deadend ) ) {
230 if (
isset( $this->name2id[$k] ) ) {
240 # Find the IDs of all category pages in $layer, if they exist
241 if ( count( $layer ) > 0 ) {
242 $res = $this->dbr->select(
244 [
'page_id',
'page_title' ],
245 [
'page_namespace' =>
NS_CATEGORY,
'page_title' => $layer ],
248 foreach (
$res as $o ) {
250 $name = $o->page_title;
251 $this->name2id[
$name] = $id;
253 unset( $layer[$name] );
258 foreach ( $layer as $v ) {
259 $this->deadend[
$v] =
$v;
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
The "CategoryFinder" class takes a list of articles, creates an internal representation of all their ...
check( $id, &$conds, $path=[])
This functions recurses through the parent representation, trying to match the conditions.
array $targets
Array of DBKEY category names.
int[] $articles
The original article IDs passed to the seed function.
int $maxdepth
Max layer depth.
array $next
Array of article/category IDs.
array $parents
Array of [ ID => [] ].
array $deadend
Array of DBKEY category names for categories that don't have a page.
string $mode
"AND" or "OR"
run()
Iterates through the parent tree starting with the seed values, then checks the articles if they matc...
scanNextLayer()
Scans a "parent layer" of the articles/categories in $this->next.
seed( $articleIds, $categories, $mode='AND', $maxdepth=-1)
Initializes the instance.
getParents()
Get the parents.
IDatabase $dbr
Read-DB replica DB.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Allows to change the fields on the form that will be generated $name
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 initially an empty< div id="toolbar"></div > Hook subscribers can return false to have no toolbar HTML be loaded overridable Default is either copyrightwarning or copyrightwarning2 overridable Default is editpage tos summary such as anonymity and the real check
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges use this to change the tables headers change it to an object instance and return false override the list derivative used the name of the old file & $article
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))