/**
  * Returns some additional information about indexing progress, shown in
  * the scheduler's task overview list.
  *
  * @return string Information to display
  */
 public function getAdditionalInformation()
 {
     $itemsIndexedPercentage = $this->getProgress();
     $message = 'Site: ' . $this->site->getLabel();
     $failedItemsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'tx_solr_indexqueue_item', 'root = ' . $this->site->getRootPageId() . ' AND errors != \'\'');
     if ($failedItemsCount) {
         $message .= ' Failures: ' . $failedItemsCount;
     }
     return $message;
 }
Beispiel #2
0
 /**
  * This method is designed to return some additional information about the task,
  * that may help to set it apart from other tasks from the same class
  * This additional information is used - for example - in the Scheduler's BE module
  * This method should be implemented in most task classes
  *
  * @return string Information to display
  */
 public function getAdditionalInformation()
 {
     $information = '';
     if ($this->site) {
         $information = 'Site: ' . $this->site->getLabel();
     }
     if (!empty($this->indexingConfigurationsToReIndex)) {
         $information .= ', Indexing Configurations: ' . implode(', ', $this->indexingConfigurationsToReIndex);
     }
     return $information;
 }
Beispiel #3
0
 protected function logInitialization($initializationQuery)
 {
     $solrConfiguration = $this->site->getSolrConfiguration();
     $logSeverity = -1;
     $logData = array('site' => $this->site->getLabel(), 'indexing configuration name' => $this->indexingConfigurationName, 'type' => $this->type, 'query' => $initializationQuery, 'rows' => $GLOBALS['TYPO3_DB']->sql_affected_rows());
     if ($GLOBALS['TYPO3_DB']->sql_errno()) {
         $logSeverity = 3;
         $logData['error'] = $GLOBALS['TYPO3_DB']->sql_errno() . ': ' . $GLOBALS['TYPO3_DB']->sql_error();
     }
     if ($solrConfiguration['logging.']['indexing.']['indexQueueInitialization']) {
         t3lib_div::devLog('Index Queue initialized for indexing configuration ' . $this->indexingConfigurationName, 'solr', $logSeverity, $logData);
     }
 }
Beispiel #4
0
    /**
     * Removes all items of a certain site from the Index Queue. Accepts an
     * optional parameter to limit the deleted items by indexing configuration.
     *
     * @param Tx_Solr_Site $site The site to remove items for.
     * @param string $indexingConfigurationName Name of a specific indexing
     *      configuration
     */
    public function deleteItemsBySite(Tx_Solr_Site $site, $indexingConfigurationName = '')
    {
        $rootPageConstraint = 'tx_solr_indexqueue_item.root = ' . $site->getRootPageId();
        $indexingConfigurationConstraint = '';
        if (!empty($indexingConfigurationName)) {
            $indexingConfigurationConstraint = ' AND tx_solr_indexqueue_item.indexing_configuration = \'' . $indexingConfigurationName . '\'';
        }
        Tx_Solr_DatabaseUtility::transactionStart();
        try {
            // reset Index Queue
            $result = $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_solr_indexqueue_item', $rootPageConstraint . $indexingConfigurationConstraint);
            if (!$result) {
                throw new RuntimeException('Failed to reset Index Queue for site ' . $site->getLabel(), 1412986560);
            }
            // reset Index Queue Properties
            $indexQueuePropertyResetQuery = '
				DELETE tx_solr_indexqueue_indexing_property.*
				FROM tx_solr_indexqueue_indexing_property
				INNER JOIN tx_solr_indexqueue_item
					ON tx_solr_indexqueue_item.uid = tx_solr_indexqueue_indexing_property.item_id
					AND ' . $rootPageConstraint . $indexingConfigurationConstraint;
            $result = $GLOBALS['TYPO3_DB']->sql_query($indexQueuePropertyResetQuery);
            if (!$result) {
                throw new RuntimeException('Failed to reset Index Queue properties for site ' . $site->getLabel(), 1412986604);
            }
            Tx_Solr_DatabaseUtility::transactionCommit();
        } catch (RuntimeException $e) {
            Tx_Solr_DatabaseUtility::transactionRollback();
        }
    }