/** * Define the connection to use with mysqldump. * @access public */ public function __construct() { $this->branch = Revisr_Git::current_branch(); $this->dir = getcwd(); $this->git = new Revisr_Git(); $this->sql_file = 'revisr_db_backup.sql'; $this->options = Revisr_Admin::options(); $this->upload_dir = wp_upload_dir(); $this->check_exec(); if (isset($this->options['mysql_path'])) { $this->path = $this->options['mysql_path']; } else { $this->path = ''; } if (DB_PASSWORD != '') { $this->conn = "-u '" . DB_USER . "' -p'" . DB_PASSWORD . "' " . DB_NAME . " --host " . DB_HOST; } else { $this->conn = "-u '" . DB_USER . "' " . DB_NAME . " --host " . DB_HOST; } chdir($this->upload_dir['basedir']); }
/** * Custom messages for commits. * @access public * @param array $messages The messages to pass back to the commits. */ public function revisr_commits_custom_messages($messages) { $post = get_post(); $messages['revisr_commits'] = array(0 => '', 1 => __('Commit updated.', 'revisr_commits'), 2 => __('Custom field updated.', 'revisr_commits'), 3 => __('Custom field deleted.', 'revisr_commits'), 4 => __('Commit updated.', 'revisr_commits'), 5 => isset($_GET['revision']) ? sprintf(__('Commit restored to revision from %s', 'revisr_commits'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => __('Committed files on branch <strong>' . Revisr_Git::current_branch() . '</strong>.', 'revisr_commits'), 7 => __('Commit saved.', 'revisr_commits'), 8 => __('Commit submitted.', 'revisr_commits'), 9 => sprintf(__('Commit scheduled for: <strong>%1$s</strong>.', 'revisr_commits'), date_i18n(__('M j, Y @ G:i', 'revisr_commits'), strtotime($post->post_date))), 10 => __('Commit draft updated.', 'revisr_commits')); return $messages; }
/** * Returns the hash/id of the current commit. * @access public */ public static function current_commit() { $branch = Revisr_Git::current_branch(); $hash = Revisr_Git::run("rev-parse {$branch} --pretty=oneline"); return substr($hash[0], 0, 7); }
} else { if (isset($_GET['checkout']) && $_GET['checkout'] == 'success') { $text = sprintf(__('<p>Successfully checked out branch <strong>%s</strong>.</p>', 'revisr'), $_GET['branch']); } else { if (isset($_GET['revert']) && $_GET['revert'] == 'success') { $url = get_admin_url() . "post.php?post={$_GET['id']}&action=edit"; $text = "<p>Successfully reverted to commit <a href='{$url}'><strong>#{$_GET['commit']}</strong></a>.</p>"; } else { if ($pending != 0) { if ($pending == 1) { $text = sprintf(__('<p>There is currently <strong>1</strong> untracked file on branch <strong>%s</strong>.</p>', 'revisr'), Revisr_Git::current_branch()); } else { $text = sprintf(__('<p>There are currently <strong>%d</strong> untracked files on branch <strong>%s</strong>.</p>', 'revisr'), $pending, Revisr_Git::current_branch()); } } else { $text = sprintf(__('<p>There are currently no untracked files on branch <strong>%s</strong>.</p>', 'revisr'), Revisr_Git::current_branch()); } } } } echo "<div id='revisr_alert' class='updated'>{$text}</div>"; } ?> <div id="poststuff"> <div id="revisr_alert"></div> <div id="post-body" class="metabox-holder columns-2"> <!-- main content --> <div id="post-body-content"> <div class="meta-box-sortables ui-sortable">