turnermm / Updatable-Snippets-for-Dokuwiki

Inserts updatable snippets into Dokuwiki pages
https://dokuwiki.org/plugin:snippets
GNU General Public License v2.0
6 stars 4 forks source link

Snippets plugin inserts its own syntax, but snippet content is empty #35

Closed pacobyte closed 6 years ago

pacobyte commented 6 years ago

When trying to insert any snippet in a page, new or editing an existing one, this is an example of what I always get:

~~SNIPPET_O1517105906~~wiki:snippets:snippet_tester_v2~~

~~SNIPPET_C~~wiki:snippets:snippet_tester_v2~~

The snippet window pops up correctly, the preview shows the snippet correctly, but only the plugin's syntax gets inserted. Here's what I've tried:

The only thing I could find in my various troubleshooting efforts is that even after a "snippet" such as the one shown above is removed from a page, and then the page is deleted, it is never removed from the Update Snippets metadata section after a clean-up.

I'm using: Frusterick Manners PHP 7 Windows 10

turnermm commented 6 years ago

I've made a fresh install of snippets, Win 10, Frusterick, but cannot reproduce your result, even using your page name. My tests are in both FFox and Edge. Try clearing out your wiki cache by deleting all data in data/cache, then refresh your browser cache, create a new snippet, one line of text, and insert it into a new page.

pacobyte commented 6 years ago

Still no go. While I always use Chrome, I tried it in Edge, as well, with the same results of an empty snippet insertion.

After clearing data/cache, and doing an Empty Cache and Hard Reload on the browser, the Snippets metadata clean-up page still shows information from pages that were deleted before all the uninstall/reinstalls and cache clears. Is it possible that this is related, or am I fixed on something entirely unrelated?

turnermm commented 6 years ago

Not related.

turnermm commented 6 years ago

Just tried Chrome. Again, no problem. Do you find any errors in your error log?

pacobyte commented 6 years ago

I've not noticed any errors in the past, but somehow, this morning's Apache error log shows multiple entries that are very similar to this set of errors:

[Sun Jan 28 10:48:54.868869 2018] [php7:warn] [pid 7096:tid 1892] [client 192.168.1.101:6379] PHP Warning:  file_get_contents(C:/UniServerZ/www/dokuwiki/data/pages/playground/playground_5.txt): failed to open stream: No such file or directory in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\admin.php on line 107, referer: http://192.168.1.100/dokuwiki/start?do=admin&page=snippets
[Sun Jan 28 10:48:54.868869 2018] [php7:warn] [pid 7096:tid 1892] [client 192.168.1.101:6379] PHP Warning:  Invalid argument supplied for foreach() in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\admin.php on line 124, referer: http://192.168.1.100/dokuwiki/start?do=admin&page=snippets
[Sun Jan 28 10:48:54.868869 2018] [php7:warn] [pid 7096:tid 1892] [client 192.168.1.101:6379] PHP Warning:  array_keys() expects parameter 1 to be array, null given in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\admin.php on line 127, referer: http://192.168.1.100/dokuwiki/start?do=admin&page=snippets
[Sun Jan 28 10:48:54.868869 2018] [php7:warn] [pid 7096:tid 1892] [client 192.168.1.101:6379] PHP Warning:  array_diff(): Argument #1 is not an array in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\admin.php on line 129, referer: http://192.168.1.100/dokuwiki/start?do=admin&page=snippets
[Sun Jan 28 10:48:54.868869 2018] [php7:warn] [pid 7096:tid 1892] [client 192.168.1.101:6379] PHP Warning:  array_diff(): Argument #2 is not an array in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\admin.php on line 130, referer: http://192.168.1.100/dokuwiki/start?do=admin&page=snippets
pacobyte commented 6 years ago

Here's one more set that looks interesting:

