You are here

function patch_manager_page_scan in Patch manager 7

Same name and namespace in other branches
  1. 6 patch_manager.module \patch_manager_page_scan()

Discover patches

This is more for debugging than anything useful.

1 string reference to 'patch_manager_page_scan'
patch_manager_menu in ./patch_manager.module
Implements hook_menu().

File

./patch_manager.module, line 265
Patch manager provides developers with tools for managing patches.

Code

function patch_manager_page_scan() {

  // Scan for patches
  $headers = array(
    t('Patch'),
    t('Path'),
  );
  $dir = dirname($_SERVER['SCRIPT_FILENAME']);
  $mask = '/.patch$|.diff$/';
  $patches = file_scan_directory($dir, $mask);
  $rows = array();
  foreach ($patches as $patch) {
    $filename = str_replace("{$dir}/", '', $patch->filename);
    $rows[] = array(
      $patch->filename,
      l($filename, $filename),
    );
  }
  $output = theme('table', array(
    'header' => $headers,
    'rows' => $rows,
  ));

  // Registered patches
  $headers = array(
    t('Title'),
    t('Patch'),
    t('Module'),
    t('Issue'),
    t('Description'),
    t('Patchdir'),
  );
  $rows = patch_manager_list_patches();
  $output .= theme('table', array(
    'header' => $headers,
    'rows' => $rows,
  ));
  return $output;
}