public function testExplodePath() { $bookChapter = Filter_Git::explodePath("Genesis/2/data"); $this->assertEquals(array('book' => 1, 'chapter' => 2), $bookChapter); $bookChapter = Filter_Git::explodePath("Genesi/2/data"); $this->assertEquals(NULL, $bookChapter); $bookChapter = Filter_Git::explodePath("Exodus/3/data"); $this->assertEquals(array('book' => 2, 'chapter' => 3), $bookChapter); $bookChapter = Filter_Git::explodePath("dictionary"); $this->assertEquals(NULL, $bookChapter); }
$shelldirectory = escapeshellarg($directory); // Retrieve all commits from the git repository. // Remove the commits already dealt with. $commits = Filter_Git::commits($directory); $commits = array_diff($commits, $database_commits->get($bible)); // Deal with all the remaining commits. foreach ($commits as $sha1) { // Get author and timestamp. $author = Filter_Git::committer($directory, $sha1); $timestamp = Filter_Git::timestamp($directory, $sha1); $datetime = date('j F Y g:i:s a', $timestamp); $database_logs->log("{$history} {$author} {$datetime} {$bible} {$sha1}", Filter_Roles::MANAGER_LEVEL); $files = Filter_Git::files($directory, $sha1); foreach ($files as $path) { $database_logs->log("{$history} {$path}", Filter_Roles::MANAGER_LEVEL); $data = Filter_Git::explodePath($path); if ($data) { $book = $data['book']; $chapter = $data['chapter']; $data = Filter_Git::changes($directory, $sha1, $path); $oldusfm = $data['old']; $newusfm = $data['new']; $oldverses = Filter_Usfm::getVerseNumbers($oldusfm); $newverses = Filter_Usfm::getVerseNumbers($newusfm); $verses = array_merge($oldverses, $newverses); $verses = array_unique($verses); sort($verses, SORT_NUMERIC); foreach ($verses as $verse) { $old_verse_usfm = Filter_Usfm::getVerseText($oldusfm, $verse); $new_verse_usfm = Filter_Usfm::getVerseText($newusfm, $verse); if ($old_verse_usfm != $new_verse_usfm) {