[Sun Jan 28 10:43:30.393379 2018] [php7:warn] [pid 7096:tid 1884] [client 192.168.1.101:5781] PHP Warning:  file_get_contents(C:/UniServerZ/www/dokuwiki/data/pages/playground/playground_5.txt): failed to open stream: No such file or directory in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\admin.php on line 107, referer: http://192.168.1.100/dokuwiki/
[Sun Jan 28 10:43:30.393379 2018] [php7:warn] [pid 7096:tid 1884] [client 192.168.1.101:5781] PHP Warning:  Invalid argument supplied for foreach() in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\admin.php on line 124, referer: http://192.168.1.100/dokuwiki/
[Sun Jan 28 10:43:30.393379 2018] [php7:warn] [pid 7096:tid 1884] [client 192.168.1.101:5781] PHP Warning:  array_keys() expects parameter 1 to be array, null given in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\admin.php on line 127, referer: http://192.168.1.100/dokuwiki/
[Sun Jan 28 10:43:30.393379 2018] [php7:warn] [pid 7096:tid 1884] [client 192.168.1.101:5781] PHP Warning:  array_diff(): Argument #1 is not an array in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\admin.php on line 129, referer: http://192.168.1.100/dokuwiki/
[Sun Jan 28 10:43:30.393379 2018] [php7:warn] [pid 7096:tid 1884] [client 192.168.1.101:5781] PHP Warning:  array_diff(): Argument #2 is not an array in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\admin.php on line 130, referer: http://192.168.1.100/dokuwiki/
[Sun Jan 28 10:47:09.571963 2018] [php7:warn] [pid 7096:tid 1888] [client 192.168.1.101:6155] PHP Warning:  filemtime(): stat failed for C:/UniServerZ/www/dokuwiki/data/pages/playground/playground_6.txt in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\helper.php on line 135, referer: http://192.168.1.100/dokuwiki/playground/playground_6?do=edit
[Sun Jan 28 10:47:26.056401 2018] [access_compat:error] [pid 7096:tid 1876] [client 192.168.1.101:6193] AH01797: client denied by server configuration: C:/UniServerZ/www/dokuwiki/data/security.png, referer: http://192.168.1.100/dokuwiki/start?do=admin
[Sun Jan 28 10:48:07.618845 2018] [php7:warn] [pid 7096:tid 1888] [client 192.168.1.101:6278] PHP Warning:  filemtime(): stat failed for C:/UniServerZ/www/dokuwiki/data/pages/playground/playground_7.txt in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\helper.php on line 135, referer: http://192.168.1.100/dokuwiki/playground/playground_7?do=edit
turnermm commented 6 years ago

The admin panel, as I noticed this morning, is unfortunately an imperfect tool. These errors all arise from the same source, that the admin tool tried to read a file on your system which has been deleted. I've begun working on a fix for this. But it has no bearing on the problem you are having.

One of these errors is a standard Dokuwiki error, triggered by Dokuwiki if it finds that your admin panel is not secured.

pacobyte commented 6 years ago

Hmm... I'll do another round of cache clearing and such and watch the error log during the process to see if there are any new errors, then. I'll post back here once done.

pacobyte commented 6 years ago

Alright, I think (read: hope) I have something pertinent. This singular error showed up:

[Sun Jan 28 17:25:24.930132 2018] [php7:warn] [pid 7096:tid 1916] [client 192.168.1.101:36474] PHP Warning:  filemtime(): stat failed for C:/UniServerZ/www/dokuwiki/data/pages/playground/playground_8.txt in C:\\UniServerZ\\www\\dokuwiki\\lib\\plugins\\snippets\\helper.php on line 135, referer: http://192.168.1.100/dokuwiki/playground/playground_8?do=edit

playground_8 is the brand new page I created for this test. Does this error look related to the main issue?

turnermm commented 6 years ago

That would suggest that the page on which you are writing can't be found. But you say that the snippets syntax statements are in place, so that has been saved. But this does possibly point to some underlying system glitch. Have you tried this in different browsers (can't recall if you've said)?

pacobyte commented 6 years ago

Yes, in Edge, but I haven't check what errors if any were encountered. Either way, trying with Edge gave me the same result: the snippet syntax with no snippet content.

pacobyte commented 6 years ago

Ok, well, I apologize for taking your time on this... 😳

I've been using your plugin wrong this whole time. When reading the usage documentation, I struggled to find out what syntax I need to use in the snippet's source page to "register" it as a snippet. That's when I finally found it, or so I thought:

<snippet>
Yeah, this is NOT a snippet.
</snippet>

Since the first 15 DW plugins I've used all required using their own syntax, I got stuck in that rut of expecting the same of Snippets. 😔

turnermm commented 6 years ago

Good to hear thah it's solved.