Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

release_3_0_11_rc1.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 2.44 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\db\migration\data\v30x;
 015   
 016  class release_3_0_11_rc1 extends \phpbb\db\migration\migration
 017  {
 018      public function effectively_installed()
 019      {
 020          return phpbb_version_compare($this->config['version'], '3.0.11-RC1', '>=');
 021      }
 022   
 023      static public function depends_on()
 024      {
 025          return array('\phpbb\db\migration\data\v30x\release_3_0_10');
 026      }
 027   
 028      public function update_data()
 029      {
 030          return array(
 031              array('custom', array(array(&$this, 'cleanup_deactivated_styles'))),
 032              array('custom', array(array(&$this, 'delete_orphan_private_messages'))),
 033   
 034              array('config.update', array('version', '3.0.11-RC1')),
 035          );
 036      }
 037   
 038      public function cleanup_deactivated_styles()
 039      {
 040          // Updates users having current style a deactivated one
 041          $sql = 'SELECT style_id
 042              FROM ' . STYLES_TABLE . '
 043              WHERE style_active = 0';
 044          $result = $this->sql_query($sql);
 045   
 046          $deactivated_style_ids = array();
 047          while ($style_id = $this->db->sql_fetchfield('style_id', false, $result))
 048          {
 049              $deactivated_style_ids[] = (int) $style_id;
 050          }
 051          $this->db->sql_freeresult($result);
 052   
 053          if (!empty($deactivated_style_ids))
 054          {
 055              $sql = 'UPDATE ' . USERS_TABLE . '
 056                  SET user_style = ' . (int) $this->config['default_style'] .'
 057                  WHERE ' . $this->db->sql_in_set('user_style', $deactivated_style_ids);
 058              $this->sql_query($sql);
 059          }
 060      }
 061   
 062      public function delete_orphan_private_messages()
 063      {
 064          // Delete orphan private messages
 065          $batch_size = 500;
 066   
 067          $sql_array = array(
 068              'SELECT'    => 'p.msg_id',
 069              'FROM'        => array(
 070                  PRIVMSGS_TABLE    => 'p',
 071              ),
 072              'LEFT_JOIN'    => array(
 073                  array(
 074                      'FROM'    => array(PRIVMSGS_TO_TABLE => 't'),
 075                      'ON'    => 'p.msg_id = t.msg_id',
 076                  ),
 077              ),
 078              'WHERE'        => 't.user_id IS NULL',
 079          );
 080          $sql = $this->db->sql_build_query('SELECT', $sql_array);
 081   
 082          $result = $this->db->sql_query_limit($sql, $batch_size);
 083   
 084          $delete_pms = array();
 085          while ($row = $this->db->sql_fetchrow($result))
 086          {
 087              $delete_pms[] = (int) $row['msg_id'];
 088          }
 089          $this->db->sql_freeresult($result);
 090   
 091          if (!empty($delete_pms))
 092          {
 093              $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
 094                  WHERE ' . $this->db->sql_in_set('msg_id', $delete_pms);
 095              $this->sql_query($sql);
 096   
 097              // Return false to have the Migrator call this function again
 098              return false;
 099          }
 100      }
 101  }
 102