diff --git a/app/Console/Commands/NexusUpdate.php b/app/Console/Commands/NexusUpdate.php index 409a0d593..0f32d73f0 100644 --- a/app/Console/Commands/NexusUpdate.php +++ b/app/Console/Commands/NexusUpdate.php @@ -137,6 +137,12 @@ public function handle() $this->doLog("Error: Redis version: {$mysqlInfo['version']} is too low, please use 2.0.0 or above.", 'error'); return 0; } + if ($includeComposer) { + $this->doLog("going to update .env file ..."); + $this->update->updateEnvFile(); + $this->doLog("update .env file done!"); + } + $this->doLog("going to createSymbolicLinks..."); $this->update->createSymbolicLinks($symbolicLinks); $this->doLog("createSymbolicLinks done!"); diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index edaf3b25b..c56d9064e 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -104,8 +104,8 @@ public function handle() $str = "1.abc.de"; $ext = "png"; $str = "202404/20240403215909f58f38ddd968a0e8a4bdd30690a9e92e.png"; - $res = substr($str, 0,-1*strlen($ext)-1); - dd($res); + $ext = pathinfo($str, PATHINFO_EXTENSION); + dd(basename($str), $ext); } } diff --git a/composer.json b/composer.json index a1917595c..c0ec36895 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,6 @@ }, "require-dev": { "fakerphp/faker": "^1.9.1", - "filament/upgrade": "^3.2", "kitloong/laravel-migrations-generator": "^7.0", "laravel-lang/lang": "^15.10", "laravel-lang/publisher": "^16.0", diff --git a/composer.lock b/composer.lock index 58cb2d90f..1d78a7391 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "11ad77956fab261081967fcfef0872f7", + "content-hash": "91ed67735b2cfade134e539b43ba5796", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -10369,46 +10369,6 @@ }, "time": "2024-11-21T13:46:39+00:00" }, - { - "name": "filament/upgrade", - "version": "v3.2.131", - "source": { - "type": "git", - "url": "https://github.com/filamentphp/upgrade.git", - "reference": "dc43f5c1fe24d1849a4a434dc6441d7bff69c9c9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/filamentphp/upgrade/zipball/dc43f5c1fe24d1849a4a434dc6441d7bff69c9c9", - "reference": "dc43f5c1fe24d1849a4a434dc6441d7bff69c9c9", - "shasum": "" - }, - "require": { - "nunomaduro/termwind": "^1.0|^2.0", - "php": "^8.1", - "rector/rector": "^1.0" - }, - "bin": [ - "bin/filament-v3" - ], - "type": "library", - "autoload": { - "psr-4": { - "Filament\\Upgrade\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Upgrade Filament v2 code to Filament v3.", - "homepage": "https://github.com/filamentphp/filament", - "support": { - "issues": "https://github.com/filamentphp/filament/issues", - "source": "https://github.com/filamentphp/filament" - }, - "time": "2024-12-11T09:06:04+00:00" - }, { "name": "filp/whoops", "version": "2.16.0", @@ -11538,64 +11498,6 @@ }, "time": "2022-02-21T01:04:05+00:00" }, - { - "name": "phpstan/phpstan", - "version": "1.12.13", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "9b469068840cfa031e1deaf2fa1886d00e20680f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9b469068840cfa031e1deaf2fa1886d00e20680f", - "reference": "9b469068840cfa031e1deaf2fa1886d00e20680f", - "shasum": "" - }, - "require": { - "php": "^7.2|^8.0" - }, - "conflict": { - "phpstan/phpstan-shim": "*" - }, - "bin": [ - "phpstan", - "phpstan.phar" - ], - "type": "library", - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "keywords": [ - "dev", - "static analysis" - ], - "support": { - "docs": "https://phpstan.org/user-guide/getting-started", - "forum": "https://github.com/phpstan/phpstan/discussions", - "issues": "https://github.com/phpstan/phpstan/issues", - "security": "https://github.com/phpstan/phpstan/security/policy", - "source": "https://github.com/phpstan/phpstan-src" - }, - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://github.com/phpstan", - "type": "github" - } - ], - "time": "2024-12-17T17:00:20+00:00" - }, { "name": "phpunit/php-code-coverage", "version": "10.1.16", @@ -12018,65 +11920,6 @@ ], "time": "2024-12-21T05:49:06+00:00" }, - { - "name": "rector/rector", - "version": "1.2.10", - "source": { - "type": "git", - "url": "https://github.com/rectorphp/rector.git", - "reference": "40f9cf38c05296bd32f444121336a521a293fa61" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/40f9cf38c05296bd32f444121336a521a293fa61", - "reference": "40f9cf38c05296bd32f444121336a521a293fa61", - "shasum": "" - }, - "require": { - "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.12.5" - }, - "conflict": { - "rector/rector-doctrine": "*", - "rector/rector-downgrade-php": "*", - "rector/rector-phpunit": "*", - "rector/rector-symfony": "*" - }, - "suggest": { - "ext-dom": "To manipulate phpunit.xml via the custom-rule command" - }, - "bin": [ - "bin/rector" - ], - "type": "library", - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Instant Upgrade and Automated Refactoring of any PHP code", - "keywords": [ - "automation", - "dev", - "migration", - "refactoring" - ], - "support": { - "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.10" - }, - "funding": [ - { - "url": "https://github.com/tomasvotruba", - "type": "github" - } - ], - "time": "2024-11-08T13:59:10+00:00" - }, { "name": "sebastian/cli-parser", "version": "2.0.1", diff --git a/nexus/Attachment/Storage.php b/nexus/Attachment/Storage.php index e6fa68a7e..b949a9ae6 100644 --- a/nexus/Attachment/Storage.php +++ b/nexus/Attachment/Storage.php @@ -34,7 +34,6 @@ public function uploadGetLocation(string $filepath, string $originalName): strin throw new \Exception("Failed to move uploaded file."); } $url = $this->upload($newFilepath); - @unlink($filepath); @unlink($newFilepath); } else { $url = $this->upload($filepath); diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 8250a4730..4c3989005 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -13,7 +13,7 @@ class Install { protected $currentStep; - protected $minimumPhpVersion = '8.0.3'; + protected $minimumPhpVersion = '8.2.0'; protected $progressKeyPrefix = '__step'; @@ -32,7 +32,10 @@ class Install 'UID_STARTS', ]; - protected array $requiredExtensions = ['ctype', 'curl', 'fileinfo', 'json', 'mbstring', 'openssl', 'pdo_mysql', 'tokenizer', 'xml', 'mysqli', 'bcmath', 'redis', 'gd', 'gmp', 'Zend OPcache', 'pcntl', 'posix', 'sockets']; + protected array $requiredExtensions = [ + 'ctype', 'curl', 'fileinfo', 'json', 'mbstring', 'openssl', 'pdo_mysql', 'tokenizer', 'xml', + 'mysqli', 'bcmath', 'redis', 'gd', 'gmp', 'Zend OPcache', 'pcntl', 'posix', 'sockets', 'zip', 'intl' + ]; protected array $optionalExtensions = [ // ['name' => 'swoole', 'desc' => "If use swoole for Octane, make sure 'current' shows 1"], ]; diff --git a/nexus/Install/Update.php b/nexus/Install/Update.php index a84fc971a..8cefea3d5 100644 --- a/nexus/Install/Update.php +++ b/nexus/Install/Update.php @@ -536,6 +536,29 @@ private function isSnatchedTableTorrentUserUnique(): bool return false; } + public function updateEnvFile() + { + $envFile = ROOT_PATH . '.env'; + $envExample = ROOT_PATH . '.env.example'; + $envData = readEnvFile($envFile); + $envExampleData = readEnvFile($envExample); + foreach ($envExampleData as $key => $value) { + if (!isset($envData[$key])) { + $envData[$key] = $value; + } + } + $fp = @fopen($envFile, 'w'); + if ($fp === false) { + throw new \RuntimeException("can't create env file, make sure php has permission to create file at: " . ROOT_PATH); + } + $content = ""; + foreach ($envData as $key => $value) { + $content .= "{$key}={$value}\n"; + } + fwrite($fp, $content); + fclose($fp); + } + diff --git a/nexus/Install/update/update.php b/nexus/Install/update/update.php index 2c62340a4..945e8e931 100644 --- a/nexus/Install/update/update.php +++ b/nexus/Install/update/update.php @@ -157,7 +157,7 @@ $tableRows = $settingTableRows['table_rows']; $pass = $settingTableRows['pass']; $mysqlInfo = $update->getMysqlVersionInfo(); - $redisInfo = $update->getREdisVersionInfo(); + $redisInfo = $update->getRedisVersionInfo(); while ($isPost) { set_time_limit(300); try {