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) { 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) {