April 15, 2009

sticky What is ZenMagick?

Tags: , , , ,
Filed under: ZenMagick — DerManoMann @ 5:50 am

About two years ago I wrote a post Is ZenMagick for you? This post is an updated version which is supposed to put things into perspectice, in particular the current status and future plans. (more…)

November 5, 2013

Compiling pdo_dblib on CentOS 6 with PHP 5.4

Tags:
Filed under: PHP — DerManoMann @ 5:29 am

Today I had a quick (second) stab at trying to install pdo_dblib on CentOS6 with Php 5.4.

Looking back it was pretty straight forward, but then most things are….

It started with this:

pecl install pdo_dblib

6 source files, building
running: phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module

ERROR: `phpize' failed

What I did was:

yum install freetds-devel
pecl download pdo_dblib
tar xvfz PDO_DBLIB-1.0.tgz
cd PDO_DBLIB-1.0
phpize
./configuire

So far so good, but now configure would complain about missing freetds.

Eventually I found this post dealing with the same issue: Cannot find FreeTDS in known installation directories. So, lets do that:

touch /usr/include/tds.h
touch /usr/lib/libtds.so
./configure
make

Hmm, better, but now there is some compile error..
Turns out pdo_dblib.c uses a typedef that has changed name, so change function_entry to zend_function_entry.

Voila! It compiles.

August 5, 2013

Running PHPUnit tests in a browser

Filed under: PHP — DerManoMann @ 10:18 am

Sometimes it is useful (and required) to run PHPUnit tests in a browser. A great (although stupid example, IMHO) is XCache.

It doesn’t work on the command line, so the only way to test anything is in a browser, via a webserver.

A simple way of executing is this simple PHP script:


<?php
require_once 'PHPUnit/Autoload.php';

$argv = array(
'--configuration', 'phpunit.xml.dist',
'./tests',
);
$_SERVER['argv'] = $argv;

PHPUnit_TextUI_Command::main(false);

November 25, 2012

WordPress integration from non global namespace

Tags:
Filed under: PHP — DerManoMann @ 10:30 am

Looks like finally with WordPress 3.4 it will be possible to use the API by loading the WP code from within a class/function.

It is amazing that is has taken so long to get this done, but as I remember there used to be a lot more globals that depended on file being included from global scope.

Good news, though, as it will finally allow to write a ZenMagick WordPress plugin without using any hackery :)

October 11, 2012

over-overdue ZenMagick update

Filed under: ZenMagick — DerManoMann @ 9:32 am

It’s been a long long time sine I last wrote about what is happening with ZenMagick.
For the most part the reason for this is that I haven’t been working on ZenMagick for the last – uhm 3 month or so.

Having said that, this doesn’t mean the project is stalled or abandoned. Quite the opposite – there have been more (and more drastic) changes to ZenMagick that ever. Johnnny has been VERY busy converting ZenMagick to a mostly full blown symfony 2 application.

I hope to be back into coding soon and there is definitely a release planned (don’t ask me what version number that will be, but it might be a 1.0 [at least it would deserve it]).

Changes are too numerous to list here. Let me just mention that we do use HttpKernel, a lot of the ZenMagick code has been moved into bundles and the doctrine ORM is mostly ready for action.
I’d prefer to be more specific, however I too have some catching up to do! For all interested the best way to keep track of what is happening is to follow the ZenMagick git commit logs (if you look carefully at the url, you’ll notice that the source now is owned by the ZenMagick organization on github…)

zenmagick.org status

Filed under: ZenMagick — DerManoMann @ 9:22 am

And it happened again. Due to some issues with renewing the domain (the ISP changed owner in between), zenmagick.org is currently down.
And thanks to the apparently stupid go daddy it always is a mission to get it back. Looks like there have been problems renewing the domain for the ISP itself – sigh.
I’ll update this post once things have improved…

Apologies, mano

UPDATE: Apparently the domain will be back tomorrow – hold your breath. Is it really true that Go Daddy do domain renewal processing only once a week??

May 17, 2012

pricing II

Filed under: ZenMagick — DerManoMann @ 10:01 am

I am very close to having the new pricing code pass all shopping cart tests. In fact, one benefit of this change is that for the first time it is possible to run a complete cart test over all products in one go.

The stats for that look something like this:
Client IP: 127.0.0.1;   PHP: 5.3.10;   ZenMagick: ${zenmagick.version};   environment: prod;   total page execution: 31.5726 secconds;
databases: zmdev(ZMDatabase): SQL queries: 23325, duration: 19.6571 seconds;
includes: 526;   memory: 63176704

Right now I do have one test randomly failing. The attributes are randomly populated (select, radio and text), so it takes a bit to log what is actually breaking things.
Still, this is a major improvement and means that ZenMagick contains all relevant pricing code – and all of that only once!
Since the checkout order instance is already populated from the shopping cart, all data is derived from a single set of business logic – yay!

Another bonus is that the shopping cart now is populated just from a simple array containing product id, quantity and attribute details of the products in the cart. In fact, this is the same data zen-cart uses.
This also means that we now can start tracking cart actions separate from zen-cart (and verify that they match). The ultimate consequence of that is native cart actions that just use ZenMagick code rather than the zen-cart cart instance internally.

Still some way to go, but a big step, nevertheless.

May 15, 2012

pricing

Filed under: ZenMagick — DerManoMann @ 5:17 am

This week I have taken another stab at improving the ZenMagick pricing code. The main reason right now is to further reduce the number of SQL queries per request. As part of the process to encapsulate zen-cart logic as much as possible there is a class ZenCartCheckoutOrder that is compatible with zen-cart. However, it is populated entirely from the ZenMagick shopping cart class.

Unfortunately, the shopping cart class itself still relies on zen-cart, so the more logic is in ZenMagick, the better, because with the internal caching in the ZenMagick service classes, all relevant data will only be loaded once and once only!

Of course, pricing is not the most trivial part of zen-cart, so getting that right is a mission and tracking down pieces of code one by one to see what is actually going on.

The good news is, that so far all common cases like discounts, attribute pricing, quantity discounts, sales and one time costs are already working. The remaining differences are all around word count issues, etc. Hopefully one more improvement to come with the next version.

To make things work reliably, there is an option to assert that calculated values are in sync with zen-cart, which makes life a lot easier…

May 3, 2012

not so weekly update

Tags: , , ,
Filed under: PHP,ZenMagick — DerManoMann @ 10:59 am

After having published a first snapshot of the upcoming ZenMagick 0.9.14 it seems time to write about what is new and shiny in the next release.

Perhaps the biggest change is that zen-cart is now loaded on demand and ZenMagick is the main request handler.

What does that mean?

It means that for example, ZenMagick is responsible for session handling. It also means that no zen-cart code is loaded unless ZenMagick allows it.

Right now that *is* still happening, as there are still some missing bits in the ZenMagick request handling. However, we are nearing the point where this is no longer the case. At that point, zen-cart will only be loaded on demand, and only the bits relevant for checking out and ordering.

As a side effect of these refactorings, we have added a number of modified zen-cart core files into a bundle (the symfony plugin system), so file patches can be obsoleted. On the other hand it means that relying on zen-cart core file patches will not be that easily possible any more.

A second major milestone is the integration of yet more symfon2 components, as can be seen in the list below.

Other, biggish changes include:

  • Full localisation support using gettext – po/mo files throughout all of ZenMagick; admin, storefront, themes and plugins
  • Support for symfony2 routing; this task is not yet complete, but I expect to have almost full coverage of storefront urls via routing
  • Simplified MVC components; again this is mostly compatible with symfony2, with the exception that controller classes always need to be declared using the full namespace (rather than a bundle name)
  • The ZenMagick template system is now implemented as a symfony2 template engine. This was a precursor for allowing Twig as alternative template engine.
  • Support for ZenMagick WISYWIG editor plugins in zen-cart admin pages
  • Skelton for a separate ZenMagick installer application
  • Separate main configuration file, independent of zen-cart’s configure.php

For a more complete list of all changes please check the roadmap for 0.9.14.

March 29, 2012

the crumbtrail saga

Filed under: ZenMagick — DerManoMann @ 4:36 am

I’ve finally written some reasonably easy addition to the ZenMagick PHP templating engine that allows to set the crumbtrail (and other bits, if required) in the actual view.

This is something I’ve been struggling for a long time. The crumbtrail code has been a source of bending backwards and ugly code for a very long time.

Now, the view can just do something like: $crumbtrail->addCrumb('Foo') and be done! As you might have spotted, the code in itself hasn’t changed at all. The only change in the templates so far has been to the layout file to use the new fragment() method to ‘mark’ the place where to put the crumbtrail and then *after* the view has been included the marker is filled with whatever crumbtrail has been set up.

One nice thing is that right now the views do not anything, because the crumbtrail is set up by the controller classes. So, it will be possible to migrate each view individually by moving the crumbtrail code from the controller class to the view template – yay!

Probably nothing to get too excited about, but it has been a long time coming…

March 11, 2012

breaking changes

Tags: ,
Filed under: ZenMagick — DerManoMann @ 10:09 am

There are some big changes coming in ZenMagick. One of the big concerns was (and still is) the integration (or lack thereof) with zencart.

To pave the way for some real improvements for this there has been a huge amount of work to make things simpler, cleaner and faster.

Right now ZenMagick is integrated via a number of file patches and additional files (overrides) in storefront and admin. Last week we removed

  • *all* of the remaining admin integration files
  • the first batch of required file patches (replaced by one new file patch, though)
  • the current storefront override file (init_templates.php)

And, there is more to come.

This means for the next release/upgrade there will be some cleanup required to get rid of obsolete files. On the plus side – wait, that is already the plus side!

In the grand scheme of things this will mean faster request handling (more/no zencart code used for most of the time), less conflicts with zencart code and generally we expect a much more predictable behaviour.

Of course, with so many changes there are things to consider. For one thing, ZenMagick will, for the first time ship with custom versions of core zencart files. This means if those files are patched in your system right now, those changes will need to be applied in our version. OTOH, those files are mostly not the commonly modified files.

I will write up some more details once the dust has settled a bit…

Next Page »