} foreach ($result as $line) { if (strstr($line, "/.ssh") != false) { continue; } if ($line) { $logs[] = "{$send_receive} {$line}"; } } if (!$success || count($result) > 1) { foreach ($logs as $log) { $database_logs->log($log, Filter_Roles::TRANSLATOR_LEVEL); } } } // Record the changes from the collaborators into the Bible database. if ($success) { foreach ($pull_messages as $pull_message) { $book_chapter = Filter_Git::getPullPassage($pull_message); if ($book_chapter) { $book = $book_chapter['book']; $chapter = $book_chapter['chapter']; Filter_Git::syncGitChapter2Bible($directory, $bible, $book, $chapter); } } } // Done. if (!$success) { $database_logs->log("Failure during sending and receiving", Filter_Roles::TRANSLATOR_LEVEL); } $database_logs->log("Ready sending and receiving Bible" . " " . $bible, Filter_Roles::TRANSLATOR_LEVEL);
public function testGetPullPassage() { $output = Filter_Git::getPullPassage("From https://github.com/joe/test"); $this->assertNull($output); $output = Filter_Git::getPullPassage(" 443579b..90dcb57 master -> origin/master"); $this->assertNull($output); $output = Filter_Git::getPullPassage("Updating 443579b..90dcb57"); $this->assertNull($output); $output = Filter_Git::getPullPassage("Fast-forward"); $this->assertNull($output); $output = Filter_Git::getPullPassage(" Genesis/3/data | 2 +-"); $this->assertEquals(array('book' => "1", 'chapter' => "3"), $output); $output = Filter_Git::getPullPassage(" 1 file changed, 1 insertion(+), 1 deletion(-)"); $this->assertNull($output); $output = Filter_Git::getPullPassage(" delete mode 100644 Leviticus/1/data"); $this->assertNull($output); $output = Filter_Git::getPullPassage(" Revelation/3/data | 2 +-"); $this->assertEquals(array('book' => "66", 'chapter' => "3"), $output); }