/** * @since 2.2 * * @param Store $store * @param Callable|null $reporterCallback * * @return ConceptCacheRebuilder */ public function newConceptCacheRebuilder(Store $store, $reporterCallback = null) { $messageReporter = MessageReporterFactory::getInstance()->newObservableMessageReporter(); $messageReporter->registerReporterCallback($reporterCallback); $conceptCacheRebuilder = new ConceptCacheRebuilder($store, ApplicationFactory::getInstance()->getSettings()); $conceptCacheRebuilder->setMessageReporter($messageReporter); return $conceptCacheRebuilder; }
/** * @see Maintenance::execute */ public function execute() { if (!defined('SMW_VERSION')) { $this->reportMessage("You need to have SMW enabled in order to run the maintenance script!\n\n"); return false; } $applicationFactory = ApplicationFactory::getInstance(); $reporter = new ObservableMessageReporter(); $reporter->registerReporterCallback(array($this, 'reportMessage')); $conceptCacheRebuilder = new ConceptCacheRebuilder($applicationFactory->getStore(), $applicationFactory->getSettings()); $conceptCacheRebuilder->setMessageReporter($reporter); $conceptCacheRebuilder->setParameters($this->mOptions); if ($conceptCacheRebuilder->rebuild()) { return true; } $this->reportMessage($this->mDescription . "\n\n" . 'Use option --help for usage details.' . "\n"); return false; }