Przeglądaj źródła

Update Update.php

Visman 2 lat temu
rodzic
commit
055673ad58
1 zmienionych plików z 0 dodań i 412 usunięć
  1. 0 412
      app/Models/Pages/Admin/Update.php

+ 0 - 412
app/Models/Pages/Admin/Update.php

@@ -410,416 +410,4 @@ class Update extends Admin
 #
 #        return null;
 #    }
-
-    /**
-     * rev.42 to rev.43
-     */
-    protected function stageNumber42(array $args): ?int
-    {
-        $query = 'DELETE FROM ::users WHERE id=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::forums SET last_poster_id=0 WHERE last_poster_id=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::online SET user_id=0 WHERE user_id=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::pm_posts SET poster_id=0 WHERE poster_id=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::pm_topics SET poster_id=0 WHERE poster_id=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::pm_topics SET target_id=0 WHERE target_id=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::posts SET poster_id=0 WHERE poster_id=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::posts SET editor_id=0 WHERE editor_id=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::reports SET reported_by=0 WHERE reported_by=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::reports SET zapped_by=0 WHERE zapped_by=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::topics SET poster_id=0 WHERE poster_id=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::topics SET last_poster_id=0 WHERE last_poster_id=1';
-
-        $this->c->DB->exec($query);
-
-        $query = 'UPDATE ::warnings SET poster_id=0 WHERE poster_id=1';
-
-        $this->c->DB->exec($query);
-
-        $coreConfig = new CoreConfig($this->configFile);
-
-        $coreConfig->add(
-            'shared=>Groups/save',
-            '\\ForkBB\\Models\\Group\\Save::class',
-            'Group/save'
-        );
-
-        $coreConfig->add(
-            'shared=>Groups/perm',
-            '\\ForkBB\\Models\\Group\\Perm::class',
-            'Group/save'
-        );
-
-        $coreConfig->add(
-            'shared=>Groups/delete',
-            '\\ForkBB\\Models\\Group\\Delete::class',
-            'Group/save'
-        );
-
-        $result = $coreConfig->delete('shared=>Group/delete');
-        $result = $coreConfig->delete('shared=>Group/perm');
-        $result = $coreConfig->delete('shared=>Group/save');
-
-        $coreConfig->save();
-
-        $this->c->config->a_guest_set = [
-            'show_smilies' => 1,
-            'show_sig'     => 1,
-            'show_avatars' => 1,
-            'show_img'     => 1,
-            'show_img_sig' => 1,
-        ];
-
-        $this->c->config->save();
-
-        return null;
-    }
-
-    /**
-     * rev.43 to rev.44
-     */
-    protected function stageNumber43(array $args): ?int
-    {
-        $config = $this->c->config;
-
-        $config->i_timeout_visit       = $config->o_timeout_visit ?? 3600;
-        $config->i_timeout_online      = $config->o_timeout_online ?? 900;
-        $config->i_redirect_delay      = $config->o_redirect_delay ?? 1;
-        $config->b_show_user_info      = '1' == $config->o_show_user_info ? 1 : 0;
-        $config->b_show_post_count     = '1' == $config->o_show_post_count ? 1 : 0;
-        $config->b_smilies_sig         = '1' == $config->o_smilies_sig ? 1 : 0;
-        $config->b_smilies             = '1' == $config->o_smilies ? 1 : 0;
-        $config->b_make_links          = '1' == $config->o_make_links ? 1 : 0;
-        $config->b_quickpost           = '1' == $config->o_quickpost ? 1 : 0;
-        $config->b_users_online        = '1' == $config->o_users_online ? 1 : 0;
-        $config->b_censoring           = '1' == $config->o_censoring ? 1 : 0;
-        $config->b_show_dot            = '1' == $config->o_show_dot ? 1 : 0;
-        $config->b_topic_views         = '1' == $config->o_topic_views ? 1 : 0;
-        $config->b_regs_report         = '1' == $config->o_regs_report ? 1 : 0;
-        $config->b_avatars             = '1' == $config->o_avatars ? 1 : 0;
-        $config->b_forum_subscriptions = '1' == $config->o_forum_subscriptions ? 1 : 0;
-        $config->b_topic_subscriptions = '1' == $config->o_topic_subscriptions ? 1 : 0;
-        $config->b_smtp_ssl            = '1' == $config->o_smtp_ssl ? 1 : 0;
-        $config->b_regs_allow          = '1' == $config->o_regs_allow ? 1 : 0;
-        $config->b_announcement        = '1' == $config->o_announcement ? 1 : 0;
-        $config->b_rules               = '1' == $config->o_rules ? 1 : 0;
-        $config->b_maintenance         = '1' == $config->o_maintenance ? 1 : 0;
-        $config->b_default_dst         = '1' == $config->o_default_dst ? 1 : 0;
-        $config->b_message_bbcode      = '1' == $config->p_message_bbcode ? 1 : 0;
-        $config->b_message_all_caps    = '1' == $config->p_message_all_caps ? 1 : 0;
-        $config->b_subject_all_caps    = '1' == $config->p_subject_all_caps ? 1 : 0;
-        $config->b_sig_all_caps        = '1' == $config->p_sig_all_caps ? 1 : 0;
-        $config->b_sig_bbcode          = '1' == $config->p_sig_bbcode ? 1 : 0;
-        $config->b_force_guest_email   = '1' == $config->p_force_guest_email ? 1 : 0;
-
-        unset($config->p_force_guest_email);
-        unset($config->p_sig_bbcode);
-        unset($config->p_sig_all_caps);
-        unset($config->p_subject_all_caps);
-        unset($config->p_message_all_caps);
-        unset($config->p_message_bbcode);
-        unset($config->o_default_dst);
-        unset($config->o_maintenance);
-        unset($config->o_rules);
-        unset($config->o_announcement);
-        unset($config->o_regs_allow);
-        unset($config->o_smtp_ssl);
-        unset($config->o_topic_subscriptions);
-        unset($config->o_forum_subscriptions);
-        unset($config->o_avatars);
-        unset($config->o_regs_report);
-        unset($config->o_topic_views);
-        unset($config->o_show_dot);
-        unset($config->o_timeout_visit);
-        unset($config->o_timeout_online);
-        unset($config->o_redirect_delay);
-        unset($config->o_show_user_info);
-        unset($config->o_show_post_count);
-        unset($config->o_smilies_sig);
-        unset($config->o_smilies);
-        unset($config->o_make_links);
-        unset($config->o_quickpost);
-        unset($config->o_users_online);
-        unset($config->o_censoring);
-        unset($config->o_quickjump);
-        unset($config->o_search_all_forums);
-
-        $config->save();
-
-        return null;
-    }
-
-    /**
-     * rev.44 to rev.45
-     */
-    protected function stageNumber44(array $args): ?int
-    {
-        if (! $this->c->DB->query('SELECT id FROM ::bbcode WHERE bb_tag=?s', ['from'])->fetchColumn()) {
-            $bbcodes = include $this->c->DIR_CONFIG . '/defaultBBCode.php';
-
-            foreach ($bbcodes as $bbcode) {
-                if ('from' !== $bbcode['tag']) {
-                    continue;
-                }
-
-                $vars = [
-                    ':tag'       => $bbcode['tag'],
-                    ':structure' => \json_encode($bbcode, self::JSON_OPTIONS),
-                ];
-                $query = 'INSERT INTO ::bbcode (bb_tag, bb_edit, bb_delete, bb_structure)
-                    VALUES(?s:tag, 1, 0, ?s:structure)';
-
-                $this->c->DB->exec($query, $vars);
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * rev.45 to rev.46
-     */
-    protected function stageNumber45(array $args): ?int
-    {
-        $coreConfig = new CoreConfig($this->configFile);
-
-        $coreConfig->add(
-            'shared=>Cache=>reset_mark',
-            '\'%DB_DSN% %DB_PREFIX%\'',
-            'cache_dir'
-        );
-
-        $coreConfig->save();
-
-        // чтобы кэш не был сброшен до завершения обновления
-        $hash = \sha1($this->c->DB_DSN . ' ' . $this->c->DB_PREFIX);
-
-        $this->c->Cache->set('reset_mark_hash', $hash);
-
-        return null;
-    }
-
-    /**
-     * rev.46 to rev.47
-     */
-    protected function stageNumber46(array $args): ?int
-    {
-        $coreConfig = new CoreConfig($this->configFile);
-
-        $coreConfig->add(
-            'shared=>Mail=>ssl',
-            '\'%config.b_smtp_ssl%\''
-        );
-
-        $coreConfig->save();
-
-        return null;
-    }
-
-    /**
-     * rev.47 to rev.48
-     */
-    protected function stageNumber47(array $args): ?int
-    {
-        $config = $this->c->config;
-
-        $config->s_РЕГИСТР = 'Ok';
-
-        $config->save();
-
-        $coreConfig = new CoreConfig($this->configFile);
-
-        $coreConfig->add(
-            'shared=>Config/insensitive',
-            '\\ForkBB\\Models\\Config\\Insensitive::class',
-            'Config/save'
-        );
-
-        $coreConfig->save();
-
-        return null;
-    }
-
-    /**
-     * rev.48 to rev.49
-     */
-    protected function stageNumber48(array $args): ?int
-    {
-        $coreConfig = new CoreConfig($this->configFile);
-
-        $coreConfig->add(
-            'DATE_FORMATS',
-            ['\'Y-m-d\'', '\'d M Y\'', '\'Y-m-d\'', '\'Y-d-m\'', '\'d-m-Y\'', '\'m-d-Y\'', '\'M j Y\'', '\'jS M Y\''],
-            'HTTP_HEADERS'
-        );
-
-        $coreConfig->add(
-            'TIME_FORMATS',
-            ['\'H:i:s\'', '\'H:i\'', '\'H:i:s\'', '\'H:i\'', '\'g:i:s a\'', '\'g:i a\''],
-            'DATE_FORMATS'
-        );
-
-        $coreConfig->add(
-            'shared=>%DIR_VIEWS%',
-            '\'%DIR_APP%/templates\'',
-            'DB'
-        );
-
-        $coreConfig->add(
-            'shared=>%DIR_LOG%',
-            '\'%DIR_APP%/log\'',
-            'DB'
-        );
-
-        $coreConfig->add(
-            'shared=>%DIR_LANG%',
-            '\'%DIR_APP%/lang\'',
-            'DB'
-        );
-
-        $coreConfig->add(
-            'shared=>%DIR_CONFIG%',
-            '\'%DIR_APP%/config\'',
-            'DB'
-        );
-
-        $coreConfig->add(
-            'shared=>%DIR_CACHE%',
-            '\'%DIR_APP%/cache\'',
-            'DB'
-        );
-
-        $coreConfig->add(
-            'shared=>%DIR_APP%',
-            '\'%DIR_ROOT%/app\'',
-            'DB'
-        );
-
-        $coreConfig->add(
-            'shared=>%DIR_PUBLIC%',
-            '\'%DIR_ROOT%/public\'',
-            'DB'
-        );
-
-        $coreConfig->add(
-            'shared=>%DIR_ROOT%',
-            '\\realpath(__DIR__ . \'/../..\')',
-            'DB'
-        );
-
-        $coreConfig->add(
-            'shared=>HTMLCleaner=>config',
-            '\'%DIR_CONFIG%/jevix.default.php\''
-        );
-
-        $coreConfig->save();
-
-        return null;
-    }
-
-    /**
-     * rev.50 to rev.51
-     */
-    protected function stageNumber50(array $args): ?int
-    {
-        $queryI  = 'INSERT INTO ::bbcode (bb_tag, bb_edit, bb_delete, bb_structure)
-            VALUES(?s:tag, 1, 0, ?s:structure)';
-        $queryU  = 'UPDATE ::bbcode
-            SET bb_edit=1, bb_delete=0, bb_structure=?s:structure
-            WHERE bb_tag=?s:tag';
-        $bbcodes = include $this->c->DIR_CONFIG . '/defaultBBCode.php';
-
-        foreach ($bbcodes as $bbcode) {
-            $vars = [
-                ':tag'       => $bbcode['tag'],
-                ':structure' => \json_encode($bbcode, self::JSON_OPTIONS),
-            ];
-            $exist = $this->c->DB->query('SELECT 1 FROM ::bbcode WHERE bb_tag=?s:tag', $vars)->fetchColumn();
-            $query = empty($exist) ? $queryI : $queryU;
-
-            $this->c->DB->exec($query, $vars);
-        }
-
-        return null;
-    }
-
-    /**
-     * rev.51 to rev.52
-     */
-    protected function stageNumber51(array $args): ?int
-    {
-        $this->c->DB->dropTable('::online');
-
-        $schema = [
-            'FIELDS' => [
-                'user_id'     => ['INT(10) UNSIGNED', false, 0],
-                'ident'       => ['VARCHAR(45)', false, ''],
-                'logged'      => ['INT(10) UNSIGNED', false, 0],
-                'last_post'   => ['INT(10) UNSIGNED', false, 0],
-                'last_search' => ['INT(10) UNSIGNED', false, 0],
-                'o_position'  => ['VARCHAR(100)', false, ''],
-                'o_name'      => ['VARCHAR(190)', false, ''],
-            ],
-            'UNIQUE KEYS' => [
-                'user_id_ident_idx' => ['user_id', 'ident'],
-            ],
-            'INDEXES' => [
-                'logged_idx' => ['logged'],
-            ],
-        ];
-        $this->c->DB->createTable('::online', $schema);
-
-        return null;
-    }
-
-    /**
-     * rev.52 to rev.53
-     */
-    protected function stageNumber52(array $args): ?int
-    {
-        $this->c->DB->dropField('::users', 'dst');
-        $this->c->DB->alterField('::users', 'timezone', 'VARCHAR(255)', false, \date_default_timezone_get());
-
-        $config = $this->c->config;
-
-        $config->o_default_timezone = \date_default_timezone_get();
-
-        unset($config->b_default_dst);
-
-        $config->save();
-
-        return null;
-    }
 }