示例#1
0
 /**
  * Initialize open authentication
  */
 protected function initOAuth()
 {
     $this->oAuth = new Dropbox_OAuth_PHP($this->configuration->getDropboxConsumerKey(), $this->configuration->getDropboxConsumerSecret());
     $oAuthTokens = $this->registry->get('tx_dlDropbox', 'oauth_tokens');
     if (is_array($oAuthTokens) && array_key_exists('token_secret', $oAuthTokens) && $oAuthTokens['token_secret']) {
         $this->oAuth->setToken($oAuthTokens);
         $this->isAuthenticated = TRUE;
     }
 }
示例#2
0
 /**
  * @return void
  */
 public function selectThemeAction()
 {
     $selectedThemes = GeneralUtility::_GET('selectedThemes');
     foreach ($selectedThemes as $theme => $isSelected) {
         $themeName = end(explode('.', $theme));
         $selectedThemeNames[$themeName] = $isSelected == 'checked' ? TRUE : FALSE;
     }
     $this->registry->set('tx_yag', 'rfcSelectedThemes', serialize($selectedThemeNames));
     exit;
 }
 /**
  * Delete all index elements that are older than starting timestamp in registry
  *
  * @return string content for BE
  */
 function cleanUpIndex()
 {
     $content = '';
     $startMicrotime = microtime(true);
     $table = 'tx_kesearch_index';
     // select all index records older than the beginning of the indexing process
     $where = 'tstamp < ' . $this->registry->get('tx_kesearch', 'startTimeOfIndexer');
     // hook for cleanup
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['cleanup'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['cleanup'] as $_classRef) {
             if (TYPO3_VERSION_INTEGER >= 7000000) {
                 $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             } else {
                 $_procObj =& t3lib_div::getUserObj($_classRef);
             }
             $content .= $_procObj->cleanup($where, $this);
         }
     }
     // count and delete old index records
     $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $table, $where);
     $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where);
     // check if Sphinx is enabled
     // in this case we have to update sphinx index, too.
     if ($this->extConfPremium['enableSphinxSearch']) {
         if (!$this->extConfPremium['sphinxIndexerName']) {
             $this->extConfPremium['sphinxIndexerConf'] = '--all';
         }
         if (is_file($this->extConfPremium['sphinxIndexerPath']) && is_executable($this->extConfPremium['sphinxIndexerPath']) && file_exists($this->extConfPremium['sphinxSearchdPath']) && is_executable($this->extConfPremium['sphinxIndexerPath'])) {
             $found = preg_match_all('/exec|system/', ini_get('disable_functions'), $match);
             if ($found === 0) {
                 // executables are allowed
                 $ret = system($this->extConfPremium['sphinxIndexerPath'] . ' --rotate ' . $this->extConfPremium['sphinxIndexerName']);
                 if (strpos($ret, 'WARNING') !== FALSE) {
                     $warning = strstr($ret, 'WARNING');
                     $content .= '<div class="error">SPHINX ' . $warning . '</div>';
                 }
                 $content .= $ret;
             } elseif ($found === 1) {
                 // one executable is allowed
                 if ($match[0] == 'system') {
                     $ret = system($this->extConfPremium['sphinxIndexerPath'] . ' --rotate ' . $this->extConfPremium['sphinxIndexerName']);
                 } else {
                     // use exec
                     exec($this->extConfPremium['sphinxIndexerPath'] . ' --rotate ' . $this->extConfPremium['sphinxIndexerName'], $retArr);
                     foreach ($retArr as $retRow) {
                         if (strpos($retRow, 'WARNING') !== FALSE) {
                             $content .= '<div class="error">SPHINX ' . $retRow . '</div>';
                         }
                     }
                     $ret = implode(';', $retArr);
                 }
                 $content .= $ret;
             } else {
                 $content .= '<div class="error">Check your php.ini configuration for disable_functions. For now it is not allowed to execute a shell script.</div>';
             }
         } else {
             $content .= '<div class="error">We can\'t find the sphinx executables or execution permission is missing.</div>';
         }
     }
     $content .= '<p><b>Index cleanup:</b><br />' . "\n";
     $content .= $count . ' entries deleted.<br />' . "\n";
     // calculate duration of indexing process
     $duration = ceil((microtime(true) - $startMicrotime) * 1000);
     $content .= '<i>Cleanup process took ' . $duration . ' ms.</i></p>' . "\n";
     return $content;
 }
 /**
  * @test
  */
 public function removeAllByNamespaceReallyRemovesAllEntriesOfTheSpecifiedNamespaceFromTheDatabase()
 {
     $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_DELETEquery')->with('sys_registry', 'entry_namespace = \'tx_phpunit\'');
     $this->registry->removeAllByNamespace('tx_phpunit');
 }
 /**
  * Disconnect the dropbox by removing the oAuth secret from the registry
  */
 public function disconnectDropboxAction()
 {
     $this->registry->remove('tx_dlDropbox', 'oauth_tokens');
     $this->flashMessageContainer->add('The dropbox was successfully disconnected.', 'Dropbox disconnected!', t3lib_FlashMessage::OK);
     $this->forward('show', 'Sync');
 }