From ae5be41e11153784e6cbb09d4929cef60d70dfe5 Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 14 May 2025 10:52:06 +0200 Subject: [PATCH] Separate migration 44 with 45 --- common.php | 2 +- install/includes/schema.sql | 2 +- install/tools/7-finish.php | 4 ++++ system/migrations/44.php | 19 ------------------- system/migrations/45.php | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 system/migrations/45.php diff --git a/common.php b/common.php index 0cba1145..6bbc97e9 100644 --- a/common.php +++ b/common.php @@ -27,7 +27,7 @@ if (version_compare(phpversion(), '8.1', '<')) die('PHP version 8.1 or higher is const MYAAC = true; const MYAAC_VERSION = '1.4.1-dev'; -const DATABASE_VERSION = 44; +const DATABASE_VERSION = 45; const TABLE_PREFIX = 'myaac_'; define('START_TIME', microtime(true)); define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX')); diff --git a/install/includes/schema.sql b/install/includes/schema.sql index 9c2a0ac8..eccaee54 100644 --- a/install/includes/schema.sql +++ b/install/includes/schema.sql @@ -1,4 +1,4 @@ -SET @myaac_database_version = 44; +SET @myaac_database_version = 45; CREATE TABLE `myaac_account_actions` ( diff --git a/install/tools/7-finish.php b/install/tools/7-finish.php index 6f6b2d30..c1ab5c1d 100644 --- a/install/tools/7-finish.php +++ b/install/tools/7-finish.php @@ -79,6 +79,10 @@ $up(); require_once SYSTEM . 'migrations/31.php'; $up(); +// rules page +require_once SYSTEM . 'migrations/45.php'; +$up(); + if(ModelsFAQ::count() == 0) { ModelsFAQ::create([ 'question' => 'What is this?', diff --git a/system/migrations/44.php b/system/migrations/44.php index 0d9d18bb..6db23412 100644 --- a/system/migrations/44.php +++ b/system/migrations/44.php @@ -11,29 +11,10 @@ use MyAAC\Models\Pages; $up = function() { Menu::where('link', 'server-info')->update(['link' => 'ots-info']); Menu::where('link', 'changelog')->update(['link' => 'change-log']); - - Pages::where('name', 'rules_on_the_page')->update(['hide' => 1]); - - $rules = Pages::where('name', 'rules')->first(); - if (!$rules) { - Pages::create([ - 'name' => 'rules', - 'title' => 'Server Rules', - 'body' => '{{ config.lua.serverName }} Rules
' . nl2br(file_get_contents(__DIR__ . '/30-rules.txt')), - 'date' => time(), - 'player_id' => 1, - 'php' => 0, - 'enable_tinymce' => 0, - 'access' => 0, - 'hide' => 0, - ]); - } }; $down = function() { Menu::where('link', 'ots-info')->update(['link' => 'server-info']); Menu::where('link', 'change-log')->update(['link' => 'changelog']); - - Pages::where('name', 'rules_on_the_page')->update(['hide' => 0]); }; diff --git a/system/migrations/45.php b/system/migrations/45.php new file mode 100644 index 00000000..a3fd45b9 --- /dev/null +++ b/system/migrations/45.php @@ -0,0 +1,32 @@ +update(['hide' => 1]); + + $rules = Pages::where('name', 'rules')->first(); + if (!$rules) { + Pages::create([ + 'name' => 'rules', + 'title' => 'Server Rules', + 'body' => '{{ config.lua.serverName }} Rules
' . nl2br(file_get_contents(__DIR__ . '/30-rules.txt')), + 'date' => time(), + 'player_id' => 1, + 'php' => 0, + 'enable_tinymce' => 0, + 'access' => 0, + 'hide' => 0, + ]); + } +}; + +$down = function() { + Pages::where('name', 'rules_on_the_page')->update(['hide' => 0]); +}; +