Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
version.php
1<?php
2namespace Bitrix\Landing\Site;
3
4class Version
5{
6 private const VERSIONS = [
7 0 => null,
8 1 => \Bitrix\Landing\Site\Update\ChatSales::class,
9 2 => \Bitrix\Landing\Site\Update\ChatSalesOrder::class,
10 3 => \Bitrix\Landing\Site\Update\DomainUa::class,
11 4 => \Bitrix\Landing\Site\Update\DomainBy::class,
12 5 => \Bitrix\Landing\Site\Update\DomainByUpdate::class,
13 ];
14
15 protected static $process = false;
16
23 public static function update(int $siteId, ?int $version = 0): void
24 {
25 if (self::$process)
26 {
27 return;
28 }
29 self::$process = true;
30
31 $version = intval($version);
32
33 if ($version >= count(self::VERSIONS) - 1)
34 {
35 return;
36 }
37
38 \Bitrix\Landing\Rights::setGlobalOff();
39
40 foreach (self::VERSIONS as $updateVersion => $updateClass)
41 {
42 if ($updateVersion <= $version)
43 {
44 continue;
45 }
46
47 if (!$updateClass || !class_exists($updateClass))
48 {
49 continue;
50 }
51
52 if ($updateClass::update($siteId))
53 {
54 $version = $updateVersion;
55 }
56 else
57 {
58 break;
59 }
60 }
61
62 \Bitrix\Landing\Internals\SiteTable::update($siteId, [
63 'VERSION' => $version
64 ]);
65
66 \Bitrix\Landing\Rights::setGlobalOn();
67 self::$process = false;
68 }
69}
static update(int $siteId, ?int $version=0)
Definition version.php:23