mirror of
https://github.com/bdnugget/php-wasm.git
synced 2026-11-07 09:07:28 +00:00
Cleaning up drupal build
This commit is contained in:
1 parent
27f04f481d
commit
5c2dae2d34
33 files changed
+19188
-708138
No files matched your search
@@ -9,3 +9,4 @@
|
||||
configured
|
||||
.env
|
||||
/*-src/
|
||||
/docs/*.map
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
UID?=1000 # Change this in your .env file if you're not UID 1000
|
||||
|
||||
SHELL=bash -euxo pipefail
|
||||
|
||||
ENVIRONMENT ?=web
|
||||
INITIAL_MEMORY ?=1gb
|
||||
INITIAL_MEMORY ?=2047MB
|
||||
PRELOAD_ASSETS ?=preload/
|
||||
ASSERTIONS ?=0
|
||||
OPTIMIZE ?=-O1
|
||||
OPTIMIZE ?=-O3
|
||||
RELEASE_SUFFIX ?=
|
||||
|
||||
PHP_BRANCH ?=php-7.4.20
|
||||
@@ -17,7 +19,7 @@ TIDYHTML_TAG ?=5.6.0
|
||||
|
||||
PKG_CONFIG_PATH ?=/src/lib/lib/pkgconfig
|
||||
|
||||
DOCKER_ENV=UID=${UID} docker-compose -p phpwasm run --rm \
|
||||
DOCKER_ENV=USERID=${UID} docker-compose -p phpwasm run --rm \
|
||||
-e PKG_CONFIG_PATH=${PKG_CONFIG_PATH} \
|
||||
-e PRELOAD_ASSETS='${PRELOAD_ASSETS}' \
|
||||
-e INITIAL_MEMORY=${INITIAL_MEMORY} \
|
||||
@@ -30,10 +32,9 @@ DOCKER_RUN_IN_ICU4C =${DOCKER_ENV} -w /src/third_party/libicu-src/icu4c/source/
|
||||
DOCKER_RUN_IN_LIBXML =${DOCKER_ENV} -w /src/third_party/libxml2/ emscripten-builder
|
||||
|
||||
TIMER=(which pv > /dev/null && pv --name '${@}' || cat)
|
||||
|
||||
.PHONY: web all clean image js hooks push-image pull-image
|
||||
|
||||
all: php-web.wasm php-webview.wasm php-node.wasm php-shell.wasm php-worker.wasm js
|
||||
all: php-web.wasm php-web-drupal.wasm php-webview.wasm php-node.wasm php-shell.wasm php-worker.wasm js
|
||||
web: lib/pib_eval.o php-web.wasm
|
||||
@ echo "Done!"
|
||||
|
||||
@@ -73,8 +74,9 @@ third_party/drupal-7.59/README.txt:
|
||||
@ ${DOCKER_RUN} unzip drupal-7.59.zip
|
||||
@ ${DOCKER_RUN} rm -v drupal-7.59.zip
|
||||
@ ${DOCKER_RUN} mv drupal-7.59 third_party/drupal-7.59
|
||||
@ ${DOCKER_RUN} git apply --no-index patch/drupal-7.59.patch
|
||||
@ ${DOCKER_RUN} cp -r extras/drupal-7-settings.php third_party/drupal-7.59/sites/default/settings.php
|
||||
@ ${DOCKER_RUN} cp -r extras/drowser-files third_party/drupal-7.59/sites/default/files
|
||||
@ ${DOCKER_RUN} cp -r extras/drowser-files/* third_party/drupal-7.59/sites/default/files
|
||||
@ ${DOCKER_RUN} cp -r extras/drowser-logo.png third_party/drupal-7.59/sites/default/logo.png
|
||||
@ ${DOCKER_RUN} cp -r third_party/drupal-7.59 third_party/drupal-7.59 third_party/php7.4-src/preload/
|
||||
|
||||
@@ -127,6 +129,9 @@ third_party/php7.4-src/configure: third_party/php7.4-src/ext/vrzno/vrzno.c sourc
|
||||
--disable-mbregex \
|
||||
--enable-tokenizer \
|
||||
--enable-vrzno \
|
||||
--enable-gd \
|
||||
--enable-xml \
|
||||
--enable-simple-xml
|
||||
"
|
||||
|
||||
lib/libphp7.a: third_party/php7.4-src/configure third_party/php7.4-src/patched third_party/php7.4-src/**.c source/sqlite3.c
|
||||
@@ -141,7 +146,7 @@ lib/pib_eval.o: lib/libphp7.a source/pib_eval.c
|
||||
-I TSRM/ \
|
||||
-I /src/third_party/libxml2 \
|
||||
/src/source/pib_eval.c \
|
||||
-o /src/lib/pib_eval.o
|
||||
-o /src/lib/pib_eval.o \
|
||||
|
||||
lib/something:
|
||||
${DOCKER_RUN_IN_LIBXML} ./autogen.sh
|
||||
@@ -153,9 +158,7 @@ lib/something:
|
||||
|
||||
FINAL_BUILD=${DOCKER_RUN_IN_PHP} emcc ${OPTIMIZE} \
|
||||
-o ../../build/php-${ENVIRONMENT}${RELEASE_SUFFIX}.js \
|
||||
--preload-file ../drupal-7.59@/preload/drupal-7.59 \
|
||||
--llvm-lto 2 \
|
||||
--preload-file ${PRELOAD_ASSETS} \
|
||||
-s EXPORTED_FUNCTIONS='["_pib_init", "_pib_destroy", "_pib_run", "_pib_exec" "_pib_refresh", "_main", "_php_embed_init", "_php_embed_shutdown", "_php_embed_shutdown", "_zend_eval_string", "_exec_callback", "_del_callback"]' \
|
||||
-s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "UTF8ToString", "lengthBytesUTF8"]' \
|
||||
-s ENVIRONMENT=${ENVIRONMENT} \
|
||||
@@ -169,8 +172,15 @@ FINAL_BUILD=${DOCKER_RUN_IN_PHP} emcc ${OPTIMIZE} \
|
||||
-s INVOKE_RUN=0 \
|
||||
/src/lib/pib_eval.o /src/lib/libphp7.a /src/lib/lib/libxml2.a
|
||||
|
||||
php-web-drupal.wasm: ENVIRONMENT=web-drupal
|
||||
php-web-drupal.wasm: lib/libphp7.a lib/pib_eval.o source/**.c source/**.h third_party/drupal-7.59/README.txt
|
||||
${FINAL_BUILD} --preload-file ${PRELOAD_ASSETS} -s ENVIRONMENT=web
|
||||
@ ${DOCKER_RUN} cp -v build/php-${ENVIRONMENT}${RELEASE_SUFFIX}.* ./
|
||||
@ ${DOCKER_RUN} cp -v build/php-${ENVIRONMENT}${RELEASE_SUFFIX}.* ./docs-source/app/assets
|
||||
@ ${DOCKER_RUN} cp -v build/php-${ENVIRONMENT}${RELEASE_SUFFIX}.* ./docs-source/public
|
||||
|
||||
php-web.wasm: ENVIRONMENT=web
|
||||
php-web.wasm: lib/libphp7.a lib/pib_eval.o source/**.c source/**.h third_party/drupal-7.59/README.txt
|
||||
php-web.wasm: lib/libphp7.a lib/pib_eval.o source/**.c source/**.h
|
||||
${FINAL_BUILD}
|
||||
@ ${DOCKER_RUN} cp -v build/php-${ENVIRONMENT}${RELEASE_SUFFIX}.* ./
|
||||
@ ${DOCKER_RUN} cp -v build/php-${ENVIRONMENT}${RELEASE_SUFFIX}.* ./docs-source/app/assets
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
+ [JSON](https://seanmorris.github.io/php-wasm/?code=%253C%253Fphp%250A%250A%2524x%2520%253D%2520%255B%250A%2520%2520%2520%2522id%2522%2520%253D%253E%25201%2520%2520%250A%255D%253B%250A%250Avar_dump%28json_decode%28json_encode%28%2524x%29%29%29%253B%250A)
|
||||
+ [Closures](https://seanmorris.github.io/php-wasm/?code=%253C%253Fphp%250A%250A%2524x%2520%253D%252010%253B%250A%250Afunction%2520run%28callable%2520%2524f%29%2520%257B%250A%2520%2520%2520%2520%2524f%28%29%253B%250A%257D%250A%250Arun%28function%2520%28%29%2520use%2520%28%2526%2524x%29%2520%257B%250A%2520%2520%2520%2520%2524x%2520%253D%25209%253B%250A%257D%29%253B%250A%250Avar_dump%28%2524x%29%253B%250A)
|
||||
+ [File access](https://seanmorris.github.io/php-wasm/?code=%253C%253Fphp%250A%250A%2524it%2520%253D%2520new%2520RecursiveIteratorIterator%28new%2520RecursiveDirectoryIterator%28%2522.%2522%29%29%253B%250A%250Aforeach%2520%28%2524it%2520as%2520%2524name%2520%253D%253E%2520%2524entry%29%2520%257B%250A%2520%2520%2520%2520echo%2520%2524name%2520.%2520%2522%253Cbr%252F%253E%2522%253B%250A%257D%250A)
|
||||
+ [Zend/bench.php](https://seanmorris.github.io/?autorun=0&persist=0&single-expression=0&code=%253C%253Fphp%250A%250Ainclude%28%2522%252Fpreload%252FZend%252Fbench.php%2522%29%253B%250A&render-as=text)
|
||||
+ [Drupal 7](https://seanmorris.github.io/php-wasm/?code=%253C%253Fphp%250Aini_set%28%27session.save_path%27%252C%2520%27%252Fhome%252Fweb_user%27%29%253B%250Asession_id%28%27fake-cookie%27%29%253B%250Asession_start%28%29%253B%250A%250A%2524stdErr%2520%253D%2520fopen%28%27php%253A%252F%252Fstderr%27%252C%2520%27w%27%29%253B%250A%2524errors%2520%253D%2520%255B%255D%253B%250A%250Aregister_shutdown_function%28function%28%29%2520use%28%2524stdErr%252C%2520%2526%2524errors%29%257B%250A%2520%2520%2520%2520fwrite%28%2524stdErr%252C%2520json_encode%28%255B%27session_id%27%2520%253D%253E%2520session_id%28%29%255D%29%2520.%2520%2522%255Cn%2522%29%253B%250A%2520%2520%2520%2520fwrite%28%2524stdErr%252C%2520json_encode%28%255B%27headers%27%253D%253Eheaders_list%28%29%255D%29%2520.%2520%2522%255Cn%2522%29%253B%250A%2520%2520%2520%2520fwrite%28%2524stdErr%252C%2520json_encode%28%255B%27errors%27%2520%253D%253E%2520error_get_last%28%29%255D%29%2520.%2520%2522%255Cn%2522%29%253B%250A%257D%29%253B%250A%250Aset_error_handler%28function%28...%2524args%29%2520use%28%2524stdErr%252C%2520%2526%2524errors%29%257B%250A%2509fwrite%28%2524stdErr%252C%2520print_r%28%2524args%252C1%29%29%253B%250A%257D%29%253B%250A%250A%2524origin%2520%2520%253D%2520%27http%253A%252F%252Flocalhost%253A3333%27%253B%250A%2524docroot%2520%253D%2520%27%252Fpreload%252Fdrupal-7.59%27%253B%250A%2524path%2520%2520%2520%2520%253D%2520%27%252F%27%253B%250A%2524script%2520%2520%253D%2520%27index.php%27%253B%250A%250A%2524_SERVER%255B%27REQUEST_URI%27%255D%2520%2520%2520%2520%2520%253D%2520%2524docroot%253B%250A%2524_SERVER%255B%27REMOTE_ADDR%27%255D%2520%2520%2520%2520%2520%253D%2520%27127.0.0.1%27%253B%250A%2524_SERVER%255B%27SERVER_NAME%27%255D%2520%2520%2520%2520%2520%253D%2520%2524origin%253B%250A%2524_SERVER%255B%27SERVER_PORT%27%255D%2520%2520%2520%2520%2520%253D%25203333%253B%250A%2524_SERVER%255B%27REQUEST_METHOD%27%255D%2520%2520%253D%2520%27GET%27%253B%250A%2524_SERVER%255B%27SCRIPT_FILENAME%27%255D%2520%253D%2520%2524docroot%2520.%2520%27%252F%27%2520.%2520%2524script%253B%250A%2524_SERVER%255B%27SCRIPT_NAME%27%255D%2520%2520%2520%2520%2520%253D%2520%2524docroot%2520.%2520%27%252F%27%2520.%2520%2524script%253B%250A%2524_SERVER%255B%27PHP_SELF%27%255D%2520%2520%2520%2520%2520%2520%2520%2520%253D%2520%2524docroot%2520.%2520%27%252F%27%2520.%2520%2524script%253B%250A%250Achdir%28%2524docroot%29%253B%250A%250Adefine%28%27DRUPAL_ROOT%27%252C%2520getcwd%28%29%29%253B%250A%250Arequire_once%2520DRUPAL_ROOT%2520.%2520%27%252Fincludes%252Fbootstrap.inc%27%253B%250Adrupal_bootstrap%28DRUPAL_BOOTSTRAP_FULL%29%253B%250A%250A%2524uid%2520%2520%2520%2520%2520%253D%25201%253B%250A%2524user%2520%2520%2520%2520%253D%2520user_load%28%2524uid%29%253B%250A%2524account%2520%253D%2520array%28%27uid%27%2520%253D%253E%2520%2524user-%253Euid%29%253B%250Auser_login_submit%28array%28%29%252C%2520%2524account%29%253B%250A%250Amenu_execute_active_handler%28%29%253B&persist=0&single-expression=0&render-as=html&autorun=1)
|
||||
+ [Zend/bench.php](https://seanmorris.github.io/php-wasm?autorun=0&persist=0&single-expression=0&code=%253C%253Fphp%250A%250Ainclude%28%2522%252Fpreload%252FZend%252Fbench.php%2522%29%253B%250A&render-as=text)
|
||||
+ [Drupal 7](https://seanmorris.github.io/php-wasm/?autorun=0&persist=0&single-expression=0&code=%253C%253Fphp%250Aini_set%28%27session.save_path%27%252C%2520%27%252Fhome%252Fweb_user%27%29%253B%250Asession_id%28%27fake-cookie%27%29%253B%250Asession_start%28%29%253B%250A%250A%2524stdErr%2520%253D%2520fopen%28%27php%253A%252F%252Fstderr%27%252C%2520%27w%27%29%253B%250A%2524errors%2520%253D%2520%255B%255D%253B%250A%250Aregister_shutdown_function%28function%28%29%2520use%28%2524stdErr%252C%2520%2526%2524errors%29%257B%250A%2520%2520%2520%2520fwrite%28%2524stdErr%252C%2520json_encode%28%255B%27session_id%27%2520%253D%253E%2520session_id%28%29%255D%29%2520.%2520%2522%255Cn%2522%29%253B%250A%2520%2520%2520%2520fwrite%28%2524stdErr%252C%2520json_encode%28%255B%27headers%27%253D%253Eheaders_list%28%29%255D%29%2520.%2520%2522%255Cn%2522%29%253B%250A%2520%2520%2520%2520fwrite%28%2524stdErr%252C%2520json_encode%28%255B%27errors%27%2520%253D%253E%2520error_get_last%28%29%255D%29%2520.%2520%2522%255Cn%2522%29%253B%250A%257D%29%253B%250A%250Aset_error_handler%28function%28...%2524args%29%2520use%28%2524stdErr%252C%2520%2526%2524errors%29%257B%250A%2509fwrite%28%2524stdErr%252C%2520print_r%28%2524args%252C1%29%29%253B%250A%257D%29%253B%250A%250A%2524origin%2520%2520%253D%2520%27http%253A%252F%252Flocalhost%253A3333%27%253B%250A%2524docroot%2520%253D%2520%27%252Fpreload%252Fdrupal-7.59%27%253B%250A%2524path%2520%2520%2520%2520%253D%2520%27%252Fadmin%252Fdashboard%27%253B%250A%2524script%2520%2520%253D%2520%27index.php%27%253B%250A%250A%2524_SERVER%255B%27REQUEST_URI%27%255D%2520%2520%2520%2520%2520%253D%2520%2524docroot%2520.%2520%2524path%253B%250A%2524_SERVER%255B%27REMOTE_ADDR%27%255D%2520%2520%2520%2520%2520%253D%2520%27127.0.0.1%27%253B%250A%2524_SERVER%255B%27SERVER_NAME%27%255D%2520%2520%2520%2520%2520%253D%2520%2524origin%253B%250A%2524_SERVER%255B%27SERVER_PORT%27%255D%2520%2520%2520%2520%2520%253D%25203333%253B%250A%2524_SERVER%255B%27REQUEST_METHOD%27%255D%2520%2520%253D%2520%27GET%27%253B%250A%2524_SERVER%255B%27SCRIPT_FILENAME%27%255D%2520%253D%2520%2524docroot%2520.%2520%27%252F%27%2520.%2520%2524script%253B%250A%2524_SERVER%255B%27SCRIPT_NAME%27%255D%2520%2520%2520%2520%2520%253D%2520%2524docroot%2520.%2520%27%252F%27%2520.%2520%2524script%253B%250A%2524_SERVER%255B%27PHP_SELF%27%255D%2520%2520%2520%2520%2520%2520%2520%2520%253D%2520%2524docroot%2520.%2520%27%252F%27%2520.%2520%2524script%253B%250A%250Achdir%28%2524docroot%29%253B%250A%250Aob_start%28%29%253B%250A%250Adefine%28%27DRUPAL_ROOT%27%252C%2520getcwd%28%29%29%253B%250A%250Arequire_once%2520DRUPAL_ROOT%2520.%2520%27%252Fincludes%252Fbootstrap.inc%27%253B%250Adrupal_bootstrap%28DRUPAL_BOOTSTRAP_FULL%29%253B%250A%250A%2524uid%2520%2520%2520%2520%2520%253D%25201%253B%250A%2524user%2520%2520%2520%2520%253D%2520user_load%28%2524uid%29%253B%250A%2524account%2520%253D%2520array%28%27uid%27%2520%253D%253E%2520%2524user-%253Euid%29%253B%250Auser_login_submit%28array%28%29%252C%2520%2524account%29%253B%250A%250A%2524itemPath%2520%253D%2520%2524path%253B%250A%2524itemPath%2520%253D%2520preg_replace%28%27%252F%255E%255C%255C%252Fpreload%252F%27%252C%2520%27%27%252C%2520%2524itemPath%29%253B%250A%2524itemPath%2520%253D%2520preg_replace%28%27%252F%255E%255C%255C%252Fdrupal-7.59%252F%27%252C%2520%27%27%252C%2520%2524itemPath%29%253B%250A%2524itemPath%2520%253D%2520preg_replace%28%27%252F%255E%255C%252F%252F%27%252C%2520%27%27%252C%2520%2524itemPath%29%253B%250A%250Aif%28%2524itemPath%29%250A%257B%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520%2524router_item%2520%253D%2520menu_get_item%28%2524itemPath%29%253B%250A%2520%2520%2520%2520%2524router_item%255B%27access_callback%27%255D%2520%253D%2520true%253B%250A%2520%2520%2520%2520%2524router_item%255B%27access%27%255D%2520%253D%2520true%253B%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520if%2520%28%2524router_item%255B%27include_file%27%255D%29%2520%257B%250A%2520%2520%2520%2520%2520%2520require_once%2520DRUPAL_ROOT%2520.%2520%27%252F%27%2520.%2520%2524router_item%255B%27include_file%27%255D%253B%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520%2524page_callback_result%2520%253D%2520call_user_func_array%28%2524router_item%255B%27page_callback%27%255D%252C%2520unserialize%28%2524router_item%255B%27page_arguments%27%255D%29%29%253B%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520drupal_deliver_page%28%2524page_callback_result%29%253B%250A%257D%250Aelse%250A%257B%250A%2520%2520%2520%2520menu_execute_active_handler%28%29%253B%250A%257D&render-as=html)
|
||||
|
||||
|
||||
## Getting Started
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ version: '3'
|
||||
services:
|
||||
|
||||
emscripten-builder:
|
||||
user: ${UID}:${UID}
|
||||
user: ${USERID}
|
||||
image: seanmorris/php-emscripten-builder
|
||||
build:
|
||||
context: ./
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
import { process } from 'process/browser';
|
||||
|
||||
self.addEventListener('install', event => {
|
||||
console.log('Install');
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener('activate', event => {
|
||||
console.log('Activate');
|
||||
event.waitUntil(clients.claim());
|
||||
});
|
||||
|
||||
@@ -15,6 +17,8 @@ self.addEventListener('fetch', event => event.respondWith(new Promise(accept =>
|
||||
const pathname = url.pathname.replace(/^\//, '');
|
||||
const path = pathname.split('/');
|
||||
|
||||
console.log(path);
|
||||
|
||||
if(!path[ path.length-1 ].match(/\.\w+$/)
|
||||
&& (path[1] === 'drupal-7.59' || path[2] === 'drupal-7.59')
|
||||
){
|
||||
|
||||
@@ -180,7 +180,7 @@ sso++++++///++//oyyyyhhhyyyyssoo+++syhhhdmNNNNmmmmmmmmdhhyhmNNNmddhhddmmmmmmmmNm
|
||||
</div>
|
||||
<div class = "stdout output liquid">
|
||||
<div class = "column">
|
||||
<iframe class = "scroller" srcdoc=""></iframe>
|
||||
<iframe sandbox = "allow-same-origin allow-scripts allow-forms" class = "scroller" srcdoc=""></iframe>
|
||||
<div class = "scroller"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+35
-330625
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Binary file not shown.
@@ -380651,14 +380651,14 @@ function drupal_environment_initialize() {
|
||||
ini_set('magic_quotes_runtime', '0');
|
||||
// Use session cookies, not transparent sessions that puts the session id in
|
||||
// the query string.
|
||||
ini_set('session.use_cookies', '1');
|
||||
ini_set('session.use_only_cookies', '1');
|
||||
ini_set('session.use_trans_sid', '0');
|
||||
// Don't send HTTP headers using PHP's session handler.
|
||||
// An empty string is used here to disable the cache limiter.
|
||||
ini_set('session.cache_limiter', '');
|
||||
// Use httponly session cookies.
|
||||
ini_set('session.cookie_httponly', '1');
|
||||
// ini_set('session.use_cookies', '1');
|
||||
// ini_set('session.use_only_cookies', '1');
|
||||
// ini_set('session.use_trans_sid', '0');
|
||||
// // Don't send HTTP headers using PHP's session handler.
|
||||
// // An empty string is used here to disable the cache limiter.
|
||||
// ini_set('session.cache_limiter', '');
|
||||
// // Use httponly session cookies.
|
||||
// ini_set('session.cookie_httponly', '1');
|
||||
|
||||
// Set sane locale settings, to ensure consistent string, dates, times and
|
||||
// numbers handling.
|
||||
|
||||
Binary file not shown.
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
ini_set('session.save_path', '/home/web_user');
|
||||
session_id('fake-cookie');
|
||||
session_start();
|
||||
|
||||
$stdErr = fopen('php://stderr', 'w');
|
||||
$errors = [];
|
||||
|
||||
register_shutdown_function(function() use($stdErr, &$errors){
|
||||
fwrite($stdErr, json_encode(headers_list()) . "\n");
|
||||
fwrite($stdErr, json_encode(['session_id' => session_id()]) . "\n");
|
||||
fwrite($stdErr, print_r($errors,1));
|
||||
fwrite($stdErr, print_r(error_get_last(),1));
|
||||
fwrite($stdErr, json_encode(['headers'=>headers_list()]) . "\n");
|
||||
fwrite($stdErr, json_encode(['errors' => error_get_last()]) . "\n");
|
||||
});
|
||||
|
||||
set_error_handler(function(...$args) use($stdErr, &$errors){
|
||||
@@ -17,11 +17,11 @@ set_error_handler(function(...$args) use($stdErr, &$errors){
|
||||
});
|
||||
|
||||
$origin = 'http://localhost:3333';
|
||||
$docroot = '/php-wasm/preload/drupal-7.59';
|
||||
$docroot = '/preload/drupal-7.59';
|
||||
$path = '/';
|
||||
$script = 'index.php';
|
||||
|
||||
$_SERVER['REQUEST_URI'] = $docroot . $path;
|
||||
$_SERVER['REQUEST_URI'] = $docroot;
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['SERVER_NAME'] = $origin;
|
||||
$_SERVER['SERVER_PORT'] = 3333;
|
||||
@@ -32,4 +32,36 @@ $_SERVER['PHP_SELF'] = $docroot . '/' . $script;
|
||||
|
||||
chdir($docroot);
|
||||
|
||||
require $script;
|
||||
define('DRUPAL_ROOT', getcwd());
|
||||
|
||||
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
|
||||
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
|
||||
|
||||
$uid = 1;
|
||||
$user = user_load($uid);
|
||||
$account = array('uid' => $user->uid);
|
||||
user_login_submit(array(), $account);
|
||||
|
||||
$itemPath = $path;
|
||||
$itemPath = preg_replace('/^\\/preload/', '', $itemPath);
|
||||
$itemPath = preg_replace('/^\\/drupal-7.59/', '', $itemPath);
|
||||
$itemPath = preg_replace('/^\\//', '', $itemPath);
|
||||
|
||||
if($itemPath && (substr($itemPath, 0, 4) !== 'node' || substr($itemPath, -4) === 'edit'))
|
||||
{
|
||||
$router_item = menu_get_item($itemPath);
|
||||
$router_item['access_callback'] = true;
|
||||
$router_item['access'] = true;
|
||||
|
||||
if ($router_item['include_file']) {
|
||||
require_once DRUPAL_ROOT . '/' . $router_item['include_file'];
|
||||
}
|
||||
|
||||
$page_callback_result = call_user_func_array($router_item['page_callback'], unserialize($router_item['page_arguments']));
|
||||
|
||||
drupal_deliver_page($page_callback_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_execute_active_handler();
|
||||
}
|
||||
@@ -1,22 +1,26 @@
|
||||
<?php
|
||||
ini_set('session.save_path', '/home/web_user');
|
||||
session_id('fake-cookie');
|
||||
session_start();
|
||||
session_id('${session_id}');
|
||||
|
||||
$stdErr = fopen('php://stderr', 'w');
|
||||
$errors = [];
|
||||
|
||||
register_shutdown_function(function() use($stdErr, &$errors){
|
||||
fwrite($stdErr, json_encode(['session_id' => session_id()]) . "\n" );
|
||||
fwrite($stdErr, var_export($errors,1) . "\n");
|
||||
fwrite($stdErr, json_encode(['session' => $_SESSION]) . "\n");
|
||||
|
||||
register_shutdown_function(function() use($stdErr){
|
||||
fwrite($stdErr, json_encode(['session_id' => session_id()]) . "\n");
|
||||
fwrite($stdErr, json_encode(['headers'=>headers_list()]) . "\n");
|
||||
fwrite($stdErr, json_encode(['errors' => error_get_last()]) . "\n");
|
||||
fwrite($stdErr, json_encode(['session' => $_SESSION]) . "\n");
|
||||
});
|
||||
|
||||
set_error_handler(function(...$args) use($stdErr, &$errors){
|
||||
$errors[] = $args;
|
||||
fwrite($stdErr, json_encode($args, JSON_PRETTY_PRINT) . "\n" );
|
||||
});
|
||||
|
||||
$request = (object) json_decode(
|
||||
'${JSON.stringify(event.data)}'
|
||||
'${ JSON.stringify({path, method, _GET, _POST}) }'
|
||||
, JSON_OBJECT_AS_ARRAY
|
||||
);
|
||||
|
||||
@@ -28,23 +32,52 @@ $origin = 'http://localhost:3333';
|
||||
$docroot = '/preload/drupal-7.59';
|
||||
$script = 'index.php';
|
||||
|
||||
$path = $request->path;
|
||||
$path = $request->path;
|
||||
$path = preg_replace('/^\\/php-wasm/', '', $path);
|
||||
|
||||
$_SERVER['REQUEST_URI'] = $path;
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['SERVER_NAME'] = $origin;
|
||||
$_SERVER['SERVER_PORT'] = 3333;
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
$_SERVER['REQUEST_METHOD'] = $request->method;
|
||||
$_SERVER['SCRIPT_FILENAME'] = $docroot . '/' . $script;
|
||||
$_SERVER['SCRIPT_NAME'] = $docroot . '/' . $script;
|
||||
$_SERVER['PHP_SELF'] = $docroot . '/' . $script;
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/';
|
||||
|
||||
$databases['default']['default'] = array(
|
||||
'database' => '/drupal-7.db'
|
||||
, 'driver' => 'sqlite'
|
||||
);
|
||||
$_SERVER['HTTPS'] = '';
|
||||
|
||||
chdir($docroot);
|
||||
|
||||
require $script;
|
||||
define('DRUPAL_ROOT', getcwd());
|
||||
|
||||
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
|
||||
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
|
||||
|
||||
$uid = 1;
|
||||
$user = user_load($uid);
|
||||
$account = array('uid' => $user->uid);
|
||||
user_login_submit(array(), $account);
|
||||
|
||||
$itemPath = $path;
|
||||
$itemPath = preg_replace('/^\\/preload/', '', $itemPath);
|
||||
$itemPath = preg_replace('/^\\/drupal-7.59/', '', $itemPath);
|
||||
$itemPath = preg_replace('/^\\//', '', $itemPath);
|
||||
|
||||
if($itemPath && (substr($itemPath, 0, 4) !== 'node' || substr($itemPath, -4) === 'edit'))
|
||||
{
|
||||
$router_item = menu_get_item($itemPath);
|
||||
$router_item['access_callback'] = true;
|
||||
$router_item['access'] = true;
|
||||
|
||||
if ($router_item['include_file']) {
|
||||
require_once DRUPAL_ROOT . '/' . $router_item['include_file'];
|
||||
}
|
||||
|
||||
$page_callback_result = call_user_func_array($router_item['page_callback'], unserialize($router_item['page_arguments']));
|
||||
|
||||
drupal_deliver_page($page_callback_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_execute_active_handler();
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
import { PhpWeb as PHP } from 'php-wasm/PhpWeb';
|
||||
import { PhpWebDrupal as PHP } from 'php-wasm/PhpWebDrupal';
|
||||
|
||||
window.PHP = PHP;
|
||||
const php = new PHP;
|
||||
@@ -11,9 +11,9 @@ const serviceWorker = navigator.serviceWorker;
|
||||
|
||||
if(serviceWorker)
|
||||
{
|
||||
serviceWorker.register(`${location.pathname}DrupalWorker.js`).catch(error => {
|
||||
console.log('Error, ', error);
|
||||
});
|
||||
serviceWorker.register(`${location.pathname}DrupalWorker.js`);
|
||||
// .then(result => console.log('Result, ', result))
|
||||
// .catch(error => console.log('Error, ', error));
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
@@ -85,16 +85,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
stdret.firstChild.remove();
|
||||
}
|
||||
|
||||
const code = `
|
||||
<?php
|
||||
const code = `<?php
|
||||
ini_set('session.save_path', '/home/web_user');
|
||||
session_id('fake-cookie');
|
||||
session_start();
|
||||
|
||||
$stdErr = fopen('php://stderr', 'w');
|
||||
$errors = [];
|
||||
|
||||
fwrite($stdErr, json_encode(['session' => $_SESSION]) . "\n");
|
||||
fwrite($stdErr, isset($_SESSION) && json_encode(['session' => $_SESSION]) . "\n");
|
||||
|
||||
register_shutdown_function(function() use($stdErr){
|
||||
fwrite($stdErr, json_encode(['session_id' => session_id()]) . "\n");
|
||||
@@ -123,6 +120,7 @@ $script = 'index.php';
|
||||
$path = $request->path;
|
||||
$path = preg_replace('/^\\/php-wasm/', '', $path);
|
||||
|
||||
$_SERVER['SERVER_SOFTWARE'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36';
|
||||
$_SERVER['REQUEST_URI'] = $path;
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['SERVER_NAME'] = $origin;
|
||||
@@ -146,8 +144,34 @@ $user = user_load($uid);
|
||||
$account = array('uid' => $user->uid);
|
||||
user_login_submit(array(), $account);
|
||||
|
||||
menu_execute_active_handler();
|
||||
`;
|
||||
$itemPath = $path;
|
||||
$itemPath = preg_replace('/^\\/preload/', '', $itemPath);
|
||||
$itemPath = preg_replace('/^\\/drupal-7.59/', '', $itemPath);
|
||||
$itemPath = preg_replace('/^\\//', '', $itemPath);
|
||||
|
||||
if($itemPath && (substr($itemPath, 0, 4) !== 'node' || substr($itemPath, -4) === 'edit'))
|
||||
{
|
||||
$router_item = menu_get_item($itemPath);
|
||||
$router_item['access_callback'] = true;
|
||||
$router_item['access'] = true;
|
||||
|
||||
if ($router_item['include_file']) {
|
||||
require_once DRUPAL_ROOT . '/' . $router_item['include_file'];
|
||||
}
|
||||
|
||||
$page_callback_result = call_user_func_array(
|
||||
$router_item['page_callback']
|
||||
, is_string($router_item['page_arguments'])
|
||||
? unserialize($router_item['page_arguments'])
|
||||
: $router_item['page_arguments']
|
||||
);
|
||||
|
||||
drupal_deliver_page($page_callback_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_execute_active_handler();
|
||||
}`;
|
||||
|
||||
php.run(code).then(exitCode => {
|
||||
exitLabel.innerText = exitCode;
|
||||
@@ -270,13 +294,18 @@ menu_execute_active_handler();
|
||||
outputBuffer.push(content);
|
||||
|
||||
setTimeout(()=>{
|
||||
const chunk = outputBuffer.join('');
|
||||
let chunk = outputBuffer.join('');
|
||||
|
||||
if(!outputBuffer || !chunk)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(location.hostname.match(/github.io$/))
|
||||
{
|
||||
chunk = chunk.replace(/\/preload/g, '/php-wasm/preload');
|
||||
}
|
||||
|
||||
const node = document.createTextNode(chunk);
|
||||
|
||||
stdout.append(node);
|
||||
@@ -299,8 +328,6 @@ menu_execute_active_handler();
|
||||
session_id = headers.session_id;
|
||||
}
|
||||
|
||||
console.log(session_id);
|
||||
|
||||
if(headers.headers)
|
||||
{
|
||||
for(const header of headers.headers)
|
||||
|
||||
Generated
+18677
-8752
File diff suppressed because it is too large.
Load diff
@@ -6,10 +6,9 @@
|
||||
"author": "Sean Morris",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"postinstall": "cp -rfv node_modules/php-wasm/php-web.* app/assets/"
|
||||
},
|
||||
"dependencies": {
|
||||
"postinstall": "cp -rfv node_modules/php-wasm/php-web.* app/assets/; cp -rfv node_modules/php-wasm/php-web-drupal.* app/assets/"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.8.4",
|
||||
"@babel/core": "^7.8.7",
|
||||
@@ -20,7 +19,7 @@
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"brunch": "^3.0.0",
|
||||
"clean-css-brunch": "^3.0.0",
|
||||
"raw-brunch": "^1.0.2",
|
||||
"php-wasm": "^0.0.3"
|
||||
"php-wasm": "^0.0.4-a",
|
||||
"raw-brunch": "^1.0.2"
|
||||
}
|
||||
}
|
||||
@@ -359,9 +359,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
self.addEventListener('install', function (event) {
|
||||
console.log('Install');
|
||||
self.skipWaiting();
|
||||
});
|
||||
self.addEventListener('activate', function (event) {
|
||||
console.log('Activate');
|
||||
event.waitUntil(clients.claim());
|
||||
});
|
||||
self.addEventListener('fetch', function (event) {
|
||||
@@ -369,6 +371,7 @@ self.addEventListener('fetch', function (event) {
|
||||
var url = new URL(event.request.url);
|
||||
var pathname = url.pathname.replace(/^\//, '');
|
||||
var path = pathname.split('/');
|
||||
console.log(path);
|
||||
|
||||
if (!path[path.length - 1].match(/\.\w+$/) && (path[1] === 'drupal-7.59' || path[2] === 'drupal-7.59')) {
|
||||
var getClient = self.clients.matchAll({
|
||||
|
||||
+24
-9673
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -150,11 +150,11 @@ var __makeRelativeRequire = function(require, mappings, pref) {
|
||||
}
|
||||
};
|
||||
require.register("drupal-init.php", function(exports, require, module) {
|
||||
module.exports = "<?php\n\nini_set('session.save_path', '/home/web_user');\n\n$stdErr = fopen('php://stderr', 'w');\n$errors = [];\n\nregister_shutdown_function(function() use($stdErr, &$errors){\n\tfwrite($stdErr, json_encode(headers_list()) . \"\\n\");\n fwrite($stdErr, json_encode(['session_id' => session_id()]) . \"\\n\");\n fwrite($stdErr, print_r($errors,1));\n fwrite($stdErr, print_r(error_get_last(),1));\n});\n\nset_error_handler(function(...$args) use($stdErr, &$errors){\n\tfwrite($stdErr, print_r($args,1));\n});\n\n$origin = 'http://localhost:3333';\n$docroot = '/php-wasm/preload/drupal-7.59';\n$path = '/';\n$script = 'index.php';\n\n$_SERVER['REQUEST_URI'] = $docroot . $path;\n$_SERVER['REMOTE_ADDR'] = '127.0.0.1';\n$_SERVER['SERVER_NAME'] = $origin;\n$_SERVER['SERVER_PORT'] = 3333;\n$_SERVER['REQUEST_METHOD'] = 'GET';\n$_SERVER['SCRIPT_FILENAME'] = $docroot . '/' . $script;\n$_SERVER['SCRIPT_NAME'] = $docroot . '/' . $script;\n$_SERVER['PHP_SELF'] = $docroot . '/' . $script;\n\nchdir($docroot);\n\nrequire $script;\n"
|
||||
module.exports = "<?php\nini_set('session.save_path', '/home/web_user');\nsession_id('fake-cookie');\nsession_start();\n\n$stdErr = fopen('php://stderr', 'w');\n$errors = [];\n\nregister_shutdown_function(function() use($stdErr, &$errors){\n fwrite($stdErr, json_encode(['session_id' => session_id()]) . \"\\n\");\n fwrite($stdErr, json_encode(['headers'=>headers_list()]) . \"\\n\");\n fwrite($stdErr, json_encode(['errors' => error_get_last()]) . \"\\n\");\n});\n\nset_error_handler(function(...$args) use($stdErr, &$errors){\n\tfwrite($stdErr, print_r($args,1));\n});\n\n$origin = 'http://localhost:3333';\n$docroot = '/preload/drupal-7.59';\n$path = '/';\n$script = 'index.php';\n\n$_SERVER['REQUEST_URI'] = $docroot;\n$_SERVER['REMOTE_ADDR'] = '127.0.0.1';\n$_SERVER['SERVER_NAME'] = $origin;\n$_SERVER['SERVER_PORT'] = 3333;\n$_SERVER['REQUEST_METHOD'] = 'GET';\n$_SERVER['SCRIPT_FILENAME'] = $docroot . '/' . $script;\n$_SERVER['SCRIPT_NAME'] = $docroot . '/' . $script;\n$_SERVER['PHP_SELF'] = $docroot . '/' . $script;\n\nchdir($docroot);\n\ndefine('DRUPAL_ROOT', getcwd());\n\nrequire_once DRUPAL_ROOT . '/includes/bootstrap.inc';\ndrupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);\n\n$uid = 1;\n$user = user_load($uid);\n$account = array('uid' => $user->uid);\nuser_login_submit(array(), $account);\n\n$itemPath = $path;\n$itemPath = preg_replace('/^\\\\/preload/', '', $itemPath);\n$itemPath = preg_replace('/^\\\\/drupal-7.59/', '', $itemPath);\n$itemPath = preg_replace('/^\\\\//', '', $itemPath);\n\nif($itemPath && (substr($itemPath, 0, 4) !== 'node' || substr($itemPath, -4) === 'edit'))\n{\n $router_item = menu_get_item($itemPath);\n $router_item['access_callback'] = true;\n $router_item['access'] = true;\n\n if ($router_item['include_file']) {\n require_once DRUPAL_ROOT . '/' . $router_item['include_file'];\n }\n\n $page_callback_result = call_user_func_array($router_item['page_callback'], unserialize($router_item['page_arguments']));\n\n drupal_deliver_page($page_callback_result);\n}\nelse\n{\n menu_execute_active_handler();\n}\n"
|
||||
});
|
||||
|
||||
;require.register("drupal-request.php", function(exports, require, module) {
|
||||
module.exports = "<?php\nini_set('session.save_path', '/home/web_user');\nsession_start();\nsession_id('${session_id}');\n\n$stdErr = fopen('php://stderr', 'w');\n$errors = [];\n\nregister_shutdown_function(function() use($stdErr, &$errors){\n fwrite($stdErr, json_encode(['session_id' => session_id()]) . \"\\n\" );\n fwrite($stdErr, var_export($errors,1) . \"\\n\");\n});\n\nset_error_handler(function(...$args) use($stdErr, &$errors){\n\t$errors[] = $args;\n});\n\n$request = (object) json_decode(\n\t'${JSON.stringify(event.data)}'\n\t, JSON_OBJECT_AS_ARRAY\n);\n\nparse_str(substr($request->_GET, 1), $_GET);\n\n$_POST = $request->_POST;\n\n$origin = 'http://localhost:3333';\n$docroot = '/preload/drupal-7.59';\n$script = 'index.php';\n\n$path = $request->path;\n\n$_SERVER['REQUEST_URI'] = $path;\n$_SERVER['REMOTE_ADDR'] = '127.0.0.1';\n$_SERVER['SERVER_NAME'] = $origin;\n$_SERVER['SERVER_PORT'] = 3333;\n$_SERVER['REQUEST_METHOD'] = 'GET';\n$_SERVER['SCRIPT_FILENAME'] = $docroot . '/' . $script;\n$_SERVER['SCRIPT_NAME'] = $docroot . '/' . $script;\n$_SERVER['PHP_SELF'] = $docroot . '/' . $script;\n$_SERVER['DOCUMENT_ROOT'] = '/';\n\n$databases['default']['default'] = array(\n\t'database' => '/drupal-7.db'\n\t, 'driver' => 'sqlite'\n);\n\nchdir($docroot);\n\nrequire $script;\n"
|
||||
module.exports = "<?php\nini_set('session.save_path', '/home/web_user');\nsession_id('fake-cookie');\nsession_start();\n\n$stdErr = fopen('php://stderr', 'w');\n$errors = [];\n\nfwrite($stdErr, json_encode(['session' => $_SESSION]) . \"\\n\");\n\nregister_shutdown_function(function() use($stdErr){\n\tfwrite($stdErr, json_encode(['session_id' => session_id()]) . \"\\n\");\n\tfwrite($stdErr, json_encode(['headers'=>headers_list()]) . \"\\n\");\n\tfwrite($stdErr, json_encode(['errors' => error_get_last()]) . \"\\n\");\n\tfwrite($stdErr, json_encode(['session' => $_SESSION]) . \"\\n\");\n});\n\nset_error_handler(function(...$args) use($stdErr, &$errors){\n\tfwrite($stdErr, json_encode($args, JSON_PRETTY_PRINT) . \"\\n\" );\n});\n\n$request = (object) json_decode(\n\t'${ JSON.stringify({path, method, _GET, _POST}) }'\n\t, JSON_OBJECT_AS_ARRAY\n);\n\nparse_str(substr($request->_GET, 1), $_GET);\n\n$_POST = $request->_POST;\n\n$origin = 'http://localhost:3333';\n$docroot = '/preload/drupal-7.59';\n$script = 'index.php';\n\n$path = $request->path;\n$path = preg_replace('/^\\\\/php-wasm/', '', $path);\n\n$_SERVER['REQUEST_URI'] = $path;\n$_SERVER['REMOTE_ADDR'] = '127.0.0.1';\n$_SERVER['SERVER_NAME'] = $origin;\n$_SERVER['SERVER_PORT'] = 3333;\n$_SERVER['REQUEST_METHOD'] = $request->method;\n$_SERVER['SCRIPT_FILENAME'] = $docroot . '/' . $script;\n$_SERVER['SCRIPT_NAME'] = $docroot . '/' . $script;\n$_SERVER['PHP_SELF'] = $docroot . '/' . $script;\n$_SERVER['DOCUMENT_ROOT'] = '/';\n$_SERVER['HTTPS'] = '';\n\nchdir($docroot);\n\ndefine('DRUPAL_ROOT', getcwd());\n\nrequire_once DRUPAL_ROOT . '/includes/bootstrap.inc';\ndrupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);\n\n$uid = 1;\n$user = user_load($uid);\n$account = array('uid' => $user->uid);\nuser_login_submit(array(), $account);\n\n$itemPath = $path;\n$itemPath = preg_replace('/^\\\\/preload/', '', $itemPath);\n$itemPath = preg_replace('/^\\\\/drupal-7.59/', '', $itemPath);\n$itemPath = preg_replace('/^\\\\//', '', $itemPath);\n\nif($itemPath && (substr($itemPath, 0, 4) !== 'node' || substr($itemPath, -4) === 'edit'))\n{\n $router_item = menu_get_item($itemPath);\n $router_item['access_callback'] = true;\n $router_item['access'] = true;\n\n if ($router_item['include_file']) {\n require_once DRUPAL_ROOT . '/' . $router_item['include_file'];\n }\n\n $page_callback_result = call_user_func_array($router_item['page_callback'], unserialize($router_item['page_arguments']));\n\n drupal_deliver_page($page_callback_result);\n}\nelse\n{\n menu_execute_active_handler();\n}\n"
|
||||
});
|
||||
|
||||
;require.alias("process/browser.js", "process");process = require('process');require.register("___globals___", function(exports, require, module) {
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ sso++++++///++//oyyyyhhhyyyyssoo+++syhhhdmNNNNmmmmmmmmdhhyhmNNNmddhhddmmmmmmmmNm
|
||||
</div>
|
||||
<div class = "stdout output liquid">
|
||||
<div class = "column">
|
||||
<iframe class = "scroller" srcdoc=""></iframe>
|
||||
<iframe sandbox = "allow-same-origin allow-scripts allow-forms" class = "scroller" srcdoc=""></iframe>
|
||||
<div class = "scroller"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+35
-330625
File diff suppressed because it is too large.
Load diff
+1
-9461
File diff suppressed because it is too large.
Load diff
Binary file not shown.
@@ -380651,14 +380651,14 @@ function drupal_environment_initialize() {
|
||||
ini_set('magic_quotes_runtime', '0');
|
||||
// Use session cookies, not transparent sessions that puts the session id in
|
||||
// the query string.
|
||||
ini_set('session.use_cookies', '1');
|
||||
ini_set('session.use_only_cookies', '1');
|
||||
ini_set('session.use_trans_sid', '0');
|
||||
// Don't send HTTP headers using PHP's session handler.
|
||||
// An empty string is used here to disable the cache limiter.
|
||||
ini_set('session.cache_limiter', '');
|
||||
// Use httponly session cookies.
|
||||
ini_set('session.cookie_httponly', '1');
|
||||
// ini_set('session.use_cookies', '1');
|
||||
// ini_set('session.use_only_cookies', '1');
|
||||
// ini_set('session.use_trans_sid', '0');
|
||||
// // Don't send HTTP headers using PHP's session handler.
|
||||
// // An empty string is used here to disable the cache limiter.
|
||||
// ini_set('session.cache_limiter', '');
|
||||
// // Use httponly session cookies.
|
||||
// ini_set('session.cookie_httponly', '1');
|
||||
|
||||
// Set sane locale settings, to ensure consistent string, dates, times and
|
||||
// numbers handling.
|
||||
|
||||
+1
-9461
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Whitespace-only changes.
Whitespace-only changes.
@@ -327,8 +327,8 @@ $base_url = '/preload/drupal-7.59'; // NO trailing slash!
|
||||
* PHP's garbage collection for clearing sessions, ensure that garbage
|
||||
* collection occurs by using the most common settings.
|
||||
*/
|
||||
ini_set('session.gc_probability', 1);
|
||||
ini_set('session.gc_divisor', 100);
|
||||
// ini_set('session.gc_probability', 1);
|
||||
// ini_set('session.gc_divisor', 100);
|
||||
|
||||
/**
|
||||
* Set session lifetime (in seconds), i.e. the time from the user's last visit
|
||||
@@ -336,14 +336,14 @@ ini_set('session.gc_divisor', 100);
|
||||
* a session is deleted, authenticated users are logged out, and the contents
|
||||
* of the user's $_SESSION variable is discarded.
|
||||
*/
|
||||
ini_set('session.gc_maxlifetime', 200000);
|
||||
// ini_set('session.gc_maxlifetime', 200000);
|
||||
|
||||
/**
|
||||
* Set session cookie lifetime (in seconds), i.e. the time from the session is
|
||||
* created to the cookie expires, i.e. when the browser is expected to discard
|
||||
* the cookie. The value 0 means "until the browser is closed".
|
||||
*/
|
||||
ini_set('session.cookie_lifetime', 2000000);
|
||||
// ini_set('session.cookie_lifetime', 2000000);
|
||||
|
||||
/**
|
||||
* If you encounter a situation where users post a large amount of text, and
|
||||
|
||||
Generated
+2
-2
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "php-wasm",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.4-b",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.4-b",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.8.4",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"description": "Run PHP right in the browser.",
|
||||
"repository": "https://github.com/seanmorris/pib",
|
||||
"author": "Oraoto <oraoto@outlook.com>",
|
||||
"version": "0.0.4a",
|
||||
"version": "0.0.4-b",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.8.4",
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
diff --git a/third_party/drupal-7.59/includes/bootstrap.inc b/third_party/drupal-7.59/includes/bootstrap.inc
|
||||
index a91c398..dc4b14d 100644
|
||||
--- a/third_party/drupal-7.59/includes/bootstrap.inc
|
||||
+++ b/third_party/drupal-7.59/includes/bootstrap.inc
|
||||
@@ -692,14 +692,14 @@ function drupal_environment_initialize() {
|
||||
ini_set('magic_quotes_runtime', '0');
|
||||
// Use session cookies, not transparent sessions that puts the session id in
|
||||
// the query string.
|
||||
- ini_set('session.use_cookies', '1');
|
||||
- ini_set('session.use_only_cookies', '1');
|
||||
- ini_set('session.use_trans_sid', '0');
|
||||
+ // ini_set('session.use_cookies', '1');
|
||||
+ // ini_set('session.use_only_cookies', '1');
|
||||
+ // ini_set('session.use_trans_sid', '0');
|
||||
// Don't send HTTP headers using PHP's session handler.
|
||||
// An empty string is used here to disable the cache limiter.
|
||||
- ini_set('session.cache_limiter', '');
|
||||
- // Use httponly session cookies.
|
||||
- ini_set('session.cookie_httponly', '1');
|
||||
+ // ini_set('session.cache_limiter', '');
|
||||
+ // // Use httponly session cookies.
|
||||
+ // ini_set('session.cookie_httponly', '1');
|
||||
|
||||
// Set sane locale settings, to ensure consistent string, dates, times and
|
||||
// numbers handling.
|
||||
@@ -784,26 +784,26 @@ function drupal_settings_initialize() {
|
||||
$session_name = $cookie_domain;
|
||||
}
|
||||
else {
|
||||
- // Otherwise use $base_url as session name, without the protocol
|
||||
- // to use the same session identifiers across HTTP and HTTPS.
|
||||
- list( , $session_name) = explode('://', $base_url, 2);
|
||||
- // HTTP_HOST can be modified by a visitor, but we already sanitized it
|
||||
- // in drupal_settings_initialize().
|
||||
- if (!empty($_SERVER['HTTP_HOST'])) {
|
||||
- $cookie_domain = $_SERVER['HTTP_HOST'];
|
||||
- // Strip leading periods, www., and port numbers from cookie domain.
|
||||
- $cookie_domain = ltrim($cookie_domain, '.');
|
||||
- if (strpos($cookie_domain, 'www.') === 0) {
|
||||
- $cookie_domain = substr($cookie_domain, 4);
|
||||
- }
|
||||
- $cookie_domain = explode(':', $cookie_domain);
|
||||
- $cookie_domain = '.' . $cookie_domain[0];
|
||||
- }
|
||||
+ // // Otherwise use $base_url as session name, without the protocol
|
||||
+ // // to use the same session identifiers across HTTP and HTTPS.
|
||||
+ // list( , $session_name) = explode('://', $base_url, 2);
|
||||
+ // // HTTP_HOST can be modified by a visitor, but we already sanitized it
|
||||
+ // // in drupal_settings_initialize().
|
||||
+ // if (!empty($_SERVER['HTTP_HOST'])) {
|
||||
+ // $cookie_domain = $_SERVER['HTTP_HOST'];
|
||||
+ // // Strip leading periods, www., and port numbers from cookie domain.
|
||||
+ // $cookie_domain = ltrim($cookie_domain, '.');
|
||||
+ // if (strpos($cookie_domain, 'www.') === 0) {
|
||||
+ // $cookie_domain = substr($cookie_domain, 4);
|
||||
+ // }
|
||||
+ // $cookie_domain = explode(':', $cookie_domain);
|
||||
+ // $cookie_domain = '.' . $cookie_domain[0];
|
||||
+ // }
|
||||
}
|
||||
// Per RFC 2109, cookie domains must contain at least one dot other than the
|
||||
// first. For hosts such as 'localhost' or IP Addresses we don't set a cookie domain.
|
||||
if (count(explode('.', $cookie_domain)) > 2 && !is_numeric(str_replace('.', '', $cookie_domain))) {
|
||||
- ini_set('session.cookie_domain', $cookie_domain);
|
||||
+ // ini_set('session.cookie_domain', $cookie_domain);
|
||||
}
|
||||
// To prevent session cookies from being hijacked, a user can configure the
|
||||
// SSL version of their website to only transfer session cookies via SSL by
|
||||
@@ -812,10 +812,10 @@ function drupal_settings_initialize() {
|
||||
// must use different session identifiers for HTTPS and HTTP to prevent a
|
||||
// cookie collision.
|
||||
if ($is_https) {
|
||||
- ini_set('session.cookie_secure', TRUE);
|
||||
+ // ini_set('session.cookie_secure', TRUE);
|
||||
}
|
||||
- $prefix = ini_get('session.cookie_secure') ? 'SSESS' : 'SESS';
|
||||
- session_name($prefix . substr(hash('sha256', $session_name), 0, 32));
|
||||
+ // $prefix = ini_get('session.cookie_secure') ? 'SSESS' : 'SESS';
|
||||
+ // session_name($prefix . substr(hash('sha256', $session_name), 0, 32));
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/third_party/drupal-7.59/includes/common.inc b/third_party/drupal-7.59/includes/common.inc
|
||||
index f61d1eb..bdbd4ac 100644
|
||||
--- a/third_party/drupal-7.59/includes/common.inc
|
||||
+++ b/third_party/drupal-7.59/includes/common.inc
|
||||
@@ -391,7 +391,7 @@ function drupal_add_feed($url = NULL, $title = '') {
|
||||
*/
|
||||
function drupal_get_feeds($delimiter = "\n") {
|
||||
$feeds = drupal_add_feed();
|
||||
- return implode($feeds, $delimiter);
|
||||
+ return implode($delimiter, $feeds);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6592,6 +6592,6 @@ function element_children(&$elements, $sort = FALSE) {
|
||||
$children = array();
|
||||
$sortable = FALSE;
|
||||
foreach ($elements as $key => $value) {
|
||||
+ if ($key === '' || (is_int($key) || $key[0] !== '#')) {
|
||||
- if ($key === '' || $key[0] !== '#') {
|
||||
$children[$key] = $value;
|
||||
if (is_array($value) && isset($value['#weight'])) {
|
||||
diff --git a/third_party/drupal-7.59/includes/menu.inc b/third_party/drupal-7.59/includes/menu.inc
|
||||
index 4664d27..96698df 100644
|
||||
--- a/third_party/drupal-7.59/includes/menu.inc
|
||||
+++ b/third_party/drupal-7.59/includes/menu.inc
|
||||
@@ -520,6 +520,7 @@ function menu_execute_active_handler($path = NULL, $deliver = TRUE) {
|
||||
// Only continue if the site status is not set.
|
||||
if ($page_callback_result == MENU_SITE_ONLINE) {
|
||||
if ($router_item = menu_get_item($path)) {
|
||||
+ $router_item['access'] = TRUE;
|
||||
if ($router_item['access']) {
|
||||
if ($router_item['include_file']) {
|
||||
require_once DRUPAL_ROOT . '/' . $router_item['include_file'];
|
||||
diff --git a/third_party/drupal-7.59/modules/system/system.module b/third_party/drupal-7.59/modules/system/system.module
|
||||
index 53844d8..dee8808 100644
|
||||
--- a/third_party/drupal-7.59/modules/system/system.module
|
||||
+++ b/third_party/drupal-7.59/modules/system/system.module
|
||||
@@ -2131,7 +2131,11 @@ function system_admin_menu_block($item) {
|
||||
}
|
||||
|
||||
if (!isset($item['mlid'])) {
|
||||
- $item += db_query("SELECT mlid, menu_name FROM {menu_links} ml WHERE ml.router_path = :path AND module = 'system'", array(':path' => $item['path']))->fetchAssoc();
|
||||
+ $res = db_query("SELECT mlid, menu_name FROM {menu_links} ml WHERE ml.router_path = :path AND module = 'system'", array(':path' => $item['path']))->fetchAssoc();
|
||||
+
|
||||
+ if ($res) {
|
||||
+ $item += $res;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (isset($cache[$item['mlid']])) {
|
||||
diff --git a/third_party/drupal-7.59/sites/default/files/.htaccess b/third_party/drupal-7.59/sites/default/files/.htaccess
|
||||
new file mode 100644
|
||||
index 0000000..7051eb8
|
||||
--- /dev/null
|
||||
+++ b/third_party/drupal-7.59/sites/default/files/.htaccess
|
||||
@@ -0,0 +1,15 @@
|
||||
+# Turn off all options we don't need.
|
||||
+Options None
|
||||
+Options +FollowSymLinks
|
||||
+
|
||||
+# Set the catch-all handler to prevent scripts from being executed.
|
||||
+SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
|
||||
+<Files *>
|
||||
+ # Override the handler again if we're run later in the evaluation list.
|
||||
+ SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
|
||||
+</Files>
|
||||
+
|
||||
+# If we know how to do it safely, disable the PHP engine entirely.
|
||||
+<IfModule mod_php5.c>
|
||||
+ php_flag engine off
|
||||
+</IfModule>
|
||||
\ No newline at end of file
|
||||
@@ -0,0 +1,71 @@
|
||||
import { PhpBase } from './PhpBase';
|
||||
|
||||
const PhpBinary = require('./php-web-drupal');
|
||||
|
||||
export class PhpWebDrupal extends PhpBase
|
||||
{
|
||||
constructor(args = {})
|
||||
{
|
||||
super(PhpBinary, args);
|
||||
}
|
||||
}
|
||||
|
||||
if(window && document)
|
||||
{
|
||||
const php = new PhpWebDrupal;
|
||||
|
||||
const runScriptTag = element => {
|
||||
|
||||
const src = element.getAttribute('src');
|
||||
|
||||
if(src)
|
||||
{
|
||||
fetch(src).then(r => r.text()).then(r => {
|
||||
php.run(r).then(exit=>console.log(exit));
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const inlineCode = element.innerText.trim();
|
||||
|
||||
if(inlineCode)
|
||||
{
|
||||
php.run(inlineCode);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
php.addEventListener('ready', () => {
|
||||
const phpSelector = 'script[type="text/php"]';
|
||||
|
||||
const htmlNode = document.body.parentElement;
|
||||
const observer = new MutationObserver((mutations, observer)=>{
|
||||
for(const mutation of mutations)
|
||||
{
|
||||
for(const addedNode of mutation.addedNodes)
|
||||
{
|
||||
if(!addedNode.matches || !addedNode.matches(phpSelector))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
runScriptTag(addedNode);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe(htmlNode, {childList: true, subtree: true});
|
||||
|
||||
const phpNodes = document.querySelectorAll(phpSelector);
|
||||
|
||||
for(const phpNode of phpNodes)
|
||||
{
|
||||
const code = phpNode.innerText.trim();
|
||||
|
||||
runScriptTag(phpNode);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user