Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAustin Schaffer <austin.schaffer@ryansg.com>2020-02-14 11:44:20 -0500
committerAustin Schaffer <austin.schaffer@ryansg.com>2020-02-14 11:44:20 -0500
commitbcfa7c061cb2c299337c47b51c1156f0be508cbf (patch)
treef29ec0bd1f747a2eae76b2db6c845a32422b9a7e
parent98d9d208f61fb65e4567fe003fffa78beeba137c (diff)
downloadliza-bcfa7c061cb2c299337c47b51c1156f0be508cbf.tar.gz
liza-bcfa7c061cb2c299337c47b51c1156f0be508cbf.tar.bz2
liza-bcfa7c061cb2c299337c47b51c1156f0be508cbf.zip
Add backwards compatibility with node v4
-rw-r--r--package.json.in2
-rw-r--r--src/server/request/UserSession.js7
2 files changed, 4 insertions, 5 deletions
diff --git a/package.json.in b/package.json.in
index 185f6b8..7d4be74 100644
--- a/package.json.in
+++ b/package.json.in
@@ -21,7 +21,7 @@
},
"scripts": {
- "postinstall": "./configure"
+ "postinstall": "./configure && if [ $(@NODE@ --version | sed 's/^v//' | cut -d. -f1) -ge \"12\" ]; then ln -s php-serialize ./node_modules/php; else rm -f node_modules/php; fi"
},
"dependencies": {
diff --git a/src/server/request/UserSession.js b/src/server/request/UserSession.js
index 6d3fa24..9f92485 100644
--- a/src/server/request/UserSession.js
+++ b/src/server/request/UserSession.js
@@ -23,8 +23,7 @@
// php compatibility
var Class = require( 'easejs' ).Class,
- phpS = require('php-serialize');
-
+ php = require( 'php' );
/**
* Stores/retrieves user PHP session data from memcached
@@ -235,7 +234,7 @@ module.exports = Class.extend( require( '../../events' ).EventEmitter,
for ( var key in data )
{
- newdata += key + '|' + phpS.serialize( data[ key ] );
+ newdata += key + '|' + php.serialize( data[ key ] );
}
_self._memcache.set( _self._id, newdata, 0, function()
@@ -281,7 +280,7 @@ module.exports = Class.extend( require( '../../events' ).EventEmitter,
val = splits[ ++i ];
// the values are serialized PHP data; unserialize them
- val = phpS.unserialize( val );
+ val = php.unserialize( val );
// add to the session data
session_data[ key ] = val;