/**
  * Download all lists from Mailchimp.
  *
  * @return void
  */
 public function listsCommand()
 {
     $this->outputLine('<info>Downloading lists...</info>');
     try {
         $lists = $this->mailchimpService->downloadLists();
         foreach ($lists as $l) {
             $this->outputLine("<comment>- {$l->getMcListId()} downloaded</comment>");
         }
         $this->outputLine('<info>complete</info>');
         $this->logger->info('Lists downloaded successfully via CLI');
     } catch (Exception $e) {
         $this->outputLine("<error>Error: {$e->getMessage()}</error>");
         $this->logger->error('Lists failed to download via CLI', ['message' => $e->getMessage()]);
     }
 }
 /**
  * Clear all caches except the page cache.
  * This is especially useful on big sites when you can't just drop the page cache.
  *
  * @return void
  */
 public function clearAllExceptPageCacheCommand()
 {
     $clearedCaches = $this->cacheApiService->clearAllExceptPageCache();
     $message = 'Cleared caches: ' . implode(', ', $clearedCaches);
     $this->logger->info($message);
     $this->outputLine($message);
 }
 /**
  * Basic information about the system.
  *
  * @return void
  */
 public function infoCommand()
 {
     $data = $this->siteApiService->getSiteInfo();
     foreach ($data as $key => $value) {
         $line = wordwrap($value, self::MAXIMUM_LINE_LENGTH - 43, PHP_EOL . str_repeat(' ', 43), TRUE);
         $this->outputLine('%-2s%-40s %s', array(' ', $key, $line));
     }
     $this->logger->info('siteApi:info executes successfully.');
 }
 /**
  * Import extension from file.
  *
  * @param string  $file      Path to t3x file
  * @param string  $location  Where to import the extension. System = typo3/sysext, Global = typo3/ext, Local = typo3conf/ext
  * @param boolean $overwrite Overwrite the extension if already exists
  *
  * @return void
  */
 public function importCommand($file, $location = 'Local', $overwrite = FALSE)
 {
     try {
         $data = $this->extensionApiService->importExtension($file, $location, $overwrite);
         $message = sprintf('Extension "%s" has been imported!', $data['extKey']);
         $this->outputLine($message);
         $this->logger->info($message);
     } catch (Exception $e) {
         $this->outputLine($e->getMessage());
         $this->logger->error($e->getMessage());
         $this->quit(1);
     }
 }
 /**
  * Unlocks the backend access by deleting the lock file
  */
 public function unlockCommand()
 {
     if (@is_file(PATH_typo3conf . 'LOCK_BACKEND')) {
         unlink(PATH_typo3conf . 'LOCK_BACKEND');
         if (@is_file(PATH_typo3conf . 'LOCK_BACKEND')) {
             $message = 'ERROR: Could not remove lock file \'typo3conf/LOCK_BACKEND\'!';
             $this->outputLine($message);
             $this->logger->error($message);
             $this->quit(1);
         } else {
             $message = 'Removed lock file \'typo3conf/LOCK_BACKEND\'';
             $this->outputLine($message);
             $this->logger->info($message);
         }
     } else {
         $message = 'No lock file \'typo3conf/LOCK_BACKEND\' was found, hence no lock could be removed.';
         $this->outputLine($message);
         $this->logger->info($message);
         $this->quit(1);
     }
 }
 /**
  * Database compare.
  * Leave the argument 'actions' empty or use "help" to see the available ones
  *
  * @param string $actions List of actions which will be executed
  * @param bool   $dry
  */
 public function databaseCompareCommand($actions = '', $dry = FALSE)
 {
     if ($actions === 'help' || strlen($actions) === 0) {
         $actions = $this->databaseApiService->databaseCompareAvailableActions();
         foreach ($actions as $number => $action) {
             $this->outputLine('  - ' . $action . ' => ' . $number);
         }
         $this->quit();
     }
     $result = $this->databaseApiService->databaseCompare($actions, $dry);
     if ($dry) {
         $this->outputLine('DB compare would execute the following queries:');
         foreach ($result as $key => $set) {
             $this->outputLine(sprintf('### Action: %s ###', $key));
             $this->outputLine('===================================');
             $this->logger->info(sprintf('### Action: %s ###', $key));
             $this->logger->info('===================================');
             foreach ($set as $line) {
                 $this->outputLine($line);
                 $this->logger->info($line);
             }
             $this->outputLine(LF);
         }
         $this->logger->info('DB compare executed in dry mode');
     } else {
         if (empty($result)) {
             $message = 'DB has been compared';
             $this->outputLine($message);
             $this->logger->info($message);
         } else {
             $message = sprintf('DB could not be compared, Error(s): %s', array(LF . implode(LF, $result)));
             $this->outputLine($message);
             $this->logger->error($message);
             $this->quit(1);
         }
     }
 }
 /**
  * Logs info-leveled events
  *
  * @param string $message Log message
  * @param array $context Context data
  *
  * @return void
  */
 public function info($message, array $context = array())
 {
     $this->logger->info($message, $context);
 }
Esempio n. 8
0
 /**
  * Process an email change webhook.
  *
  * @param  \Tev\TevMailchimp\Webhook\Webhook $hook Incoming webhook
  * @return void
  */
 private function processEmailChange(Webhook $hook)
 {
     $this->unsubscribe($hook->getData('old_email'), $hook->getData('list_id'));
     $this->subscribe($hook->getData('new_email'), $hook->getData('list_id'));
     $this->logger->info('Processed email change hook', ['old_email' => $hook->getData('old_email'), 'new_email' => $hook->getData('new_email'), 'list_id' => $hook->getData('list_id')]);
 }