1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-02-10 16:01:33 +00:00

experimental: auto-generate and add all plugin hook methods to Plugin class

This commit is contained in:
Andrew Dolgov
2021-11-13 18:18:05 +03:00
parent 8a83f061bf
commit b381e95792
3 changed files with 286 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
TMPFILE=$(mktemp)
grep 'hook_.*(' ../classes/pluginhost.php | sed -e 's#[\t ]*/[* ]*##' \
-e 's# [*]/$##' \
-e 's# *(byref) *##' \
-e 's#GLOBAL: ##' | while read F; do
cat << EOF >> $TMPFILE
function $F {
user_error("Dummy method invoked.", E_USER_ERROR);
}
EOF
done
cat ../classes/plugin.tpl | while IFS=\n read L; do
case $L in
*AUTO_GENERATED_HOOKS_GO_HERE* )
echo "\t/* plugin hook methods (auto-generated) */\n"
cat $TMPFILE
;;
* )
echo "$L"
;;
esac
done > ../classes/plugin.php
rm -f -- $TMPFILE