} 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 testSyncGitChapterToBibleUpdateChapters() { // The git repository has Psalm 0, Psalm 11, and Song of Solomon 2. // Put that into the Bible database. $database_bibles = Database_Bibles::getInstance(); Filter_Git::syncGit2Bible($this->repository, $this->bible); // Update some chapters in the git repository. file_put_contents($this->repository . "/Psalms/11/data", "\\c 11"); file_put_contents($this->repository . "/Song of Solomon/2/data", "\\c 2"); // Run updates on the two chapters. Filter_Git::syncGitChapter2Bible($this->repository, $this->bible, 19, 11); Filter_Git::syncGitChapter2Bible($this->repository, $this->bible, 22, 2); // Check that the database is updated accordingly. $usfm = $database_bibles->getChapter($this->bible, 19, 0); $this->assertEquals($this->psalms_0_data, $usfm); $usfm = $database_bibles->getChapter($this->bible, 19, 11); $this->assertEquals("\\c 11", $usfm); $usfm = $database_bibles->getChapter($this->bible, 22, 2); $this->assertEquals("\\c 2", $usfm); }