Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: emergence v1.1.5 #72

Open
wants to merge 7 commits into
base: releases/v1.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
.npmignore
cloud-config.yaml
Dockerfile
run-dev-container
run-dev-container
build-docker-image
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ COPY . /src
RUN npm install -g /src


# link certbot renewal hook to reload nginx
RUN mkdir -p /etc/letsencrypt/renewal-hooks/deploy \
&& ln -s /src/bin/reload-nginx /etc/letsencrypt/renewal-hooks/deploy/01-reload-nginx


# setup and expose emergence
RUN mkdir -p /emergence
EXPOSE 22 80 3306 9083
ENV MYSQL_HOME=/emergence/services/etc
VOLUME ["/emergence"]
VOLUME ["/emergence", "/etc/letsencrypt"]


# setup entrypoint
Expand Down
3 changes: 3 additions & 0 deletions bin/reload-nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash -e

/usr/sbin/nginx -c /emergence/services/etc/nginx.conf -s reload
2 changes: 2 additions & 0 deletions bin/resolve-site
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ UNDERSCORE="$DIR/../node_modules/.bin/underscore"
# search sites
pushd /emergence/sites > /dev/null
for SITE_DIR in `find . -maxdepth 1 ! -path . -type d`; do
[ -f "${SITE_DIR}/site.json" ] || continue

SITE_HANDLE="$(basename ${SITE_DIR})"
SITE_HOSTNAMES="$(sudo cat ${SITE_DIR}/site.json | $UNDERSCORE process '(data.hostnames||[]).concat([data.primary_hostname]).filter(x=>x)' --outfmt text)"

Expand Down
6 changes: 5 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "emergence",
"preferGlobal": true,
"version": "1.1.3",
"version": "1.1.5",
"license": "MIT",
"dependencies": {
"hostile": "^1.3.x",
Expand Down
12 changes: 11 additions & 1 deletion php-bootstrap/lib/DB.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,19 @@ public static function syncTimezone()
return;
}

$timezoneTestResult = DB::oneValue('SELECT CONVERT_TZ("2007-03-11 3:00:00", "US/Eastern", "US/Central")');

if ($timezoneTestResult == '2007-03-11 01:00:00') {
// MySQL server support named timezones
$mysqlTimezone = date_default_timezone_get();
} else {
// use static timezone offset because MySQL doesn't have timezone tables loaded
$mysqlTimezone = date('P');
}

self::nonQuery(
'SET time_zone = "%s"',
self::escape(date('P'))
self::escape($mysqlTimezone)
);
}

Expand Down
2 changes: 1 addition & 1 deletion php-bootstrap/lib/Emergence_FS.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ public static function findFiles($filename, $useRegexp = false, $scope = null, $
}

$fileResults = DB::query(
'SELECT f2.* FROM (SELECT MAX(f1.ID) AS ID FROM `%1$s` f1 WHERE CollectionID IN (%2$s) AND Status != "Phantom" GROUP BY f1.Handle) AS lastestFiles LEFT JOIN `%1$s` f2 ON (f2.ID = lastestFiles.ID) WHERE f2.Status != "Deleted" AND f2.Handle %3$s "%4$s"'
'SELECT f2.* FROM (SELECT MAX(f1.ID) AS ID FROM `%1$s` f1 WHERE CollectionID IN (%2$s) AND Status != "Phantom" GROUP BY f1.CollectionID, f1.Handle) AS lastestFiles LEFT JOIN `%1$s` f2 ON (f2.ID = lastestFiles.ID) WHERE f2.Status != "Deleted" AND f2.Handle %3$s "%4$s"'
,array(
SiteFile::$tableName
,$collectionsQuery
Expand Down
20 changes: 14 additions & 6 deletions php-bootstrap/lib/Site.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,20 @@ public static function getRequestPathResult($path)
public static function executeScript(SiteFile $_SCRIPT_NODE, $_SCRIPT_EXIT = true)
{
// create session
if (
empty($GLOBALS['Session']) &&
static::$autoCreateSession &&
!in_array(implode('/', static::$resolvedPath), static::$skipSessionPaths)
) {
$GLOBALS['Session'] = UserSession::getFromRequest();
if (empty($GLOBALS['Session']) && static::$autoCreateSession) {
$resolvedPath = implode('/', static::$resolvedPath) . '/';

$createSession = true;
foreach (static::$skipSessionPaths as $skipSessionPath) {
if (strpos($resolvedPath, $skipSessionPath) === 0) {
$createSession = false;
break;
}
}

if ($createSession) {
$GLOBALS['Session'] = UserSession::getFromRequest();
}
}

if (extension_loaded('newrelic')) {
Expand Down