Commit 732de67e authored by Ændra Rininsland's avatar Ændra Rininsland
Browse files

Fixing some bugs after automated PAReview.

parent 75a60b71
Loading
Loading
Loading
Loading
+13 −16
Original line number Diff line number Diff line
@@ -2,22 +2,17 @@

/**
 * @file
 * Handles the file processes and html parsing for exporting a Drupal node.
 * Handles the file processing and html parsing for exporting a Drupal node.
 */

/**
 * Implements ghpages_initialize_repo().
 */
function ghpages_initialize_repo() {
  libraries_load('Git.php');

  $ghpages_path = drupal_realpath(file_default_scheme() . '://') . '/gh-pages';
  if (!is_dir($ghpages_path)) {
    mkdir($ghpages_path);
  }
  if (!is_dir($ghpages_path . '/.git')) {
    $repo_root = Git::create($ghpages_path);
  }

  $repo_name = basename(variable_get('ghpages_repo', ''), '.git');
  $repo_path = $ghpages_path . '/' . $repo_name;
@@ -73,7 +68,7 @@ function ghpages_data_process($everything, $links, $anon, $dir) {
    );
    if (!$html_piece->data) {
      drupal_set_message(
        t('There was a problem getting the Drupal page html'),
        t('There was a problem getting the Drupal page HTML'),
        'error'
      );
    }
@@ -91,7 +86,7 @@ function ghpages_data_process($everything, $links, $anon, $dir) {

    if (!$html_piece->data) {
      drupal_set_message(
        t('There was a problem getting the Drupal page html'), 'error'
        t('There was a problem getting the Drupal page HTML'), 'error'
      );
    }
    $html_original = $html_piece->data;
@@ -268,16 +263,18 @@ function ghpages_push_files($form_state) {

  $repo->add($repo_path);
  $repo->commit('Adding ' . $ghpages_path);
  if ($repo->push('https://' . variable_get('ghpages_username') . ':' .

  try {
    $repo->push('https://' . variable_get('ghpages_username') . ':' .
      variable_get('ghpages_pass') . '@github.com/' .
    variable_get('ghpages_username') . '/' . $repo_name, 'gh-pages')) {
    drupal_set_message(
      t('Successfully pushed to @repo', variable_get('ghpages_repo'))
    );
      variable_get('ghpages_username') . '/' . $repo_name, 'gh-pages');
  }
  else {
  catch (Exception $e) {
    drupal_set_message(
      t('Failed to push to @repo', variable_get('ghpages_repo'))
      t('Failed while pushing repo with error message: @error', 
        array('@error' => $e->getMessage())
      ),
      'error'
    );
  }
}
+0 −1
Original line number Diff line number Diff line
@@ -4,6 +4,5 @@ dependencies[] = path
dependencies[] = backup_migrate
dependencies[] = libraries
dependencies[] = querypath
dependencies[] = composer_autoload

core = 7.x
+0 −6
Original line number Diff line number Diff line
@@ -70,12 +70,6 @@ function ghpages_form_alter(&$form, $form_state, $form_id) {

  if (user_access('save to github')) {
    if (isset($form['#node']) && $form_id == $form['#node']->type . '_node_form') {
      drupal_add_js('jQuery().ready(function() {jQuery(\'#dialog\').jqm();});',
        array('type' => 'inline', 'scope' => JS_DEFAULT)
      );
      drupal_add_js(drupal_get_path('module', 'ghpages') . '/jqModal.js');
      drupal_add_css(drupal_get_path('module', 'ghpages') . '/jqModal.css');
      drupal_add_css(drupal_get_path('module', 'ghpages') . '/ghpages.css');
      $node = menu_get_object();
      $buttons = drupal_get_form('ghpages_publish_form');
      if (is_numeric($node->nid)) {