grav: init at 1.7.48

This commit is contained in:
Robert Helgesson
2025-02-21 23:09:42 +01:00
parent f2f268e802
commit f555744332
2 changed files with 74 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
diff -Nurp grav-src/system/src/Grav/Common/Cache.php grav-src-nixos/system/src/Grav/Common/Cache.php
--- grav-src/system/src/Grav/Common/Cache.php 1970-01-01 01:00:01.000000000 +0100
+++ grav-src-nixos/system/src/Grav/Common/Cache.php 2024-11-22 15:46:47.481175690 +0100
@@ -517,7 +517,7 @@ class Cache extends Getters
$output[] = '';
- if (($remove === 'all' || $remove === 'standard') && file_exists($user_config)) {
+ if (($remove === 'all' || $remove === 'standard') && file_exists($user_config) && is_writable($user_config)) {
touch($user_config);
$output[] = '<red>Touched: </red>' . $user_config;
@@ -544,7 +544,7 @@ class Cache extends Getters
{
$user_config = USER_DIR . 'config/system.yaml';
- if (file_exists($user_config)) {
+ if (file_exists($user_config) && is_writable($user_config)) {
touch($user_config);
}
diff -Nurp grav-src/system/src/Grav/Console/Gpm/SelfupgradeCommand.php grav-src-nixos/system/src/Grav/Console/Gpm/SelfupgradeCommand.php
--- grav-src/system/src/Grav/Console/Gpm/SelfupgradeCommand.php 1970-01-01 01:00:01.000000000 +0100
+++ grav-src-nixos/system/src/Grav/Console/Gpm/SelfupgradeCommand.php 2024-11-22 16:05:13.752536788 +0100
@@ -94,6 +94,11 @@ class SelfupgradeCommand extends GpmComm
$input = $this->getInput();
$io = $this->getIO();
+ # Adopted from Arch package.
+ $io->error('Grav cannot be upgraded this way as it has been installed with a distribution package.');
+ $io->writeln('Use Nix to upgrade.');
+ return 1;
+
if (!class_exists(ZipArchive::class)) {
$io->title('GPM Self Upgrade');
$io->error('php-zip extension needs to be enabled!');
+38
View File
@@ -0,0 +1,38 @@
{
stdenvNoCC,
lib,
fetchzip,
}:
let
version = "1.7.48";
in
stdenvNoCC.mkDerivation {
pname = "grav";
inherit version;
src = fetchzip {
url = "https://github.com/getgrav/grav/releases/download/${version}/grav-admin-v${version}.zip";
hash = "sha256-e8WpdO0n3pY4Ajs1fvMkMI+CrR6uMitswvYS5rxal4g=";
};
patches = [
# Disables functionality that attempts to edit files in Nix store. Also adds
# a block of the self-upgrade command.
./01-nix.patch
];
installPhase = ''
runHook preInstall
mkdir -p $out/
cp -R . $out/
runHook postInstall
'';
meta = with lib; {
description = "Fast, simple, and flexible, file-based web platform";
homepage = "https://getgrav.com";
maintainers = with maintainers; [ rycee ];
license = licenses.mit;
};
}