Skip to content
Snippets Groups Projects
fetch-wiki-caches 592 B
#!/usr/bin/env php
<?php

include __DIR__ . '/hooks-by-category.php';

$wiki_url = 'https://wiki.civicrm.org/confluence/display/CRMDOC';
$cache_dir = __DIR__ . '/wiki_cache';

chdir($cache_dir);

foreach ($hooks_by_category as $category => $hooks) {
  foreach ($hooks as $hook) {
    $hook_name = $hook['name'];
    if ( file_exists($hook_name) ) {
      echo "SKIPPING: $hook_name (already cached)" . PHP_EOL;
    }
    else {
      echo "DOWNLOADING: $hook_name" . PHP_EOL;
      system("curl '$wiki_url/$hook_name' > '$hook_name'");
    }
    echo PHP_EOL;
  }
}

echo "DONE" . PHP_EOL;