You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once "../bootstrap/bootstrap.php"; Filter_Cli::assert(); $object = Filter_Cli::argument(@$argv, 1); $database_config_bible = Database_Config_Bible::getInstance(); $database_notes = Database_Notes::getInstance(); $url = $database_config_bible->getRemoteRepositoryUrl($object); $directory = Filter_Git::git_directory($object); $consultationsfolder = $database_notes->mainFolder(); // Our data goes into the local repository. echo Locale_Translate::_("Step 1/2:") . " "; echo Locale_Translate::_("Exporting the local Bible data to the local repository") . "\n"; Filter_Git::syncBible2Git($object, $directory, true); // Directory for use by the shell. $shelldirectory = escapeshellarg($directory); // Add and commit the data. $command = "cd {$shelldirectory}; git add --all ."; echo "{$command}\n"; exec($command, $output, $exit_code); echo "Exit code {$exit_code}\n"; if ($exit_code != 0) { foreach ($output as $line) { echo "{$line}\n"; } } $command = "cd {$shelldirectory}; git commit -a -m admin-sync"; echo "{$command}\n"; exec($command, $output, $exit_code);
<?php /* Copyright (©) 2003-2014 Teus Benschop. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once "../bootstrap/bootstrap.php"; page_access_level(Filter_Roles::ADMIN_LEVEL); Assets_Page::header(Locale_Translate::_("Collaboration")); $view = new Assets_View(__FILE__); $object = $_GET['object']; $view->view->object = $object; $database_config_bible = Database_Config_Bible::getInstance(); $url = $database_config_bible->getRemoteRepositoryUrl($object); $directory = Filter_Git::git_directory($object); $view->render("collaboration_repo_data.php"); Assets_Page::footer();
Assets_Page::header(Locale_Translate::_("Bibles")); $view = new Assets_View(__FILE__); $database_bibles = Database_Bibles::getInstance(); $database_users = Database_Users::getInstance(); $session_logic = Session_Logic::getInstance(); // Delete Bible handler. if (isset($_GET['delete'])) { $bible = $_GET['delete']; @($confirm = $_GET['confirm']); if ($confirm != "") { ignore_user_abort(true); set_time_limit(0); // User needs write access for delete operation. if (Access_Bible::write($bible)) { Bible_Logic::deleteBible($bible); $gitdirectory = Filter_Git::git_directory($bible); if (file_exists($gitdirectory)) { Filter_Rmdir::rmdir($gitdirectory); } } else { Assets_Page::error("Insufficient privileges to complete action"); } } else { $dialog_yes = new Dialog_Yes(NULL, Locale_Translate::_("Would you like to delete Bible {$bible}?"), "delete"); die; } } // New Bible handler. if (isset($_GET['new'])) { $dialog_entry = new Dialog_Entry("", Locale_Translate::_("Please enter a name for the new empty Bible"), "", "new", ""); die;
Copyright (©) 2003-2014 Teus Benschop. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once "../bootstrap/bootstrap.php"; Filter_Cli::assert(); error_reporting(E_ERROR); $object = Filter_Cli::argument(@$argv, 1); $database_config_bible = Database_Config_Bible::getInstance(); $database_notes = Database_Notes::getInstance(); $url = $database_config_bible->getRemoteRepositoryUrl($object); $directory = Filter_Git::git_directory($object); // Copy the data from the local cloned repository, and store it in Bibledit-Web's Bible given in $object, // overwriting the whole Bible that was there before. echo Locale_Translate::_("Copying the data from the local cloned repository, and storing it in the Bible") . "\n"; Filter_Git::syncGit2Bible($directory, $object); exec("sync"); $database_shell = Database_Shell::getInstance(); $database_shell->stopProcess("collaboration_take_repo", 0);
} 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 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); }
$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) { $filter_text_old = new Filter_Text($bible); $filter_text_new = new Filter_Text($bible); $filter_text_old->html_text_standard = new Html_Text(""); $filter_text_new->html_text_standard = new Html_Text("");