PITS-Talk

Summary: Talk page for PITS.
Maintainer: Petko
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Update for PHP 7.2 and up

This recipe uses create_function, which is deprecated as of PHP 7.2 (and gives a deprecation error if used). Following is a rewrite of the CreateOrderFunction function to use an anonymous function (a.k.a. closure a.k.a. lambda) instead of create_function. I have tested this and it appears to work. No other modification to the recipe seems to be needed.

This should work on PHP 5.4 and up (possibly even on older versions).

function CreateOrderFunction($order) { 
	$orders = [ ];
	foreach(preg_split('/[\\s,|]+/',strtolower($order),-1,PREG_SPLIT_NO_EMPTY) as $o) {
		if (substr($o,0,1)=='-') { $r='-'; $o=substr($o,1); }
		else $r='';
		if (preg_match('/\\W/',$o)) continue;
		array_push($orders, [ $o, $r ]);
	}

	return function($x, $y) use ($orders) {
		foreach ($orders as $order) {
			$o = $order[0];
			$r = $order[1];
			$c = strcasecmp($x[$o],$y[$o]);
			if ($c != 0) return ($r =='-' ? -1 * $c : $c);
		}
		return 0;
	};
}

Said Achmiz May 12, 2020, at 09:07 AM

Community Fork

Note to David Sovinski: This fork of the PITS script is not what is running on PmWiki.org and is not supported by Pm or myself. If it is OK with you, I suggest keeping the original PITS recipe here and moving the fork to another Cookbook page - for example "CommunityPITS" or just "ITS" (for issue tracking system), which will be prominently cross-linked from and to this page here. --Petko May 15, 2013, at 10:11 AM

Petko, given the list of caveats attached to the version running on pmwiki.org(unsupported, non-generic), I think it more appropriate that a actively-supported, generic cookbook recipe be here, and the unsupported one for this site be elsewhere. MichaelPaulukonis May 16, 2013, at 10:34 AM

0.23 and the other versions are currently unsupported by me because I don't have the potential to support scripts released by other developers. The script running on PmWiki.org is fully endorsed and supported by me - I'll update it and document it as soon as I find the time - this will be faster for me than reviewing code modified by other people. The PITS listings use functions that I wrote with a different layout and caching that are not available in the Community version as of 0.24 so it will not be correct our demo to link to the community version. This is clearly a fork which I cannot support, it's place is on its own, different page with other maintainers. I still support code released by Pm or by me. --Petko May 16, 2013, at 02:43 PM

Talk page for the PITS recipe (users?).