nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1diff -Nurp grav-src/system/src/Grav/Common/Cache.php grav-src-nixos/system/src/Grav/Common/Cache.php
2--- grav-src/system/src/Grav/Common/Cache.php 1970-01-01 01:00:01.000000000 +0100
3+++ grav-src-nixos/system/src/Grav/Common/Cache.php 2024-11-22 15:46:47.481175690 +0100
4@@ -517,7 +517,7 @@ class Cache extends Getters
5
6 $output[] = '';
7
8- if (($remove === 'all' || $remove === 'standard') && file_exists($user_config)) {
9+ if (($remove === 'all' || $remove === 'standard') && file_exists($user_config) && is_writable($user_config)) {
10 touch($user_config);
11
12 $output[] = '<red>Touched: </red>' . $user_config;
13@@ -544,7 +544,7 @@ class Cache extends Getters
14 {
15 $user_config = USER_DIR . 'config/system.yaml';
16
17- if (file_exists($user_config)) {
18+ if (file_exists($user_config) && is_writable($user_config)) {
19 touch($user_config);
20 }
21
22diff -Nurp grav-src/system/src/Grav/Console/Gpm/SelfupgradeCommand.php grav-src-nixos/system/src/Grav/Console/Gpm/SelfupgradeCommand.php
23--- grav-src/system/src/Grav/Console/Gpm/SelfupgradeCommand.php 1970-01-01 01:00:01.000000000 +0100
24+++ grav-src-nixos/system/src/Grav/Console/Gpm/SelfupgradeCommand.php 2024-11-22 16:05:13.752536788 +0100
25@@ -94,6 +94,11 @@ class SelfupgradeCommand extends GpmComm
26 $input = $this->getInput();
27 $io = $this->getIO();
28
29+ # Adopted from Arch package.
30+ $io->error('Grav cannot be upgraded this way as it has been installed with a distribution package.');
31+ $io->writeln('Use Nix to upgrade.');
32+ return 1;
33+
34 if (!class_exists(ZipArchive::class)) {
35 $io->title('GPM Self Upgrade');
36 $io->error('php-zip extension needs to be enabled!');