I’ve been doing a lot of development work recently for clients based on Known which involve, among other things, needing to do fairly involved things with data and ACLs.
Because of this, I was finding myself spending a lot of time trying to see what was actually written to entities by looking at the raw database. This was rather time consuming, and because of Known’s (very flexible but abstract) data model, was rather tricky.
So, I took advantage of Known’s console interface (which I fixed and extended in a recent pull request), to start putting together a collection of useful tools. To use, simply symlink to the appropriate directory from within you ConsolePlugins
directory.
Be aware that you will need the current latest version of Known core from Github.
The Known framework has the ability to execute commands from the console, which is kind of cool and enables, among other things, stuff like these console development tools.
You can see what commands are currently available by going to the console, navigate to your Known directory, and execute
./known.php
.The commands available can be added to in two ways…
Create a pure console plugin
If you look in
ConsolePlugins
you’ll see a plugin calledExample
, which probably tells you all you need to know.. but in summary:Create a subdirectory for your plugin in
ConsolePlugins
(or at least copy/symlink it there later)Create a
Main.php
file, containing a class calledMain
which extends the classIdnoCommonConsolePlugin
Implement the abstract methods:
getCommand()
the command name you are providinggetDescription()
the description of the commandgetParameters()
a method returning an array of the command’s parametersexecute()
your actual codeAnd you’re done!
Add a console plugin to a regular Known plugin
If you’re using the most recent build of Known from github, you can also add a console command to an existing traditional Known plugin (i.e. those sitting in
IdnoPlugins/*
). To do this, create a class calledConsoleMain
that extendsIdnoCommonConsolePlugin
and save it in a file calledConsoleMain.php
sitting along side your regularMain.php
.Thanks for visiting! If you’re new here you might like to read a bit about me.
(Psst… I am also available to hire! Find out more…)
Follow @mapkyca
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?’http’:’https’;if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+’://platform.twitter.com/widgets.js’;fjs.parentNode.insertBefore(js,fjs);}}(document, ‘script’, ‘twitter-wjs’);
Share this:EmailLinkedInTwitterGoogleFacebookReddit