From a6129e4386aea9f097e6eef111699bc16b777419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Jes=C3=BAs=20S=C3=A1nchez=20Padial?= Date: Mon, 12 May 2014 11:47:32 +0200 Subject: [PATCH 1/2] Make it Windows compatible. --- engine/update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/update.php b/engine/update.php index 87b880c..7057f0d 100755 --- a/engine/update.php +++ b/engine/update.php @@ -10,7 +10,7 @@ exit(1); } -if (file_put_contents(LOCK_FILE, posix_getpid())) { +if (file_put_contents(LOCK_FILE, getmypid())) { register_shutdown_function( function() { try { unlink(LOCK_FILE); } catch (Exception $e) { From 271692ce8b648a31b728d4b0f0ebbc65b3c770e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Jes=C3=BAs=20S=C3=A1nchez=20Padial?= Date: Mon, 12 May 2014 12:20:37 +0200 Subject: [PATCH 2/2] Recognize line-feed as well as carriage return for Windows systems. --- engine/Post.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/Post.php b/engine/Post.php index 40f3639..5253d14 100755 --- a/engine/Post.php +++ b/engine/Post.php @@ -62,9 +62,11 @@ public function __construct($source_filename, $is_draft = -1 /* auto */) { $this->source_filename = $source_filename; $this->is_draft = ($is_draft === -1 ? (false !== strpos($source_filename, 'drafts/') || false !== strpos($source_filename, 'pages/')) : $is_draft); - $this->timestamp = filemtime($source_filename); + $this->timestamp = filemtime($source_filename); + + $source_contents = trim(file_get_contents($source_filename)); + $segments = preg_split('/\r\n\r\n|\n\n/', $source_contents, 2); - $segments = explode("\n\n", trim(file_get_contents($source_filename)), 2); if (! isset($segments[1])) $segments[1] = ''; if (count($segments) > 1) {