Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

cli_iohandler.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 6.45 KiB


 001  <?php
 002  /**
 003   *
 004   * This file is part of the phpBB Forum Software package.
 005   *
 006   * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007   * @license GNU General Public License, version 2 (GPL-2.0)
 008   *
 009   * For full copyright and license information, please see
 010   * the docs/CREDITS.txt file.
 011   *
 012   */
 013   
 014  namespace phpbb\install\helper\iohandler;
 015   
 016  use phpbb\install\exception\installer_exception;
 017  use Symfony\Component\Console\Output\OutputInterface;
 018  use Symfony\Component\Console\Style\OutputStyle;
 019   
 020  /**
 021   * Input-Output handler for the CLI frontend
 022   */
 023  class cli_iohandler extends iohandler_base
 024  {
 025      /**
 026       * @var OutputInterface
 027       */
 028      protected $output;
 029   
 030      /**
 031       * @var OutputStyle
 032       */
 033      protected $io;
 034   
 035      /**
 036       * @var array
 037       */
 038      protected $input_values = array();
 039   
 040      /**
 041       * @var \Symfony\Component\Console\Helper\ProgressBar
 042       */
 043      protected $progress_bar;
 044   
 045      /**
 046       * Set the style and output used to display feedback;
 047       *
 048       * @param OutputStyle         $style
 049       * @param OutputInterface    $output
 050       */
 051      public function set_style(OutputStyle $style, OutputInterface $output)
 052      {
 053          $this->io = $style;
 054          $this->output = $output;
 055      }
 056   
 057      /**
 058       * {@inheritdoc}
 059       */
 060      public function get_input($name, $default, $multibyte = false)
 061      {
 062          $result = $default;
 063   
 064          if (isset($this->input_values[$name]))
 065          {
 066              $result = $this->input_values[$name];
 067          }
 068   
 069          if ($multibyte)
 070          {
 071              return utf8_normalize_nfc($result);
 072          }
 073   
 074          return $result;
 075      }
 076   
 077      /**
 078       * {@inheritdoc}
 079       */
 080      public function get_raw_input($name, $default)
 081      {
 082          return $this->get_input($name, $default, true);
 083      }
 084   
 085      /**
 086       * Set input variable
 087       *
 088       * @param string $name Name of input variable
 089       * @param mixed $value Value of input variable
 090       */
 091      public function set_input($name, $value)
 092      {
 093          $this->input_values[$name] = $value;
 094      }
 095   
 096      /**
 097       * {@inheritdoc}
 098       */
 099      public function get_server_variable($name, $default = '')
 100      {
 101          return $default;
 102      }
 103   
 104      /**
 105       * {@inheritdoc}
 106       */
 107      public function get_header_variable($name, $default = '')
 108      {
 109          return $default;
 110      }
 111   
 112      /**
 113       * {@inheritdoc}
 114       */
 115      public function is_secure()
 116      {
 117          return false;
 118      }
 119   
 120      /**
 121       * {@inheritdoc}
 122       */
 123      public function add_user_form_group($title, $form)
 124      {
 125          throw new installer_exception('MISSING_DATA');
 126      }
 127   
 128      /**
 129       * {@inheritdoc}
 130       */
 131      public function send_response($no_more_output = false)
 132      {
 133      }
 134   
 135      /**
 136       * {@inheritdoc
 137       */
 138      public function add_error_message($error_title, $error_description = false)
 139      {
 140          $this->io->newLine();
 141          $message = $this->translate_message($error_title, $error_description);
 142          $message_string = $message['title'] . (!empty($message['description']) ? "\n" . $message['description'] : '');
 143   
 144          if (strpos($message_string, '<br />') !== false)
 145          {
 146              $message_string = strip_tags(str_replace('<br />', "\n", $message_string));
 147          }
 148   
 149          $this->io->error($message_string);
 150   
 151          if ($this->progress_bar !== null)
 152          {
 153              $this->io->newLine(2);
 154              $this->progress_bar->display();
 155          }
 156      }
 157   
 158      /**
 159       * {@inheritdoc
 160       */
 161      public function add_warning_message($warning_title, $warning_description = false)
 162      {
 163          $this->io->newLine();
 164   
 165          $message = $this->translate_message($warning_title, $warning_description);
 166          $message_string = $message['title'] . (!empty($message['description']) ? "\n" . $message['description'] : '');
 167          $this->io->warning($message_string);
 168   
 169          if ($this->progress_bar !== null)
 170          {
 171              $this->io->newLine(2);
 172              $this->progress_bar->display();
 173          }
 174      }
 175   
 176      /**
 177       * {@inheritdoc
 178       */
 179      public function add_log_message($log_title, $log_description = false)
 180      {
 181          if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL)
 182          {
 183              $message = $this->translate_message($log_title, $log_description);
 184              $this->output->writeln(sprintf('[%3d/%-3d] ---- %s', $this->current_task_progress, $this->task_progress_count, $message['title']));
 185          }
 186      }
 187   
 188      /**
 189       * {@inheritdoc
 190       */
 191      public function add_success_message($error_title, $error_description = false)
 192      {
 193          $this->io->newLine();
 194   
 195          $message = $this->translate_message($error_title, $error_description);
 196          $message_string = $message['title'] . (!empty($message['description']) ? "\n" . $message['description'] : '');
 197          $this->io->success($message_string);
 198   
 199          if ($this->progress_bar !== null)
 200          {
 201              $this->io->newLine(2);
 202              $this->progress_bar->display();
 203          }
 204      }
 205   
 206      /**
 207       * {@inheritdoc}
 208       */
 209      public function set_task_count($task_count, $restart = false)
 210      {
 211          parent::set_task_count($task_count, $restart);
 212   
 213          if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL)
 214          {
 215              if ($this->progress_bar !== null)
 216              {
 217                  // Symfony's ProgressBar is immutable regarding task_count, so delete the old and create a new one.
 218                  $this->progress_bar->clear();
 219              }
 220              else
 221              {
 222                  $this->io->newLine(2);
 223              }
 224   
 225              $this->progress_bar = $this->io->createProgressBar($task_count);
 226              $this->progress_bar->setFormat(
 227                  "    %current:3s%/%max:-3s% %bar%  %percent:3s%%\n" .
 228                  "             %message%\n");
 229              $this->progress_bar->setBarWidth(60);
 230   
 231              if (!defined('PHP_WINDOWS_VERSION_BUILD'))
 232              {
 233                  $this->progress_bar->setEmptyBarCharacter('░'); // light shade character \u2591
 234                  $this->progress_bar->setProgressCharacter('');
 235                  $this->progress_bar->setBarCharacter('▓'); // dark shade character \u2593
 236              }
 237   
 238              $this->progress_bar->setMessage('');
 239              $this->progress_bar->start();
 240          }
 241      }
 242   
 243      /**
 244       * {@inheritdoc}
 245       */
 246      public function set_progress($task_lang_key, $task_number)
 247      {
 248          parent::set_progress($task_lang_key, $task_number);
 249   
 250          if ($this->progress_bar !== null)
 251          {
 252              $this->progress_bar->setProgress($this->current_task_progress);
 253              $this->progress_bar->setMessage($this->current_task_name);
 254          }
 255          else
 256          {
 257              $this->output->writeln(sprintf('[%3d/%-3d] %s', $this->current_task_progress, $this->task_progress_count, $this->current_task_name));
 258          }
 259      }
 260   
 261      /**
 262       * {@inheritdoc}
 263       */
 264      public function finish_progress($message_lang_key)
 265      {
 266          parent::finish_progress($message_lang_key);
 267   
 268          if ($this->progress_bar !== null)
 269          {
 270              $this->progress_bar->finish();
 271              $this->progress_bar = null;
 272          }
 273      }
 274   
 275      /**
 276       * {@inheritdoc}
 277       */
 278      public function request_refresh()
 279      {
 280      }
 281   
 282      /**
 283       * {@inheritdoc}
 284       */
 285      public function set_active_stage_menu($menu_path)
 286      {
 287      }
 288   
 289      /**
 290       * {@inheritdoc}
 291       */
 292      public function set_finished_stage_menu($menu_path)
 293      {
 294      }
 295   
 296      /**
 297       * {@inheritdoc}
 298       */
 299      public function set_cookie($cookie_name, $cookie_value)
 300      {
 301      }
 302   
 303      /**
 304       * {@inheritdoc}
 305       */
 306      public function add_download_link($route, $title, $msg = null)
 307      {
 308      }
 309   
 310      /**
 311       * {@inheritdoc}
 312       */
 313      public function render_update_file_status($status_array)
 314      {
 315      }
 316   
 317      /**
 318       * {@inheritdoc}
 319       */
 320      public function redirect($url, $use_ajax = false)
 321      {
 322      }
 323  }
 324