| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
use MediaWiki\Deferred\LinksUpdate\LinksUpdate; |
| 22 |
use MediaWiki\Deferred\RefreshSecondaryDataUpdate; |
| 23 |
use MediaWiki\Logger\LoggerFactory; |
| 24 |
use MediaWiki\MainConfigNames; |
| 25 |
use MediaWiki\MediaWikiServices; |
| 26 |
use MediaWiki\Page\PageAssertionException; |
| 27 |
use MediaWiki\Page\PageIdentity; |
| 28 |
use MediaWiki\Parser\ParserCache; |
| 29 |
use MediaWiki\Parser\ParserOutput; |
| 30 |
use MediaWiki\Revision\RevisionRecord; |
| 31 |
use MediaWiki\Revision\RevisionRenderer; |
| 32 |
use MediaWiki\Revision\SlotRecord; |
| 33 |
use MediaWiki\Title\Title; |
| 34 |
use MediaWiki\User\User; |
| 35 |
use MediaWiki\WikiMap\WikiMap; |
| 36 |
use Wikimedia\Rdbms\IDBAccessObject; |
| 37 |
use Wikimedia\Stats\StatsFactory; |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
class RefreshLinksJob extends Job { |
| 111 |
|
| 112 |
private const NORMAL_MAX_LAG = 10; |
| 113 |
|
| 114 |
private const LAG_WAIT_TIMEOUT = 15; |
| 115 |
|
| 116 |
public function __construct( PageIdentity $page, array $params ) { |
| 117 |
if ( empty( $params['pages'] ) && !$page->canExist() ) { |
| 118 |
|
| 119 |
throw new PageAssertionException( |
| 120 |
'The given PageIdentity {pageIdentity} does not represent a proper page', |
| 121 |
[ 'pageIdentity' => $page ] |
| 122 |
); |
| 123 |
} |
| 124 |
|
| 125 |
parent::__construct( 'refreshLinks', $page, $params ); |
| 126 |
|
| 127 |
$this->removeDuplicates = ( |
| 128 |
|
| 129 |
!isset( $params['range'] ) && |
| 130 |
|
| 131 |
!( isset( $params['pages'] ) && count( $params['pages'] ) != 1 ) |
| 132 |
); |
| 133 |
$this->params += [ 'causeAction' => 'RefreshLinksJob', 'causeAgent' => 'unknown' ]; |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
$this->executionFlags |= self::JOB_NO_EXPLICIT_TRX_ROUND; |
| 138 |
} |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
public static function newPrioritized( PageIdentity $page, array $params ) { |
| 146 |
$job = new self( $page, $params ); |
| 147 |
$job->command = 'refreshLinksPrioritized'; |
| 148 |
|
| 149 |
return $job; |
| 150 |
} |
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
public static function newDynamic( PageIdentity $page, array $params ) { |
| 158 |
$job = new self( $page, $params ); |
| 159 |
$job->command = 'refreshLinksDynamic'; |
| 160 |
|
| 161 |
return $job; |
| 162 |
} |
| 163 |
|
| 164 |
public function run() { |
| 165 |
$ok = true; |
| 166 |
|
| 167 |
if ( !empty( $this->params['recursive'] ) ) { |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
$services = MediaWikiServices::getInstance(); |
| 174 |
if ( !isset( $this->params['range'] ) ) { |
| 175 |
$lbFactory = $services->getDBLoadBalancerFactory(); |
| 176 |
if ( !$lbFactory->waitForReplication( [ |
| 177 |
'timeout' => self::LAG_WAIT_TIMEOUT |
| 178 |
] ) ) { |
| 179 |
|
| 180 |
$stats = $services->getStatsFactory(); |
| 181 |
$stats->getCounter( 'refreshlinks_warnings_total' ) |
| 182 |
->setLabel( 'reason', 'lag_wait_failed' ) |
| 183 |
->copyToStatsdAt( 'refreshlinks_warning.lag_wait_failed' ) |
| 184 |
->increment(); |
| 185 |
} |
| 186 |
} |
| 187 |
|
| 188 |
$extraParams = $this->getRootJobParams(); |
| 189 |
$extraParams['triggeredRecursive'] = true; |
| 190 |
|
| 191 |
$extraParams['causeAction'] = $this->params['causeAction']; |
| 192 |
$extraParams['causeAgent'] = $this->params['causeAgent']; |
| 193 |
|
| 194 |
|
| 195 |
$jobs = BacklinkJobUtils::partitionBacklinkJob( |
| 196 |
$this, |
| 197 |
$services->getMainConfig()->get( MainConfigNames::UpdateRowsPerJob ), |
| 198 |
1, |
| 199 |
[ 'params' => $extraParams ] |
| 200 |
); |
| 201 |
$services->getJobQueueGroup()->push( $jobs ); |
| 202 |
|
| 203 |
} elseif ( isset( $this->params['pages'] ) ) { |
| 204 |
|
| 205 |
foreach ( $this->params['pages'] as [ $ns, $dbKey ] ) { |
| 206 |
$title = Title::makeTitleSafe( $ns, $dbKey ); |
| 207 |
if ( $title && $title->canExist() ) { |
| 208 |
$ok = $this->runForTitle( $title ) && $ok; |
| 209 |
} else { |
| 210 |
$ok = false; |
| 211 |
$this->setLastError( "Invalid title ($ns,$dbKey)." ); |
| 212 |
} |
| 213 |
} |
| 214 |
|
| 215 |
} else { |
| 216 |
|
| 217 |
$ok = $this->runForTitle( $this->title ); |
| 218 |
} |
| 219 |
|
| 220 |
return $ok; |
| 221 |
} |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
protected function runForTitle( PageIdentity $pageIdentity ) { |
| 228 |
$services = MediaWikiServices::getInstance(); |
| 229 |
$stats = $services->getStatsFactory(); |
| 230 |
$renderer = $services->getRevisionRenderer(); |
| 231 |
$parserCache = $services->getParserCache(); |
| 232 |
$lbFactory = $services->getDBLoadBalancerFactory(); |
| 233 |
$ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ ); |
| 234 |
|
| 235 |
|
| 236 |
$page = $services->getWikiPageFactory()->newFromTitle( $pageIdentity ); |
| 237 |
$page->loadPageData( IDBAccessObject::READ_LATEST ); |
| 238 |
|
| 239 |
if ( !$page->exists() ) { |
| 240 |
|
| 241 |
$logger = LoggerFactory::getInstance( 'RefreshLinksJob' ); |
| 242 |
$logger->warning( |
| 243 |
'The page does not exist. Perhaps it was deleted?', |
| 244 |
[ |
| 245 |
'page_title' => $this->title->getPrefixedDBkey(), |
| 246 |
'job_params' => $this->getParams(), |
| 247 |
'job_metadata' => $this->getMetadata() |
| 248 |
] |
| 249 |
); |
| 250 |
$this->incrementFailureCounter( $stats, 'page_not_found' ); |
| 251 |
|
| 252 |
|
| 253 |
return false; |
| 254 |
} |
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
$dbw = $lbFactory->getPrimaryDatabase(); |
| 261 |
|
| 262 |
$scopedLock = LinksUpdate::acquirePageLock( $dbw, $page->getId(), 'job' ); |
| 263 |
if ( $scopedLock === null ) { |
| 264 |
|
| 265 |
$this->setLastError( 'LinksUpdate already running for this page, try again later.' ); |
| 266 |
$this->incrementFailureCounter( $stats, 'lock_failure' ); |
| 267 |
|
| 268 |
|
| 269 |
return false; |
| 270 |
} |
| 271 |
|
| 272 |
if ( $this->isAlreadyRefreshed( $page ) ) { |
| 273 |
|
| 274 |
|
| 275 |
$stats->getCounter( 'refreshlinks_superseded_updates_total' ) |
| 276 |
->copyToStatsdAt( 'refreshlinks_outcome.good_update_superseded' ) |
| 277 |
->increment(); |
| 278 |
|
| 279 |
return true; |
| 280 |
} |
| 281 |
|
| 282 |
|
| 283 |
$lbFactory->beginPrimaryChanges( __METHOD__ ); |
| 284 |
$output = $this->getParserOutput( $renderer, $parserCache, $page, $stats ); |
| 285 |
$options = $this->getDataUpdateOptions(); |
| 286 |
$lbFactory->commitPrimaryChanges( __METHOD__ ); |
| 287 |
|
| 288 |
if ( !$output ) { |
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
return true; |
| 293 |
} |
| 294 |
|
| 295 |
|
| 296 |
$options['known-revision-output'] = $output; |
| 297 |
|
| 298 |
$page->doSecondaryDataUpdates( $options ); |
| 299 |
InfoAction::invalidateCache( $page ); |
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
$lbFactory->commitAndWaitForReplication( __METHOD__, $ticket ); |
| 310 |
|
| 311 |
return true; |
| 312 |
} |
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
private function getLagAwareRootTimestamp() { |
| 318 |
|
| 319 |
$rootTimestamp = $this->params['rootJobTimestamp'] ?? null; |
| 320 |
if ( $rootTimestamp === null ) { |
| 321 |
return null; |
| 322 |
} |
| 323 |
|
| 324 |
if ( !empty( $this->params['isOpportunistic'] ) ) { |
| 325 |
|
| 326 |
|
| 327 |
$lagAwareTimestamp = $rootTimestamp; |
| 328 |
} else { |
| 329 |
|
| 330 |
$lagAwareTimestamp = wfTimestamp( |
| 331 |
TS_MW, |
| 332 |
(int)wfTimestamp( TS_UNIX, $rootTimestamp ) + self::NORMAL_MAX_LAG |
| 333 |
); |
| 334 |
} |
| 335 |
|
| 336 |
return $lagAwareTimestamp; |
| 337 |
} |
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
private function isAlreadyRefreshed( WikiPage $page ) { |
| 344 |
$lagAwareTimestamp = $this->getLagAwareRootTimestamp(); |
| 345 |
|
| 346 |
return ( $lagAwareTimestamp !== null && $page->getLinksTimestamp() > $lagAwareTimestamp ); |
| 347 |
} |
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
private function shouldGenerateHTMLOnEdit( RevisionRecord $revision ): bool { |
| 355 |
$services = MediaWikiServices::getInstance(); |
| 356 |
foreach ( $revision->getSlots()->getSlotRoles() as $role ) { |
| 357 |
$slot = $revision->getSlots()->getSlot( $role ); |
| 358 |
$contentHandler = $services->getContentHandlerFactory()->getContentHandler( $slot->getModel() ); |
| 359 |
if ( $contentHandler->generateHTMLOnEdit() ) { |
| 360 |
return true; |
| 361 |
} |
| 362 |
} |
| 363 |
return false; |
| 364 |
} |
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
private function getParserOutput( |
| 376 |
RevisionRenderer $renderer, |
| 377 |
ParserCache $parserCache, |
| 378 |
WikiPage $page, |
| 379 |
StatsFactory $stats |
| 380 |
) { |
| 381 |
$revision = $this->getCurrentRevisionIfUnchanged( $page, $stats ); |
| 382 |
if ( !$revision ) { |
| 383 |
|
| 384 |
return null; |
| 385 |
} |
| 386 |
|
| 387 |
$cachedOutput = $this->getParserOutputFromCache( $parserCache, $page, $revision, $stats ); |
| 388 |
$statsCounter = $stats->getCounter( 'refreshlinks_parsercache_operations_total' ); |
| 389 |
|
| 390 |
if ( $cachedOutput && $this->canUseParserOutputFromCache( $cachedOutput, $revision ) ) { |
| 391 |
$statsCounter |
| 392 |
->setLabel( 'status', 'cache_hit' ) |
| 393 |
->setLabel( 'html_changed', 'n/a' ) |
| 394 |
->copyToStatsdAt( 'refreshlinks.parser_cached' ) |
| 395 |
->increment(); |
| 396 |
|
| 397 |
return $cachedOutput; |
| 398 |
} |
| 399 |
|
| 400 |
$causeAction = $this->params['causeAction'] ?? 'RefreshLinksJob'; |
| 401 |
$parserOptions = $page->makeParserOptions( 'canonical' ); |
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
$sampleRate = MediaWikiServices::getInstance()->getMainConfig()->get( |
| 406 |
MainConfigNames::ParsoidSelectiveUpdateSampleRate |
| 407 |
); |
| 408 |
$doSample = $sampleRate && mt_rand( 1, $sampleRate ) === 1; |
| 409 |
if ( $doSample && $cachedOutput === null ) { |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
$cachedOutput = $parserCache->getDirty( $page, $parserOptions ) ?: null; |
| 414 |
} |
| 415 |
|
| 416 |
$renderedRevision = $renderer->getRenderedRevision( |
| 417 |
$revision, |
| 418 |
$parserOptions, |
| 419 |
null, |
| 420 |
[ |
| 421 |
'audience' => $revision::RAW, |
| 422 |
'causeAction' => $causeAction, |
| 423 |
|
| 424 |
|
| 425 |
'previous-output' => $cachedOutput, |
| 426 |
] |
| 427 |
); |
| 428 |
|
| 429 |
$parseTimestamp = wfTimestampNow(); |
| 430 |
$output = $renderedRevision->getRevisionParserOutput( [ |
| 431 |
|
| 432 |
'generate-html' => $this->shouldGenerateHTMLOnEdit( $revision ) |
| 433 |
] ); |
| 434 |
$output->setCacheTime( $parseTimestamp ); |
| 435 |
|
| 436 |
|
| 437 |
if ( $doSample ) { |
| 438 |
$content = $revision->getContent( SlotRecord::MAIN ); |
| 439 |
$labels = [ |
| 440 |
'source' => 'RefreshLinksJob', |
| 441 |
'type' => $cachedOutput === null ? 'full' : 'selective', |
| 442 |
'reason' => $causeAction, |
| 443 |
'parser' => $parserOptions->getUseParsoid() ? 'parsoid' : 'legacy', |
| 444 |
'opportunistic' => empty( $this->params['isOpportunistic'] ) ? 'false' : 'true', |
| 445 |
'wiki' => WikiMap::getCurrentWikiId(), |
| 446 |
'model' => $content ? $content->getModel() : 'unknown', |
| 447 |
]; |
| 448 |
$stats |
| 449 |
->getCounter( 'ParserCache_selective_total' ) |
| 450 |
->setLabels( $labels ) |
| 451 |
->increment(); |
| 452 |
$stats |
| 453 |
->getCounter( 'ParserCache_selective_cpu_seconds' ) |
| 454 |
->setLabels( $labels ) |
| 455 |
->incrementBy( $output->getTimeProfile( 'cpu' ) ); |
| 456 |
} |
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
if ( !$cachedOutput || !$output->hasText() ) { |
| 462 |
|
| 463 |
|
| 464 |
$htmlChanged = 'unknown'; |
| 465 |
} elseif ( $cachedOutput->getRawText() === $output->getRawText() ) { |
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
$htmlChanged = 'no'; |
| 470 |
} else { |
| 471 |
|
| 472 |
$htmlChanged = 'yes'; |
| 473 |
} |
| 474 |
|
| 475 |
$statsCounter |
| 476 |
->setLabel( 'status', 'cache_miss' ) |
| 477 |
->setLabel( 'html_changed', $htmlChanged ) |
| 478 |
->copyToStatsdAt( 'refreshlinks.parser_uncached' ) |
| 479 |
->increment(); |
| 480 |
|
| 481 |
return $output; |
| 482 |
} |
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
private function getCurrentRevisionIfUnchanged( |
| 492 |
WikiPage $page, |
| 493 |
StatsFactory $stats |
| 494 |
) { |
| 495 |
$title = $page->getTitle(); |
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
$latest = $title->getLatestRevID( IDBAccessObject::READ_LATEST ); |
| 500 |
|
| 501 |
$triggeringRevisionId = $this->params['triggeringRevisionId'] ?? null; |
| 502 |
if ( $triggeringRevisionId && $triggeringRevisionId !== $latest ) { |
| 503 |
|
| 504 |
$this->incrementFailureCounter( $stats, 'rev_not_current' ); |
| 505 |
$this->setLastError( "Revision $triggeringRevisionId is not current" ); |
| 506 |
return null; |
| 507 |
} |
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
$revision = $page->getRevisionRecord(); |
| 512 |
if ( !$revision ) { |
| 513 |
|
| 514 |
$this->incrementFailureCounter( $stats, 'rev_not_found' ); |
| 515 |
$this->setLastError( "Revision not found for {$title->getPrefixedDBkey()}" ); |
| 516 |
return null; |
| 517 |
|
| 518 |
} elseif ( $revision->getId() !== $latest || $revision->getPageId() !== $page->getId() ) { |
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
$this->incrementFailureCounter( $stats, 'rev_not_current' ); |
| 524 |
$this->setLastError( "Revision {$revision->getId()} is not current" ); |
| 525 |
|
| 526 |
return null; |
| 527 |
} |
| 528 |
|
| 529 |
return $revision; |
| 530 |
} |
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
private function getParserOutputFromCache( |
| 542 |
ParserCache $parserCache, |
| 543 |
WikiPage $page, |
| 544 |
RevisionRecord $currentRevision, |
| 545 |
StatsFactory $stats |
| 546 |
): ?ParserOutput { |
| 547 |
|
| 548 |
|
| 549 |
$parserOptions = $page->makeParserOptions( 'canonical' ); |
| 550 |
if ( $parserOptions->getUseParsoid() ) { |
| 551 |
return $parserCache->getDirty( $page, $parserOptions ) ?: null; |
| 552 |
} |
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
$rootTimestamp = $this->params['rootJobTimestamp'] ?? null; |
| 557 |
if ( $rootTimestamp !== null ) { |
| 558 |
$opportunistic = !empty( $this->params['isOpportunistic'] ); |
| 559 |
if ( $page->getTouched() >= $rootTimestamp || $opportunistic ) { |
| 560 |
|
| 561 |
|
| 562 |
return $parserCache->getDirty( $page, $parserOptions ) ?: null; |
| 563 |
} |
| 564 |
} |
| 565 |
|
| 566 |
return null; |
| 567 |
} |
| 568 |
|
| 569 |
private function canUseParserOutputFromCache( |
| 570 |
ParserOutput $cachedOutput, |
| 571 |
RevisionRecord $currentRevision |
| 572 |
) { |
| 573 |
|
| 574 |
|
| 575 |
return $cachedOutput->getCacheRevisionId() == $currentRevision->getId() |
| 576 |
&& $cachedOutput->getCacheTime() >= $this->getLagAwareRootTimestamp(); |
| 577 |
} |
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
private function incrementFailureCounter( StatsFactory $stats, $reason ): void { |
| 587 |
$stats->getCounter( 'refreshlinks_failures_total' ) |
| 588 |
->setLabel( 'reason', $reason ) |
| 589 |
->copyToStatsdAt( "refreshlinks_outcome.bad_$reason" ) |
| 590 |
->increment(); |
| 591 |
} |
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
private function getDataUpdateOptions() { |
| 597 |
$options = [ |
| 598 |
'recursive' => !empty( $this->params['useRecursiveLinksUpdate'] ), |
| 599 |
|
| 600 |
'causeAction' => $this->params['causeAction'], |
| 601 |
'causeAgent' => $this->params['causeAgent'] |
| 602 |
]; |
| 603 |
if ( !empty( $this->params['triggeringUser'] ) ) { |
| 604 |
$userInfo = $this->params['triggeringUser']; |
| 605 |
if ( $userInfo['userId'] ) { |
| 606 |
$options['triggeringUser'] = User::newFromId( $userInfo['userId'] ); |
| 607 |
} else { |
| 608 |
|
| 609 |
$options['triggeringUser'] = User::newFromName( $userInfo['userName'], false ); |
| 610 |
} |
| 611 |
} |
| 612 |
|
| 613 |
return $options; |
| 614 |
} |
| 615 |
|
| 616 |
public function getDeduplicationInfo() { |
| 617 |
$info = parent::getDeduplicationInfo(); |
| 618 |
unset( $info['causeAction'] ); |
| 619 |
unset( $info['causeAgent'] ); |
| 620 |
if ( is_array( $info['params'] ) ) { |
| 621 |
|
| 622 |
|
| 623 |
if ( isset( $info['params']['pages'] ) ) { |
| 624 |
unset( $info['namespace'] ); |
| 625 |
unset( $info['title'] ); |
| 626 |
} |
| 627 |
} |
| 628 |
|
| 629 |
return $info; |
| 630 |
} |
| 631 |
|
| 632 |
public function workItemCount() { |
| 633 |
if ( !empty( $this->params['recursive'] ) ) { |
| 634 |
return 0; |
| 635 |
} elseif ( isset( $this->params['pages'] ) ) { |
| 636 |
return count( $this->params['pages'] ); |
| 637 |
} |
| 638 |
|
| 639 |
return 1; |
| 640 |
} |
| 641 |
} |