[Scummvm-git-logs] scummvm-web master -> 3d87869312419e147c2980be8e4fde76b099dda5

Mataniko mataniko at gmail.com
Wed Dec 2 03:53:24 UTC 2020


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .

Summary:
a540a7a98f WEB: Properly clear cache after data update
3d87869312 BUILD: Refactor composer scripts


Commit: a540a7a98f1cf8d4c35e6508c1a3c86ac9b7ae24
    https://github.com/scummvm/scummvm-web/commit/a540a7a98f1cf8d4c35e6508c1a3c86ac9b7ae24
Author: Mataniko (mataniko at gmail.com)
Date: 2020-12-01T22:14:16-05:00

Commit Message:
WEB: Properly clear cache after data update

Changed paths:
    .gitignore
    README.md
    composer.json
    include/DataUtils.php
    include/Models/BasicModel.php


diff --git a/.gitignore b/.gitignore
index 639790f3..4422c461 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,3 +35,7 @@
 
 # Others
 public_html/frs
+
+# Clear cache instruction
+.clear-cache
+.no-cache
diff --git a/README.md b/README.md
index bdc08582..fbf393e0 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,7 @@ respectively.
 
 ## Deployment
 
-To deploy changes to the official ScummVM website, simply go to the website admin page and click the "ScummVM.org 
+To deploy changes to the official ScummVM website, simply go to the website admin page and click the "ScummVM.org
 manual site update" link.
 
 ## Updating data
@@ -62,6 +62,11 @@ run `composer update-data` note that this will run automatically on site update
 but is encouraged for you to do manually to keep track on who's updating the
 data.
 
+## Disabling cache
+
+During development, you can disable data caching by creating a file called
+`.no-cache` in the root folder.
+
 ## Contributing
 
 Similar to ScummVM, please use the appropriate project name when contributing:
diff --git a/composer.json b/composer.json
index 4b08f6db..7f00bea0 100644
--- a/composer.json
+++ b/composer.json
@@ -69,12 +69,8 @@
     "lint": [
       "phpcbf --standard=psr2 ./include"
     ],
-    "flush-cache": [
-      "redis-cli -n 8 flushdb"
-    ],
     "update-data": [
-      "php include/DataUtils.php",
-      "@flush-cache"
+      "php include/DataUtils.php"
     ],
     "scss": [
       "pscss -f compressed ./scss/main_ltr.scss > ./public_html/css/main_ltr.css",
diff --git a/include/DataUtils.php b/include/DataUtils.php
index ff196f8c..88543e99 100644
--- a/include/DataUtils.php
+++ b/include/DataUtils.php
@@ -69,6 +69,7 @@ class DataUtils
             $outFile = DIR_DATA . "/" . DEFAULT_LOCALE . "/$name.yaml";
             echo("Writing $name data to $outFile\n");
             \file_put_contents($outFile, $yaml);
+            \file_put_contents('.clear-cache', '');
         }
     }
 }
diff --git a/include/Models/BasicModel.php b/include/Models/BasicModel.php
index a2a7fedb..9499961e 100644
--- a/include/Models/BasicModel.php
+++ b/include/Models/BasicModel.php
@@ -26,6 +26,11 @@ abstract class BasicModel
                 // Fallback to files based cache
                 self::$cache = new Psr16Adapter('files');
             }
+
+            if (\file_exists(DIR_BASE . '/.clear-cache')) {
+                self::$cache->clear();
+                unlink(DIR_BASE . '/.clear-cache');
+            }
         }
     }
 
@@ -58,6 +63,10 @@ abstract class BasicModel
 
     protected function getFromCache($key = '')
     {
+        if (\file_exists(DIR_BASE . '/.no-cache')) {
+            return null;
+        }
+
         if ($key) {
             $key = "_$key";
         }


Commit: 3d87869312419e147c2980be8e4fde76b099dda5
    https://github.com/scummvm/scummvm-web/commit/3d87869312419e147c2980be8e4fde76b099dda5
Author: Mataniko (mataniko at gmail.com)
Date: 2020-12-01T22:52:54-05:00

Commit Message:
BUILD: Refactor composer scripts

Changed paths:
  A public_html/css/.gitignore
  A templates/compiled/.gitignore
    .gitignore
    README.md
    composer.json


diff --git a/.gitignore b/.gitignore
index 4422c461..3da4e07f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,11 +7,7 @@
 # Composer
 /vendor
 
-# Smarty
-/templates/compiled
-
 # CSS / SCSS
-/public_html/css
 .sass-cache/
 *.css.map
 *.sass.map
diff --git a/README.md b/README.md
index fbf393e0..6303b70a 100644
--- a/README.md
+++ b/README.md
@@ -23,32 +23,19 @@ Before installing please make sure you have the following installed:
 * [Glue](https://glue.readthedocs.io/en/latest/installation.html)
 * [Redis](https://redis.io/) (Optional)
 
-### Installing
+### Installing & Developing
 
 Clone this repo
 
-```
-git clone https://github.com/scummvm/scummvm-web.git
-```
+    git clone https://github.com/scummvm/scummvm-web.git
 
-Then install the required PHP dependencies with:
+To run the a development version of the site and start a local web server on port 8000, run:
 
-```
-composer install
-```
+    composer develop
 
-To run the build scripts and start a web server on port 8000, run:
+To build for production simply run:
 
-```
-composer develop[-win]
-```
-
-Instead of the above command, you can either build and run independently using:
-```
-composer build[-win]
-composer start
-```
-respectively.
+    composer build
 
 ## Deployment
 
diff --git a/composer.json b/composer.json
index 7f00bea0..40f68776 100644
--- a/composer.json
+++ b/composer.json
@@ -33,37 +33,26 @@
   },
   "scripts": {
     "build-common": [
-      "glue public_html/images/icons/games/ --img=images/ --scss=scss/sprites/ --retina",
-      "glue public_html/images/icons/platforms/ --img=images/ --scss=scss/sprites/ --retina",
-      "mv scss/sprites/games.scss scss/sprites/_games.scss",
-      "mv scss/sprites/platforms.scss scss/sprites/_platforms.scss",
-      "mv images/*.png public_html/images",
-      "rm -rf images",
-      "composer install --no-dev",
+      "@icons",
       "@scss",
-      "@localize",
-      "npm install --production"
+      "@localize"
     ],
-    "build-win": [
-      "if NOT EXIST public_html\\css mkdir public_html\\css",
+    "build": [
+      "composer install --no-dev",
       "@build-common",
-      "if NOT EXIST templates\\compiled mkdir templates\\compiled"
+      "npm install --production"
     ],
-    "build": [
-      "mkdir -p public_html/css",
+    "build-dev": [
+      "composer install",
       "@build-common",
-      "mkdir -p templates/compiled"
+      "npm install"
     ],
     "start": [
       "Composer\\Config::disableProcessTimeout",
       "php -S localhost:8000 -t ./public_html ./public_html/index.php"
     ],
     "develop": [
-      "@build",
-      "@start"
-    ],
-    "develop-win": [
-      "@build-win",
+      "@build-dev",
       "@start"
     ],
     "lint": [
@@ -79,6 +68,12 @@
     ],
     "localize": [
       "php include/LocalizationUtils.php"
+    ],
+    "icons": [
+      "glue public_html/images/icons/games/ --img=public_html/images/ --scss=scss/sprites/ --retina",
+      "glue public_html/images/icons/platforms/ --img=public_html/images/ --scss=scss/sprites/ --retina",
+      "mv scss/sprites/games.scss scss/sprites/_games.scss",
+      "mv scss/sprites/platforms.scss scss/sprites/_platforms.scss"
     ]
   },
   "autoload": {
diff --git a/public_html/css/.gitignore b/public_html/css/.gitignore
new file mode 100644
index 00000000..d6b7ef32
--- /dev/null
+++ b/public_html/css/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/templates/compiled/.gitignore b/templates/compiled/.gitignore
new file mode 100644
index 00000000..d6b7ef32
--- /dev/null
+++ b/templates/compiled/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore




More information about the Scummvm-git-logs mailing list