From a73a53c8ef3ea654455af52db3c00de554efc4ad Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 27 Jan 2024 09:58:01 +0100 Subject: [PATCH] Replace deprecated methods use --- phpstan-baseline.neon | 69 ------------------- plugins/archive/archive.php | 2 +- plugins/managesieve/managesieve.php | 2 +- plugins/markasjunk/markasjunk.php | 4 +- .../vcard_attachments/vcard_attachments.php | 4 +- plugins/zipdownload/zipdownload.php | 2 +- program/actions/mail/compose.php | 2 +- program/actions/mail/delete.php | 2 +- program/actions/mail/move.php | 4 +- program/include/rcmail_sendmail.php | 4 +- 10 files changed, 13 insertions(+), 82 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index caf244ec121..c24d032dcd5 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -15,14 +15,6 @@ parameters: count: 18 path: installer/test.php - - - message: """ - #^Call to deprecated method get_uids\\(\\) of class rcmail\\: - since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$# - """ - count: 1 - path: plugins/archive/archive.php - - message: "#^Access to an undefined property rcube\\:\\:\\$task\\.$#" count: 1 @@ -253,14 +245,6 @@ parameters: count: 2 path: plugins/managesieve/managesieve.php - - - message: """ - #^Call to deprecated method get_uids\\(\\) of class rcmail\\: - since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$# - """ - count: 1 - path: plugins/managesieve/managesieve.php - - message: "#^Call to an undefined method rcube_storage\\:\\:registerFunction\\(\\)\\.$#" count: 1 @@ -276,14 +260,6 @@ parameters: count: 2 path: plugins/markasjunk/markasjunk.php - - - message: """ - #^Call to deprecated method get_uids\\(\\) of class rcmail\\: - since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$# - """ - count: 1 - path: plugins/markasjunk/markasjunk.php - - message: "#^Access to an undefined property COM\\:\\:\\$Domains\\.$#" count: 1 @@ -364,19 +340,6 @@ parameters: count: 1 path: plugins/subscriptions_option/tests/SubscriptionsOption.php - - - message: "#^Call to deprecated method get_part_content\\(\\) of class rcube_message\\.$#" - count: 1 - path: plugins/vcard_attachments/vcard_attachments.php - - - - message: """ - #^Call to deprecated method get_uids\\(\\) of class rcmail\\: - since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$# - """ - count: 1 - path: plugins/zipdownload/zipdownload.php - - message: "#^Method rcube_storage\\:\\:index\\(\\) invoked with 4 parameters, 0\\-3 required\\.$#" count: 1 @@ -437,27 +400,11 @@ parameters: count: 1 path: program/actions/mail/compose.php - - - message: """ - #^Call to deprecated method table_output\\(\\) of class rcmail\\: - since 1\\.5\\-beta, use rcmail_action\\:\\:table_output\\(\\)$# - """ - count: 1 - path: program/actions/mail/compose.php - - message: "#^Variable \\$to_addresses in empty\\(\\) always exists and is not falsy\\.$#" count: 1 path: program/actions/mail/compose.php - - - message: """ - #^Call to deprecated method get_uids\\(\\) of class rcmail\\: - since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$# - """ - count: 1 - path: program/actions/mail/delete.php - - message: "#^Access to an undefined property object\\:\\:\\$charset\\.$#" count: 2 @@ -508,14 +455,6 @@ parameters: count: 1 path: program/actions/mail/index.php - - - message: """ - #^Call to deprecated method get_uids\\(\\) of class rcmail\\: - since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$# - """ - count: 1 - path: program/actions/mail/move.php - - message: "#^Result of method rcube_result_set\\:\\:next\\(\\) \\(void\\) is used\\.$#" count: 2 @@ -661,14 +600,6 @@ parameters: count: 1 path: program/include/rcmail_sendmail.php - - - message: """ - #^Call to deprecated method get_uids\\(\\) of class rcmail\\: - since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$# - """ - count: 2 - path: program/include/rcmail_sendmail.php - - message: "#^Call to method getMessage\\(\\) on an unknown class PEAR_Error\\.$#" count: 1 diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php index dede1e56cde..1404ff94e15 100644 --- a/plugins/archive/archive.php +++ b/plugins/archive/archive.php @@ -153,7 +153,7 @@ public function move_messages() 'destinations' => [], ]; - foreach (rcmail::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST) as $mbox => $uids) { + foreach (rcmail_action::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST) as $mbox => $uids) { if (!$this->archive_folder || $mbox === $this->archive_folder || strpos($mbox, $archive_prefix) === 0) { $count = count($uids); continue; diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php index cc31478eae5..2803980f74a 100644 --- a/plugins/managesieve/managesieve.php +++ b/plugins/managesieve/managesieve.php @@ -217,7 +217,7 @@ public function mail_headers($args) */ public function managesieve_actions() { - $uids = rcmail::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST); + $uids = rcmail_action::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST); // handle fetching email headers for the new filter form if (!empty($uids)) { diff --git a/plugins/markasjunk/markasjunk.php b/plugins/markasjunk/markasjunk.php index 06e00aa78e3..b1a2dd82a22 100644 --- a/plugins/markasjunk/markasjunk.php +++ b/plugins/markasjunk/markasjunk.php @@ -138,11 +138,11 @@ public function mark_message() $is_spam = $this->rcube->action == 'plugin.markasjunk.junk'; $uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST); $mbox_name = rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_POST); - $messageset = rcmail::get_uids($uids, $mbox_name, $multifolder); + $messageset = rcmail_action::get_uids($uids, $mbox_name, $multifolder); $dest_mbox = $is_spam ? $this->spam_mbox : $this->ham_mbox; // special case when select all is used, uid is '*', and not in multi folder mode and we are using a driver - // rcmail::get_uids does not handle this + // rcmail_action::get_uids does not handle this if ($uids == '*' && !$multifolder && is_object($this->driver)) { $storage = $this->rcube->get_storage(); $result_index = $storage->index($mbox_name); diff --git a/plugins/vcard_attachments/vcard_attachments.php b/plugins/vcard_attachments/vcard_attachments.php index 9b42e1c1364..ae6ae18fd34 100644 --- a/plugins/vcard_attachments/vcard_attachments.php +++ b/plugins/vcard_attachments/vcard_attachments.php @@ -106,7 +106,7 @@ public function message_objects($p) $contacts = []; foreach ($this->vcard_parts as $part) { - $vcards = rcube_vcard::import($this->message->get_part_content($part, null, true)); + $vcards = rcube_vcard::import($this->message->get_part_body($part)); foreach ($vcards as $idx => $vcard) { // skip invalid vCards @@ -207,7 +207,7 @@ public function save_vcard() } foreach ($index as $part_id => $mime_ids) { - $part = $message->get_part_content($part_id, null, true); + $part = $message->get_part_body($part_id); if (!empty($part) && ($part_vcards = rcube_vcard::import($part))) { foreach ($mime_ids as $id) { diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php index b257852ffd3..e3003bebc84 100644 --- a/plugins/zipdownload/zipdownload.php +++ b/plugins/zipdownload/zipdownload.php @@ -176,7 +176,7 @@ public function download_messages() $rcmail = rcmail::get_instance(); if ($rcmail->config->get('zipdownload_selection', $this->default_limit)) { - $messageset = rcmail::get_uids(null, null, $multi, rcube_utils::INPUT_POST); + $messageset = rcmail_action::get_uids(null, null, $multi, rcube_utils::INPUT_POST); if (count($messageset)) { $this->_download_messages($messageset); } diff --git a/program/actions/mail/compose.php b/program/actions/mail/compose.php index a1bfe3cd211..cafc464b716 100644 --- a/program/actions/mail/compose.php +++ b/program/actions/mail/compose.php @@ -1577,7 +1577,7 @@ public static function contacts_list($attrib = []) $rcmail->output->set_env('current_page', 0); $rcmail->output->include_script('list.js'); - return $rcmail->table_output($attrib, [], ['name'], 'ID'); + return rcmail_action::table_output($attrib, [], ['name'], 'ID'); } /** diff --git a/program/actions/mail/delete.php b/program/actions/mail/delete.php index dc44ac6429f..1348d867cbe 100644 --- a/program/actions/mail/delete.php +++ b/program/actions/mail/delete.php @@ -47,7 +47,7 @@ public function run($args = []) $rcmail->output->send(); } - foreach (rcmail::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST) as $mbox => $uids) { + foreach (rcmail_action::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST) as $mbox => $uids) { $deleted += (int) $rcmail->storage->delete_message($uids, $mbox); $count += is_array($uids) ? count($uids) : 1; $sources[] = $mbox; diff --git a/program/actions/mail/move.php b/program/actions/mail/move.php index 3778c82004c..78c771a680f 100644 --- a/program/actions/mail/move.php +++ b/program/actions/mail/move.php @@ -39,7 +39,7 @@ public function run($args = []) $old_count = $rcmail->storage->count(null, $threading ? 'THREADS' : 'ALL'); } - $target = rcube_utils::get_input_string('_target_mbox', rcube_utils::INPUT_POST, true); + $target = rcube_utils::get_input_string('_target_mbox', rcube_utils::INPUT_POST, true); if (empty($_POST['_uid']) || !strlen($target)) { $rcmail->output->show_message('internalerror', 'error'); @@ -51,7 +51,7 @@ public function run($args = []) $count = 0; $sources = []; - foreach (rcmail::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST) as $mbox => $uids) { + foreach (rcmail_action::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST) as $mbox => $uids) { if ($mbox === $target) { $count += is_array($uids) ? count($uids) : 1; } elseif ($rcmail->storage->move_message($uids, $target, $mbox)) { diff --git a/program/include/rcmail_sendmail.php b/program/include/rcmail_sendmail.php index ac1ad4cfca1..c50f1169dba 100644 --- a/program/include/rcmail_sendmail.php +++ b/program/include/rcmail_sendmail.php @@ -459,14 +459,14 @@ public function deliver_message($message, $disconnect = true) // set replied/forwarded flag if (!empty($this->data['reply_uid'])) { - foreach (rcmail::get_uids($this->data['reply_uid'], $this->data['mailbox']) as $mbox => $uids) { + foreach (rcmail_action::get_uids($this->data['reply_uid'], $this->data['mailbox']) as $mbox => $uids) { // skip . replies if (!preg_match('/^\d+\.[0-9.]+$/', implode(',', (array) $uids))) { $this->rcmail->storage->set_flag($uids, 'ANSWERED', $mbox); } } } elseif (!empty($this->data['forward_uid'])) { - foreach (rcmail::get_uids($this->data['forward_uid'], $this->data['mailbox']) as $mbox => $uids) { + foreach (rcmail_action::get_uids($this->data['forward_uid'], $this->data['mailbox']) as $mbox => $uids) { // skip . forwards if (!preg_match('/^\d+\.[0-9.]+$/', implode(',', (array) $uids))) { $this->rcmail->storage->set_flag($uids, 'FORWARDED', $mbox);