Ejemplo n.º 1
0
 /**
  * don't call this function
  * This is a temporary method used for mailbox plugin update.
  *
  * @param array $conversationIdList
  * @return array<MAILBOX_BOL_Attachment>
  */
 public function removeNl2br()
 {
     if (!OW::getConfig()->configExists('mailbox', 'update_to_revision_3081')) {
         return;
     }
     if (!OW::getConfig()->configExists('mailbox', 'last_updated_id')) {
         OW::getConfig()->addConfig('mailbox', 'last_updated_id', 0, '');
     }
     $lastId = OW::getConfig()->getValue('mailbox', 'last_updated_id');
     $messageList = $this->messageDao->findNotUpdatedMessages($lastId, 2000);
     if (empty($messageList)) {
         OW::getConfig()->deleteConfig('mailbox', 'update_to_revision_3081');
         OW::getConfig()->deleteConfig('mailbox', 'last_updated_id');
         return;
     }
     $count = 0;
     foreach ($messageList as $message) {
         $message->text = nl2br($message->text);
         $this->messageDao->save($message);
         $count++;
         if ($count > 100) {
             OW::getConfig()->saveConfig('mailbox', 'last_updated_id', $message->id);
         }
     }
     OW::getConfig()->saveConfig('mailbox', 'last_updated_id', $message->id);
 }
Ejemplo n.º 2
0
 /**
  * Do not call this method
  * This is a temporary method used for mailbox plugin update.
  *
  * @return array<MAILBOX_BOL_Attachment>
  */
 public function convertHtmlTags()
 {
     if (!OW::getConfig()->configExists('mailbox', 'update_to_revision_7200')) {
         return;
     }
     $lastId = OW::getConfig()->getValue('mailbox', 'last_updated_id');
     $messageList = $this->messageDao->findNotUpdatedMessages($lastId, 2000);
     if (empty($messageList)) {
         OW::getConfig()->deleteConfig('mailbox', 'update_to_revision_7200');
         OW::getConfig()->deleteConfig('mailbox', 'last_updated_id');
         return;
     }
     $count = 0;
     foreach ($messageList as $message) {
         $message->text = preg_replace("/\n/", "", $message->text);
         $message->text = preg_replace("/<br \\/>/", "\n", $message->text);
         $message->text = strip_tags($message->text);
         $this->messageDao->save($message);
         $count++;
         if ($count > 100) {
             OW::getConfig()->saveConfig('mailbox', 'last_updated_id', $message->id);
         }
     }
     OW::getConfig()->saveConfig('mailbox', 'last_updated_id', $message->id);
 }