Пример #1
0
 /**
  * Processes the request to revert to an earlier commit.
  * @access public
  */
 public function revert_files($redirect = true)
 {
     Revisr_Admin::verify_nonce($_REQUEST['revisr_revert_nonce'], 'revisr_revert_nonce');
     $commit = $_REQUEST['commit_hash'];
     $commit_msg = sprintf(__('Reverted to commit: #%s.', 'revisr'), $commit);
     revisr()->git->reset('--hard', 'HEAD', true);
     revisr()->git->reset('--hard', $commit);
     revisr()->git->reset('--soft', 'HEAD@{1}');
     revisr()->git->run('add', array('-A'));
     revisr()->git->commit($commit_msg);
     revisr()->git->auto_push();
     $commit_url = get_admin_url() . 'admin.php?page=revisr_view_commit&commit=' . $commit;
     $msg = sprintf(__('Reverted to commit <a href="%s">#%s</a>.', 'revisr'), $commit_url, $commit);
     $email_msg = sprintf(__('%s was reverted to commit #%s', 'revisr'), get_bloginfo(), $commit);
     Revisr_Admin::log($msg, 'revert');
     Revisr_Admin::notify(get_bloginfo() . __(' - Commit Reverted', 'revisr'), $email_msg);
     if (true === $redirect) {
         Revisr_Admin::redirect();
     }
 }
Пример #2
0
 /**
  * Returns if a merge failed.
  * @access public
  */
 public function null_merge($output = array(), $args = '')
 {
     $log_msg = sprintf(__('Error merging branch %s into %s.', 'revisr'), $_REQUEST['branch'], revisr()->git->branch);
     $alert_msg = sprintf(__('There was an error merging branch %s into your current branch. The merge was aborted to avoid conflicts.', 'revisr'), $_REQUEST['branch']);
     Revisr_Admin::alert($alert_msg, true, $output);
     Revisr_Admin::log($log_msg, 'error');
     Revisr_Admin::redirect();
 }