New 'meta' table - might be useful for plugin developers #2937
Tequenikality
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Yeah, having a meta table has always been in mind (blog post from..... 2012 :-/) but never really actually worked on yet... |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone;
So, I'm fairly new to PHP - I've not really had much experience with it before and I've had less of a crash-course than a 'learn to fly because you're falling' kinda situation. Nonetheless, my skills were enough to create a front page for my YOURLS installation and have it communicate with the WooCommerce API to check the details of an order before it creates a URL so I'm not completely useless.
Point being, I'm not entirely sure if this is possible, or practical, but would it be possible to add a 'meta info' section to the database, associated with individual links? For example, the structure might look like this:
{
"created": "01/01/2021",
"target": "https://example.com/",
"meta": [
"key": "value"
]
}
And then have functions to set & retrieve this info:
function set_link_meta( $link_id, $key, $value )
return ( true | false)
function get_link_meta( $link_id, $key )
return ( $value )
I know that YOURLS embraces it's plugin architecture, and I think this could help there. It reduces overhead of plugin authors potentially making their own tables and stray keys in the YOURLS database, streamlines the experience for the end-user, lowers the barrier for entry for people getting started making plugins and more.
But a system like this would go beyond just plugin developers - remember my rambling about a purchase verification system I wrote at the beginning of this post? I wasn't bragging. For cases like that, where users need to integrate YOURLS into systems they already have, write a public-facing interface page, etc - we could use the meta section for that. For example, you could sell timed memberships and add expiry dates to the meta info, you could use the meta info to flag a link that shouldn't be deleted, or pretty much anything else.
Like I said, I'm as green as a grasshopper, but I don't really see the downside of this system, except potentially that it changes the database which might be a pain. So, how viable would this be? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions