aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/api/engine-cyclic/includes
diff options
context:
space:
mode:
authorGitea <gitea@fake.local>2021-11-10 17:53:50 +0100
committerGitea <gitea@fake.local>2021-11-10 17:53:50 +0100
commit8fabf77b2a7720a357c63817c07035a9908818a0 (patch)
treed689fcac1403e2473010fe80bc337599a78c21a4 /Neutron-trunk/api/engine-cyclic/includes
parent7b4af63a90a726b98a59b83e53f040a7a566a11d (diff)
downloadelectrode-8fabf77b2a7720a357c63817c07035a9908818a0.tar.gz
electrode-8fabf77b2a7720a357c63817c07035a9908818a0.tar.bz2
electrode-8fabf77b2a7720a357c63817c07035a9908818a0.zip
Update
Diffstat (limited to 'Neutron-trunk/api/engine-cyclic/includes')
-rw-r--r--Neutron-trunk/api/engine-cyclic/includes/cache.php70
-rw-r--r--Neutron-trunk/api/engine-cyclic/includes/getPageContent.php14
-rw-r--r--Neutron-trunk/api/engine-cyclic/includes/getPageName.php18
-rw-r--r--Neutron-trunk/api/engine-cyclic/includes/includes.php4
4 files changed, 0 insertions, 106 deletions
diff --git a/Neutron-trunk/api/engine-cyclic/includes/cache.php b/Neutron-trunk/api/engine-cyclic/includes/cache.php
deleted file mode 100644
index 80ea283..0000000
--- a/Neutron-trunk/api/engine-cyclic/includes/cache.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-// Create cache dir
-if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache")) {
- mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache");
-}
-
-function cacheCheck(string $page) {
- /* // If something goes wrong, use cache anyway
- $cache = true;
-
- // Get a list of enabled widgets
- $widgets = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json"));
- if (json_last_error() != JSON_ERROR_NONE) { // If data is corrupted, silently think there are no widgets
- $list = [];
- rlgps("Warning: Widget information is corrupted");
- } else {
- $list = $widgets->list;
- }
-
- // Check if there is (at least) one widget that disables cache
- foreach ($list as $widget) {
- $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/widgets/$widget/feature.json"));
- if (json_last_error() == JSON_ERROR_NONE) {
- if (isset($data->cache)) {
- if (is_bool($data->cache)) {
- $cache = $data->cache;
- if ($data->cache == false) {
- rlgps("Widget \"$widget\" prevents the use of cache");
- }
- }
- }
- } else {
- rlgps("Warning: Metadata for the widget \"$widget\" is corrupted");
- }
- }
-
- // Check if an update has been installed
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version")) {
- if (file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version") == file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version")) {} else {
- $cache = false;
- require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php";
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version"));
- }
- } else {
- $cache = false;
- require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php";
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version"));
- }
-
- // Is there any widget that disables cache?
- if ($cache) { // no
- // Does the cached version exists?
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/page-" . $page)) { // yes
- header("X-FNS-NeutronCache: yes");
- echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/page-" . $page)); // So let's output it
- require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/debug.php";debugDump(); // And debug if needed
- return true;
- } else { // no
- header("X-FNS-NeutronCache: no");
- return false; // Let the engine-cyclic render the page
- }
- } else { // yes
- header("X-FNS-NeutronCache: no");
- return false; // Let the engine-cyclic render the page
- } */
-
- // Cache is now completely disabled due to problems
- return false;
-} \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/includes/getPageContent.php b/Neutron-trunk/api/engine-cyclic/includes/getPageContent.php
deleted file mode 100644
index 31b202c..0000000
--- a/Neutron-trunk/api/engine-cyclic/includes/getPageContent.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-function getPageContent() {
- rlgps("getPageContent() call");
- global $MPCMSRendererPageMarkup;
- global $MPCMSRendererPageMarkupDN;
- global $MPCMSRendererPageNameValue;
-
- if (isset($MPCMSRendererPageMarkup) && isset($MPCMSRendererPageMarkupDN)) {
- return $MPCMSRendererPageMarkup;
- } else {
- return file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $MPCMSRendererPageNameValue);
- }
-} \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/includes/getPageName.php b/Neutron-trunk/api/engine-cyclic/includes/getPageName.php
deleted file mode 100644
index e364493..0000000
--- a/Neutron-trunk/api/engine-cyclic/includes/getPageName.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-function getPageName() {
- rlgps("getPageName() call");
- global $MPCMSRendererPageMarkup;
- global $MPCMSRendererPageMarkupDN;
- global $MPCMSRendererPageNameValue;
-
- if (isset($MPCMSRendererPageMarkup) && isset($MPCMSRendererPageMarkupDN)) {
- return $MPCMSRendererPageMarkupDN;
- } else {
- if ($MPCMSRendererPageNameValue == "index") {
- return file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename");
- } else {
- return file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $MPCMSRendererPageNameValue . "/pagename");
- }
- }
-} \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/includes/includes.php b/Neutron-trunk/api/engine-cyclic/includes/includes.php
deleted file mode 100644
index 05f0f23..0000000
--- a/Neutron-trunk/api/engine-cyclic/includes/includes.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/includes/getPageName.php";
-require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/includes/getPageContent.php"; \ No newline at end of file