diff options
Diffstat (limited to 'phpBB/phpbb/console')
-rw-r--r-- | phpBB/phpbb/console/command/extension/enable.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/console/command/thumbnail/delete.php | 13 | ||||
-rw-r--r-- | phpBB/phpbb/console/command/thumbnail/generate.php | 13 | ||||
-rw-r--r-- | phpBB/phpbb/console/exception_subscriber.php | 13 |
4 files changed, 29 insertions, 17 deletions
diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index f92de0069c..a6f5b10e86 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -37,6 +37,13 @@ class enable extends command $io = new SymfonyStyle($input, $output); $name = $input->getArgument('extension-name'); + + if (!$this->manager->is_available($name)) + { + $io->error($this->user->lang('CLI_EXTENSION_NOT_EXIST', $name)); + return 1; + } + $extension = $this->manager->get_extension($name); if (!$extension->is_enableable()) diff --git a/phpBB/phpbb/console/command/thumbnail/delete.php b/phpBB/phpbb/console/command/thumbnail/delete.php index cfa9891fbc..7b95c20cf2 100644 --- a/phpBB/phpbb/console/command/thumbnail/delete.php +++ b/phpBB/phpbb/console/command/thumbnail/delete.php @@ -19,6 +19,11 @@ use Symfony\Component\Console\Style\SymfonyStyle; class delete extends \phpbb\console\command\command { /** + * @var \phpbb\config\config + */ + protected $config; + + /** * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -32,12 +37,14 @@ class delete extends \phpbb\console\command\command /** * Constructor * + * @param \config\config $config The config * @param \phpbb\user $user The user object (used to get language information) * @param \phpbb\db\driver\driver_interface $db Database connection * @param string $phpbb_root_path Root path */ - public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db, $phpbb_root_path) + public function __construct(\phpbb\config\config $config, \phpbb\user $user, \phpbb\db\driver\driver_interface $db, $phpbb_root_path) { + $this->config = $config; $this->db = $db; $this->phpbb_root_path = $phpbb_root_path; @@ -101,13 +108,13 @@ class delete extends \phpbb\console\command\command $return = 0; while ($row = $this->db->sql_fetchrow($result)) { - $thumbnail_path = $this->phpbb_root_path . 'files/thumb_' . $row['physical_filename']; + $thumbnail_path = $this->phpbb_root_path . $this->config['upload_path'] . '/thumb_' . $row['physical_filename']; if (@unlink($thumbnail_path)) { $thumbnail_deleted[] = $row['attach_id']; - if (sizeof($thumbnail_deleted) === 250) + if (count($thumbnail_deleted) === 250) { $this->commit_changes($thumbnail_deleted); $thumbnail_deleted = array(); diff --git a/phpBB/phpbb/console/command/thumbnail/generate.php b/phpBB/phpbb/console/command/thumbnail/generate.php index 64f7555336..1f6582b17b 100644 --- a/phpBB/phpbb/console/command/thumbnail/generate.php +++ b/phpBB/phpbb/console/command/thumbnail/generate.php @@ -20,6 +20,11 @@ use Symfony\Component\Console\Style\SymfonyStyle; class generate extends \phpbb\console\command\command { /** + * @var \phpbb\config\config + */ + protected $config; + + /** * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -45,14 +50,16 @@ class generate extends \phpbb\console\command\command /** * Constructor * + * @param \config\config $config The config * @param \phpbb\user $user The user object (used to get language information) * @param \phpbb\db\driver\driver_interface $db Database connection * @param \phpbb\cache\service $cache The cache service * @param string $phpbb_root_path Root path * @param string $php_ext PHP extension */ - public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\config\config $config, \phpbb\user $user, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $phpbb_root_path, $php_ext) { + $this->config = $config; $this->db = $db; $this->cache = $cache; $this->phpbb_root_path = $phpbb_root_path; @@ -126,8 +133,8 @@ class generate extends \phpbb\console\command\command { if (isset($extensions[$row['extension']]['display_cat']) && $extensions[$row['extension']]['display_cat'] == ATTACHMENT_CATEGORY_IMAGE) { - $source = $this->phpbb_root_path . 'files/' . $row['physical_filename']; - $destination = $this->phpbb_root_path . 'files/thumb_' . $row['physical_filename']; + $source = $this->phpbb_root_path . $this->config['upload_path'] . '/' . $row['physical_filename']; + $destination = $this->phpbb_root_path . $this->config['upload_path'] . '/thumb_' . $row['physical_filename']; if (create_thumbnail($source, $destination, $row['mimetype'])) { diff --git a/phpBB/phpbb/console/exception_subscriber.php b/phpBB/phpbb/console/exception_subscriber.php index b920d4abae..b240993203 100644 --- a/phpBB/phpbb/console/exception_subscriber.php +++ b/phpBB/phpbb/console/exception_subscriber.php @@ -29,12 +29,10 @@ class exception_subscriber implements EventSubscriberInterface * Construct method * * @param \phpbb\language\language $language Language object - * @param bool $debug Debug mode */ - public function __construct(\phpbb\language\language $language, $debug = false) + public function __construct(\phpbb\language\language $language) { $this->language = $language; - $this->debug = $debug; } /** @@ -52,14 +50,7 @@ class exception_subscriber implements EventSubscriberInterface $parameters = array_merge(array($original_exception->getMessage()), $original_exception->get_parameters()); $message = call_user_func_array(array($this->language, 'lang'), $parameters); - if ($this->debug) - { - $exception = new \RuntimeException($message , $original_exception->getCode(), $original_exception); - } - else - { - $exception = new \RuntimeException($message , $original_exception->getCode()); - } + $exception = new \RuntimeException($message , $original_exception->getCode(), $original_exception); $event->setException($exception); } |