Esempio n. 1
0
 private function rebuildAll()
 {
     $linkCache = LinkCache::singleton();
     $this->reportMessage("Rebuilding property pages first.\n");
     $this->setFiltersFromOptions(array('p' => true));
     $this->rebuildSelectedPages();
     $this->rebuildCount = 0;
     $this->store->clear();
     $this->reportMessage("\nRefreshing all semantic data in the database!\n---\n" . " Some versions of PHP suffer from memory leaks in long-running \n" . " scripts. If your machine gets very slow after many pages \n" . " (typically more than 1000) were refreshed, please abort with\n" . " CTRL-C and resume this script at the last processed page id\n" . " using the parameter -s (use -v to display page ids during \n" . " refresh). Continue this until all pages were refreshed.\n---\n");
     $this->reportMessage("Processing all IDs from {$this->start} to " . ($this->end ? "{$this->end}" : 'last ID') . " ...\n");
     $id = $this->start;
     while ((!$this->end || $id <= $this->end) && $id > 0) {
         $this->rebuildCount++;
         $this->reportMessage("({$this->rebuildCount}) Processing ID " . $id . " ...\n", $this->verbose);
         $this->store->refreshData($id, 1, false, false);
         if ($this->delay !== false) {
             usleep($this->delay);
         }
         if ($this->rebuildCount % 100 === 0) {
             // every 100 pages only
             $linkCache->clear();
             // avoid memory leaks
         }
         $this->doPrintDotProgressIndicator($this->verbose);
     }
     $this->writeIdToFile($id);
     $this->reportMessage("\n\n{$this->rebuildCount} IDs refreshed.\n");
     return true;
 }
 private function rebuildAll()
 {
     $linkCache = LinkCache::singleton();
     $byIdDataRebuildDispatcher = $this->store->refreshData($this->start, 1);
     $byIdDataRebuildDispatcher->setIterationLimit(1);
     $byIdDataRebuildDispatcher->setUpdateJobToUseJobQueueScheduler(false);
     $this->deleteMarkedSubjects($byIdDataRebuildDispatcher);
     if (!$this->skipBuildForProperties) {
         $this->reportMessage("Rebuilding property pages.\n");
         $this->setFiltersFromOptions(array('p' => true));
         $this->rebuildSelectedPages();
         $this->reportMessage("\n");
     }
     $this->rebuildCount = 0;
     $this->store->clear();
     $this->reportMessage("Refreshing all semantic data in the database!\n---\n" . " Some versions of PHP suffer from memory leaks in long-running \n" . " scripts. If your machine gets very slow after many pages \n" . " (typically more than 1000) were refreshed, please abort with\n" . " CTRL-C and resume this script at the last processed page id\n" . " using the parameter -s (use -v to display page ids during \n" . " refresh). Continue this until all pages have been refreshed.\n---\n");
     $total = $this->end && $this->end - $this->start > 0 ? $this->end - $this->start : $byIdDataRebuildDispatcher->getMaxId();
     $this->reportMessage(" The progress displayed is an estimation which can change \n" . " during the run with (*) indicating an adjustment.\n---\n");
     $this->reportMessage("Processing all IDs from {$this->start} to " . ($this->end ? "{$this->end}" : $byIdDataRebuildDispatcher->getMaxId()) . " ...\n");
     $id = $this->start;
     while ((!$this->end || $id <= $this->end) && $id > 0) {
         $this->rebuildCount++;
         $readjust = false;
         // Find a readjust baseline within the range of the total
         $readjustBaseline = $this->rebuildCount < 600 && $total < 600 ? round($total / 2) : 600;
         if ($this->rebuildCount % $readjustBaseline === 0 && !$this->end) {
             $readjust = $byIdDataRebuildDispatcher->getMaxId() !== $total;
             $total = $byIdDataRebuildDispatcher->getMaxId();
         }
         $byIdDataRebuildDispatcher->dispatchRebuildFor($id);
         $progress = round(($this->rebuildCount - 1) / $total * 100) . ($readjust ? "% (*{$total})" : '%');
         $this->reportMessage("({$this->rebuildCount}/{$total} {$progress}) Processing ID " . $id . " ...\n", $this->verbose);
         if ($this->delay !== false) {
             usleep($this->delay);
         }
         if ($this->rebuildCount % 100 === 0) {
             // every 100 pages only
             $linkCache->clear();
             // avoid memory leaks
         }
         $this->doPrintDotProgressIndicator($this->verbose, $progress);
     }
     $this->writeIdToFile($id);
     $this->reportMessage("\n\n{$this->rebuildCount} IDs refreshed.\n");
     return true;
 }
 private function doRebuildAll()
 {
     $entityRebuildDispatcher = $this->store->refreshData($this->start, 1);
     $entityRebuildDispatcher->setDispatchRangeLimit(1);
     $entityRebuildDispatcher->setUpdateJobParseMode($this->options->has('shallow-update') ? SMW_UJ_PM_CLASTMDATE : false);
     $entityRebuildDispatcher->useJobQueueScheduler(false);
     $this->doDisposeMarkedOutdatedEntities();
     if (!$this->options->has('skip-properties')) {
         $this->options->set('p', true);
         $this->doRebuildDistinctEntities();
         $this->reportMessage("\n");
     }
     $this->store->clear();
     $this->reportMessage("Refreshing all semantic data in the database!\n---\n" . " Some versions of PHP suffer from memory leaks in long-running \n" . " scripts. If your machine gets very slow after many pages \n" . " (typically more than 1000) were refreshed, please abort with\n" . " CTRL-C and resume this script at the last processed page id\n" . " using the parameter -s (use -v to display page ids during \n" . " refresh). Continue this until all pages have been refreshed.\n---\n");
     $total = $this->end && $this->end - $this->start > 0 ? $this->end - $this->start : $entityRebuildDispatcher->getMaxId();
     $id = $this->start;
     $this->reportMessage(" The progress displayed is an estimation and is self-adjusting \n" . " during the update process.\n---\n");
     $this->reportMessage("Processing all IDs from {$this->start} to " . ($this->end ? "{$this->end}" : $entityRebuildDispatcher->getMaxId()) . " ...\n");
     $this->rebuildCount = 0;
     while ((!$this->end || $id <= $this->end) && $id > 0) {
         $progress = '';
         $this->rebuildCount++;
         $this->exceptionLog = array();
         $this->doExecuteFor($entityRebuildDispatcher, $id);
         if ($this->rebuildCount % 60 === 0) {
             $progress = round(($this->end - $this->start > 0 ? $this->rebuildCount / $total : $entityRebuildDispatcher->getEstimatedProgress()) * 100) . "%";
         }
         foreach ($entityRebuildDispatcher->getDispatchedEntities() as $value) {
             $text = $this->getHumanReadableTextFrom($id, $value);
             $this->reportMessage(sprintf("%-16s%s\n", "({$this->rebuildCount}/{$total})", "Finished processing ID " . $text), $this->options->has('v'));
             if ($this->options->has('ignore-exceptions') && isset($this->exceptionLog[$id])) {
                 $this->exceptionFileLogger->doWriteExceptionLog(array($id . ' ' . $text => $this->exceptionLog[$id]));
             }
         }
         $this->doPrintDotProgressIndicator($this->verbose, $this->rebuildCount, $progress);
     }
     $this->writeIdToFile($id);
     $this->reportMessage("\n\n{$this->rebuildCount} IDs refreshed.\n");
     if ($this->options->has('ignore-exceptions') && $this->exceptionFileLogger->getExceptionCounter() > 0) {
         $this->reportMessage("\n" . $this->exceptionFileLogger->getExceptionCounter() . " exceptions were ignored! (See " . $this->exceptionFileLogger->getExceptionFile() . ").\n");
     }
     return true;
 }
 private function doRebuildAll()
 {
     $linkCache = LinkCache::singleton();
     $byIdDataRebuildDispatcher = $this->store->refreshData($this->start, 1);
     $byIdDataRebuildDispatcher->setIterationLimit(1);
     $byIdDataRebuildDispatcher->setUpdateJobParseMode($this->options->has('shallow-update') ? SMW_UJ_PM_CLASTMDATE : false);
     $byIdDataRebuildDispatcher->setUpdateJobToUseJobQueueScheduler(false);
     $this->deleteMarkedSubjects($byIdDataRebuildDispatcher);
     if (!$this->options->has('skip-properties')) {
         $this->filters[] = SMW_NS_PROPERTY;
         $this->doRebuildPagesFor("Rebuilding property pages.");
         $this->reportMessage("\n");
     }
     $this->rebuildCount = 0;
     $this->store->clear();
     $this->reportMessage("Refreshing all semantic data in the database!\n---\n" . " Some versions of PHP suffer from memory leaks in long-running \n" . " scripts. If your machine gets very slow after many pages \n" . " (typically more than 1000) were refreshed, please abort with\n" . " CTRL-C and resume this script at the last processed page id\n" . " using the parameter -s (use -v to display page ids during \n" . " refresh). Continue this until all pages have been refreshed.\n---\n");
     $total = $this->end && $this->end - $this->start > 0 ? $this->end - $this->start : $byIdDataRebuildDispatcher->getMaxId();
     $this->reportMessage(" The displayed progress is an estimation and is self-adjusting \n" . " during the update process.\n---\n");
     $this->reportMessage("Processing all IDs from {$this->start} to " . ($this->end ? "{$this->end}" : $byIdDataRebuildDispatcher->getMaxId()) . " ...\n");
     $id = $this->start;
     while ((!$this->end || $id <= $this->end) && $id > 0) {
         $this->rebuildCount++;
         $progress = '';
         $byIdDataRebuildDispatcher->dispatchRebuildFor($id);
         if ($this->rebuildCount % 60 === 0) {
             $progress = round(($this->end - $this->start > 0 ? $this->rebuildCount / $total : $byIdDataRebuildDispatcher->getEstimatedProgress()) * 100) . "%";
         }
         $this->reportMessage("({$this->rebuildCount}/{$total}) Processing ID " . $id . " ...\n", $this->verbose);
         if ($this->delay !== false) {
             usleep($this->delay);
         }
         if ($this->rebuildCount % 100 === 0) {
             // every 100 pages only
             $linkCache->clear();
             // avoid memory leaks
         }
         $this->doPrintDotProgressIndicator($this->verbose, $progress);
     }
     $this->writeIdToFile($id);
     $this->reportMessage("\n\n{$this->rebuildCount} IDs refreshed.\n");
     return true;
 }
Esempio n. 5
0
 /**
  * @see Store::refreshData()
  * @since 1.8
  */
 public function refreshData(&$index, $count, $namespaces = false, $usejobs = true)
 {
     return $this->baseStore->refreshData($index, $count, $namespaces, $usejobs);
 }