Home / Blog

BlogNifty

If you want to chat about niftyserver vhost control panel, nifty CMS, or Cognifty framework hop into #niftyserver on irc.freenode.net

I've started working on a Wordpress compatibility layer to allow for any wordpress theme or template to be applied to Nifty CMS.

You can checkout the code here: http://github.com/markkimsal/wp_compat

Screenshot is here: http://wiki.github.com/markkimsal/wp_compat

A few weeks ago I posted about how I thought phing should be used as more of a run-time work-horse than a compile time only tool.

Release 19 of Cognifty uses Phing as the basis for its module installer. Module authors write a standard "install.xml", and the current versions determine which target gets called.

For new installations, target "install" is called.

<target name="install">
    <phingcall target="Copyfiles"/>
    <phingcall target="CopyIcons"/>
</target>

For upgrades, two types of targets are searched for. One is the specific version upgrade

<target name="upgrade_2_to_3">
    <phingcall target="Copyfiles"/>
</target>

Or, for more generic upgrades, targets which upgrade any version to the latest can be specified like so:

<target name="upgrade_any_to_6">
    <phingcall target="createtables"/>
</target>

The install.xml files can consist of any number of targets and phing calls, but only 1 target is run at a time. This allows the person performing the install to see step-by-step what the output is for each Phing target. Splitting your installation up into logical steps should also help the end-user recover from unexpected situations. If somethign goes wrong the end-user should only have to perform one step by hand.

There is also an option to skip steps which fail. Perhaps the site owner corrected a permission issue and wants to try a module installation again. If any step before the step which originally fails does not succeed, it can be skipped. This situation might arise when you are creating SQL tables, and creating them a second time throws an error. This type of situation is recoverable by the end-user and does not stop the entire installation from continuing.

For the next Cognifty release I'm working on a Phing based installer.

I've already used Phing as a library for another project, the Nifty Server Manager. This time, the Phing XML format will give module creators flexibility and standardization when writing installation scripts.

Using a standard library such as Phing should remove any clunkiness in the a user might experience when installing a module. Forcing a user to unzip, upload, copy, and replace config values are undesirable steps of most application "frameworks" which don't offer any benefit to module writers and don't ever plan for running more than one application at a time.

Phing is good at doing all those rote tasks like copying, unzipping, and replacing values in a configuration script, so why hasn't anybody done this before?

I haven't seem many PHP libraries to let PHP act as a server. I know that Drupal let's you do some direct file manipulation with webDAV, and I've seen a few classes to let PHP act as a _client_ to webDAV. But you just don't see as many server libraries and you'd expect. You'd figure that some of the new fancy schmancy framework would have a controller or object pattern to interpret DAV requests the same was as regular HTTP requests.

So, I have created a "remotewebdav" module to test out the new Cgn_Webdav_Service class. The remote webdav module shows you a virtual filesystem to allow an admin to change some configuration options, change the template HTML or even install local modules.

Checkout the module's page: Remote WebDAV Module