예제 #1
0
 /**
  * Commits the database to the repository and pushes if needed.
  * @access public
  * @param  boolean $insert_post Whether to insert a new commit custom_post_type.
  */
 public function commit_db($insert_post = false)
 {
     $commit_msg = __('Backed up the database with Revisr.', 'revisr');
     $this->git->commit($commit_msg);
     // Insert the corresponding post if necessary.
     if ($insert_post === true) {
         $post = array('post_title' => $commit_msg, 'post_content' => '', 'post_type' => 'revisr_commits', 'post_status' => 'publish');
         $post_id = wp_insert_post($post);
         $commit_hash = $this->git->current_commit();
         add_post_meta($post_id, 'commit_hash', $commit_hash);
         add_post_meta($post_id, 'db_hash', $commit_hash);
         add_post_meta($post_id, 'backup_method', 'tables');
         add_post_meta($post_id, 'branch', $this->git->branch);
         add_post_meta($post_id, 'files_changed', '0');
         add_post_meta($post_id, 'committed_files', array());
     }
     // Push changes if necessary.
     $this->git->auto_push();
 }
예제 #2
0
        chdir(ABSPATH);
        file_put_contents(".gitignore", $options['gitignore']);
    }
    if (isset($options['username']) && $options['username'] != "") {
        Revisr_Git::run('config user.name "' . $options['username'] . '"');
    }
    if (isset($options['email']) && $options['email'] != "") {
        Revisr_Git::run('config user.email "' . $options['email'] . '"');
    }
    if (isset($options['remote_url']) && $options['remote_url'] != "") {
        Revisr_Git::run('config remote.origin.url ' . $options['remote_url']);
    }
    Revisr_Git::run("add .gitignore");
    $commit_msg = __('Updated .gitignore.', 'revisr');
    Revisr_Git::run("commit -m \"{$commit_msg}\"");
    $git->auto_push();
    chdir($git->dir);
}
?>

<div class="wrap">
	<div id="revisr_settings">
		<h2><?php 
_e('Revisr - Settings', 'revisr');
?>
</h2>
		<?php 
$active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'general_settings';
if (isset($_GET['settings-updated']) && $_GET['settings-updated'] == "true") {
    _e('<div id="revisr_alert" class="updated"><p>Settings updated successfully.</p></div>', 'revisr');
}