forked from civicrm/civicrm-dev-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging hooks-op-4 branch into master
This completes the migration of all hooks pages to close #71
and also sets the theme to Material
Conflicts:
redirects/wiki-crmdoc.txt
- Loading branch information
Showing
114 changed files
with
5,907 additions
and
588 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/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)"; | ||
} | ||
else { | ||
echo "DOWNLOADING: $hook_name" . PHP_EOL; | ||
system("curl '$wiki_url/$hook_name' > '$hook_name'"); | ||
} | ||
echo PHP_EOL; | ||
} | ||
} | ||
|
||
echo "DONE" . PHP_EOL; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<?php | ||
|
||
$hooks_by_category = [ | ||
"Database" => [ | ||
['name' => "hook_civicrm_copy", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_custom", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_managed", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_merge", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_post", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_pre", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_trigger_info", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_referenceCounts", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_postSave_table_name", 'is_deprecated' => false], | ||
], | ||
"Extension lifecycle" => [ | ||
['name' => "hook_civicrm_disable", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_enable", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_install", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_uninstall", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_upgrade", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_postInstall", 'is_deprecated' => false], | ||
], | ||
"Form" => [ | ||
['name' => "hook_civicrm_alterContent", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_buildForm", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_postProcess", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_validateForm", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterTemplateFile", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_preProcess", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_idsException", 'is_deprecated' => false], | ||
], | ||
"GUI" => [ | ||
['name' => "hook_civicrm_buildAmount", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_caseSummary", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_customFieldOptions", 'is_deprecated' => true], | ||
['name' => "hook_civicrm_dashboard", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_links", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_navigationMenu", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_pageRun", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_searchColumns", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_searchTasks", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_summary", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_summaryActions", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_tabs", 'is_deprecated' => true], | ||
['name' => "hook_civicrm_xmlMenu", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_tabset", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_dashboard_defaults", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_contact_get_displayname", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_fieldOptions", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterMenu", 'is_deprecated' => false], | ||
], | ||
"Mail" => [ | ||
['name' => "hook_civicrm_alterMailParams", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_emailProcessor", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_emailProcessorContact", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_mailingGroups", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_postEmailSend", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterMailer", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_unsubscribeGroups", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterMailContent", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_postMailing", 'is_deprecated' => false], | ||
], | ||
"Permission" => [ | ||
['name' => "hook_civicrm_aclGroup", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_aclWhereClause", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterAPIPermissions", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_permission_check", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_permission", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_selectWhereClause", 'is_deprecated' => false], | ||
], | ||
"Uncategorized" => [ | ||
['name' => "hook_civicrm_alterCalculatedMembershipStatus", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterBarcode", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterBadge", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterPaymentProcessorParams", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterSettingsFolders", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterSettingsMetaData", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_apiWrappers", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_buildStateProvinceForCountry", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_config", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_contactListQuery", 'is_deprecated' => true], | ||
['name' => "hook_civicrm_cron", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_dupeQuery", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_export", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_import", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_membershipTypeValues", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_tokens", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_tokenValues", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_queryObjects", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_check", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_optionValues", 'is_deprecated' => true], | ||
['name' => "hook_civicrm_coreResourceList", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_angularModules", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_container", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_crudLink", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_fileSearches", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_notePrivacy", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_eventDiscount", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_recent", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_unhandledException", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterMailingLabelParams", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_geocoderFormat", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_alterLogTables", 'is_deprecated' => false], | ||
], | ||
"Case" => [ | ||
['name' => "hook_civicrm_caseChange", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_caseTypes", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_post_case_merge", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_pre_case_merge", 'is_deprecated' => false], | ||
], | ||
"Batch" => [ | ||
['name' => "hook_civicrm_batchItems", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_batchQuery", 'is_deprecated' => false], | ||
], | ||
"Entity" => [ | ||
['name' => "hook_civicrm_entityTypes", 'is_deprecated' => false], | ||
], | ||
"CiviRules" => [ | ||
['name' => "hook_civirules_alter_trigger_data", 'is_deprecated' => false], | ||
['name' => "hook_civirules_logger", 'is_deprecated' => false], | ||
], | ||
"Profile" => [ | ||
['name' => "hook_civicrm_buildProfile", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_buildUFGroupsForModule", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_processProfile", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_searchProfile", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_validateProfile", 'is_deprecated' => false], | ||
['name' => "hook_civicrm_viewProfile", 'is_deprecated' => false], | ||
], | ||
"Report" => [ | ||
['name' => "hook_civicrm_alterReportVar", 'is_deprecated' => false], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
include __DIR__ . '/hooks-by-category.php'; | ||
|
||
$cache_dir = __DIR__ . '/wiki_cache'; | ||
$root_dir = dirname(dirname(__DIR__)); | ||
$hooks_dir = "$root_dir/docs/hooks"; | ||
|
||
|
||
function clean_markdown($markdown) { | ||
// add domain name to all hyperlinks that point to the wiki | ||
$pattern = '@\]\((/confluence[^)]*)\)@'; | ||
$replace = '](https://wiki.civicrm.org$1)'; | ||
$markdown = preg_replace($pattern,$replace,$markdown); | ||
|
||
// set all headings of level 3 and above to level 2 | ||
$pattern = '@^(##)(#+) (.*)$@m'; | ||
$replace = '## $3'; | ||
$markdown = preg_replace($pattern,$replace,$markdown); | ||
|
||
return $markdown; | ||
} | ||
|
||
|
||
|
||
# create hooks directory if needed | ||
if ( !is_dir($hooks_dir) ) { | ||
mkdir($hooks_dir); | ||
} | ||
chdir($hooks_dir); | ||
foreach ($hooks_by_category as $category => $hooks) { | ||
foreach ($hooks as $hook) { | ||
$hook_name = $hook['name']; | ||
$markdown_file = "$hook_name.md"; | ||
$html = "$cache_dir/$hook_name"; | ||
if ( file_exists($html) && !file_exists($markdown_file) ) { | ||
echo "converting $hook_name ... "; | ||
$conv_output_array = array(); | ||
$conv_status = 1; | ||
exec("webpage2md $html", $conv_output_array, $conv_status); | ||
if( $conv_status == 0 ) { | ||
$conv_output = implode("\n",$conv_output_array); | ||
$conv_output = clean_markdown($conv_output); | ||
file_put_contents($markdown_file, $conv_output); | ||
echo "done" . PHP_EOL; | ||
} | ||
else { | ||
echo "ERROR CONVERTING $hook_name" . PHP_EOL; | ||
echo "$conv_output"; | ||
} | ||
} | ||
else if ( !file_exists($html) ) { | ||
echo "WARNING: $hook_name not yet fetched" . PHP_EOL; | ||
} | ||
else if ( file_exists($markdown_file) ) { | ||
echo "ignoring $hook_name (markdown file already exists)" . PHP_EOL; | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
include __DIR__ . '/hooks-by-category.php'; | ||
|
||
echo "- Hooks:" . PHP_EOL; | ||
foreach ($hooks_by_category as $category => $hooks) { | ||
echo " - $category hooks:" . PHP_EOL; | ||
foreach ($hooks as $hook) { | ||
$hook_name = $hook['name']; | ||
if ( $hook['is_deprecated'] ) { | ||
$menu_name = "<del>$hook_name</del>"; | ||
} | ||
else { | ||
$menu_name = $hook_name; | ||
} | ||
echo " - $menu_name: hooks/$hook_name.md" . PHP_EOL; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
include __DIR__ . '/hooks-by-category.php'; | ||
|
||
foreach ($hooks_by_category as $category => $hooks) { | ||
foreach ($hooks as $hook) { | ||
$hook_name = $hook['name']; | ||
echo "$hook_name hooks/$hook_name" . PHP_EOL; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
Oops, something went wrong.